1# Need to be URL, http or https
2# This url specifies the backend or a loadbalancer
3#
4# If you are using carbonzipper you should set it to
5# zipper's url
6#
7# If you are using plain go-carbon or graphite-clickhouse
8# you should set it to URL of go-carbon's carbonserver module
9# or graphite-clickhouse's http url.
10# Listen address, should always include hostname or ip address and a port.
11listen: "localhost:8081"
12# Specify URL Prefix for all handlers
13prefix: ""
14# Specify if metrics are exported over HTTP and if they are available on the same address or not
15# pprofEnabled controls if extra HTTP Handlers to profile and debug application will be available
16expvar:
17  enabled: true
18  pprofEnabled: false
19  listen: ""
20# Allow extra charsets in metric names. By default only "Latin" is allowed
21# Please note that each unicodeRangeTables will slow down metric parsing a bit
22#   For list of supported tables, see: https://golang.org/src/unicode/tables.go?#L3437
23#   Special name "all" reserved to append all tables that's currently supported by Go
24#unicodeRangeTables:
25#   - "Latin"
26#   - "Cyrillic"
27#   - "Hiragana"
28#   - "Katakana"
29#   - "Han"
30##   - "all"
31# Controls headers that would be passed to the backend
32headersToPass:
33  - "X-Dashboard-Id"
34  - "X-Grafana-Org-Id"
35  - "X-Panel-Id"
36headersToLog:
37  - "X-Dashboard-Id"
38  - "X-Grafana-Org-Id"
39  - "X-Panel-Id"
40# Specify custom function aliases.
41# This is example for alias "perMinute(metrics)" that will behave as "perSecond(metric)|scale(60)"
42define:
43  -
44    name: "perMinute"
45    template: "perSecond({{.argString}})|scale(60)"
46# Control what status code will be returned where /render or find query do not return any metric. Default is 200
47notFoundStatusCode: 200
48# Max concurrent requests to CarbonZipper
49concurency: 1000
50cache:
51   # Type of caching. Valid: "mem", "memcache", "null"
52   type: "mem"
53   # Cache limit in megabytes
54   size_mb: 0
55   # Default cache timeout value. Identical to DEFAULT_CACHE_DURATION in graphite-web.
56   defaultTimeoutSec: 60
57   # Only used by memcache type of cache. List of memcache servers.
58   memcachedServers:
59       - "127.0.0.1:1234"
60       - "127.0.0.2:1235"
61# Amount of CPUs to use. 0 - unlimited
62cpus: 0
63# Timezone, default - local
64tz: ""
65
66functionsConfig:
67    graphiteWeb: ./graphiteWeb.example.yaml
68maxBatchSize: 100
69graphite:
70    # Host:port where to send internal metrics
71    # Empty = disabled
72    host: ""
73    interval: "60s"
74    prefix: "carbon.api"
75    # rules on how to construct metric name. For now only {prefix} and {fqdn} is supported.
76    # {prefix} will be replaced with the content of {prefix}
77    # {fqdn} will be repalced with fqdn
78    pattern: "{prefix}.{fqdn}"
79# Maximium idle connections to carbonzipper
80idleConnections: 10
81pidFile: ""
82# See https://github.com/go-graphite/carbonzipper/blob/master/example.conf#L70-L108 for format explanation
83upstreams:
84    # Use TLD Cache. Useful when you have multiple backends that could contain
85    # different TLDs.
86    #
87    # For example whenever you have multiple top level metric namespaces, like:
88    #   one_min.some.metric
89    #   ten_min.some_metric
90    #   one_hour.some_metric
91    #
92    # `one_min`, `ten_min` and `one_hour` are considered to be TLDs
93    # carbonapi by default will probe all backends and cache the responses
94    # and will know which backends would contain the prefix of the request
95    #
96    # This option allows to disable that, which could be helpful for backends like
97    # `clickhouse` or other backends where all metrics are part of the same cluster
98    tldCacheDisabled: false
99
100    # Number of 100ms buckets to track request distribution in. Used to build
101    # 'carbon.zipper.hostname.requests_in_0ms_to_100ms' metric and friends.
102    # Requests beyond the last bucket are logged as slow (default of 10 implies
103    # "slow" is >1 second).
104    # The last bucket is _not_ called 'requests_in_Xms_to_inf' on purpose, so
105    # we can change our minds about how many buckets we want to have and have
106    # their names remain consistent.
107    buckets: 10
108
109    timeouts:
110        # Maximum backend request time for find requests.
111        find: "2s"
112        # Maximum backend request time for render requests. This is total one and doesn't take into account in-flight requests
113        render: "10s"
114        # Timeout to connect to the server
115        connect: "200ms"
116
117    # Number of concurrent requests to any given backend - default is no limit.
118    # If set, you likely want >= MaxIdleConnsPerHost
119    concurrencyLimitPerServer: 0
120
121    # Configures how often keep alive packets will be sent out
122    keepAliveInterval: "30s"
123
124    # Control http.MaxIdleConnsPerHost. Large values can lead to more idle
125    # connections on the backend servers which may bump into limits; tune with care.
126    maxIdleConnsPerHost: 100
127
128    # Only affects cases with maxBatchSize > 0. If set to `false` requests after split will be sent out one by one, otherwise in parallel
129    doMultipleRequestsIfSplit: false
130
131    # "http://host:port" array of instances of carbonserver stores
132    # It MUST be specified.
133    backends:
134        - "http://127.0.0.2:8080"
135        - "http://127.0.0.3:8080"
136        - "http://127.0.0.4:8080"
137        - "http://127.0.0.5:8080"
138
139    #backends section will override this one!
140    backendsv2:
141        backends:
142          -
143            groupName: "group1"
144            # supported:
145            #    carbonapi_v2_pb - carbonapi 0.11 or earlier version of protocol.
146            #    carbonapi_v3_pb - new protocol, http interface (native)
147            #    carbonapi_v3_grpc - new protocol, gRPC interface (native)
148            #    protobuf, pb, pb3 - same as carbonapi_v2_pb
149            #    msgpack - protocol used by graphite-web 1.1 and metrictank
150            #    auto - carbonapi will do it's best to guess if it's carbonapi_v3_pb or carbonapi_v2_pb
151            #
152            #  non-native protocols will be internally converted to new protocol, which will increase memory consumption
153            protocol: "carbonapi_v2_pb"
154            # supported:
155            #    "broadcast" - send request to all backends in group and merge responses. This was default behavior for carbonapi 0.11 or earlier
156            #    "roundrobin" - send request to one backend.
157            #    "all - same as "broadcast"
158            #    "rr" - same as "roundrobin"
159            lbMethod: "broadcast"
160            # amount of retries in case of unsuccessful request
161            maxTries: 3
162            # amount of metrics per fetch request. Default: 0 - unlimited. If not specified, global will be used
163            maxBatchSize: 100
164            # interval for keep-alive http packets. If not specified, global will be used
165            keepAliveInterval: "10s"
166            # override for global concurrencyLimit.
167            concurrencyLimit: 0
168            # override for global maxIdleConnsPerHost
169            maxIdleConnsPerHost: 1000
170            # force attempt to establish HTTP2 connection, instead of http1.1. Default: false
171            # Backends must use https for this to take any effect
172            forceAttemptHTTP2: false
173            # Only affects cases with maxBatchSize > 0. If set to `false` requests after split will be sent out one by one, otherwise in parallel
174            doMultipleRequestsIfSplit: false
175            # per-group timeout override. If not specified, global will be used.
176            # Please note that ONLY min(global, local) will be used.
177            timeouts:
178                # Maximum backend request time for find requests.
179                find: "2s"
180                # Maximum backend request time for render requests. This is total one and doesn't take into account in-flight requests.
181                render: "50s"
182                # Timeout to connect to the server
183                connect: "200ms"
184            servers:
185                - "http://127.0.0.2:8080"
186                - "http://127.0.0.3:8080"
187
188          -
189            groupName: "group2"
190            protocol: "carbonapi_v3_pb"
191            lbMethod: "roundrobin"
192            servers:
193                - "http://127.0.0.4:8080"
194                - "http://127.0.0.5:8080"
195
196
197    # carbonsearch is not used if empty
198    carbonsearch:
199        # Instance of carbonsearch backend
200        backend: "http://127.0.0.1:8070"
201        # carbonsearch prefix to reserve/register
202        prefix: "virt.v1.*"
203        # carbonsearch is not used if empty
204    # carbonsearch section will override this one!
205    carbonsearchv2:
206        # Carbonsearch instances. Follows the same syntax as backendsv2
207        backends:
208            -
209              groupName: "group1"
210              protocol: "carbonapi_v2_pb"
211              lbMethod: "broadcast"
212              servers:
213                  - "http://127.0.0.4:8080"
214                  - "http://127.0.0.5:8080"
215        # carbonsearch prefix to reserve/register
216        prefix: "virt.v1.*"
217
218    # Enable compatibility with graphite-web 0.9
219    # This will affect graphite-web 1.0+ with multiple cluster_servers
220    # Default: disabled
221    graphite09compat: false
222# If not zero, enabled cache for find requests
223# This parameter controls when it will expire (in seconds)
224# Default: 600 (10 minutes)
225graphTemplates: /usr/local/etc/carbonapi/graphTemplates.example.yaml
226expireDelaySec: 10
227# Uncomment this to get the behavior of graphite-web as proposed in https://github.com/graphite-project/graphite-web/pull/2239
228# Beware this will make darkbackground graphs less readable
229#defaultColors:
230#      "red": "ff0000"
231#      "green": "00ff00"
232#      "blue": "#0000ff"
233#      "darkred": "#c80032"
234#      "darkgreen": "00c800"
235#      "darkblue": "002173"
236logger:
237    - logger: ""
238      file: "stderr"
239      level: "debug"
240      encoding: "console"
241      encodingTime: "iso8601"
242      encodingDuration: "seconds"
243    - logger: ""
244      file: "/var/log/carbonapi/carbonapi.log"
245      level: "info"
246      encoding: "json"
247