github.com/go-graphite/carbonapi@v0.17.0/doc/configuration.md (about)

     1  Table of Contents
     2  =================
     3  
     4  * [General configuration for carbonapi](#general-configuration-for-carbonapi)
     5    * [listen](#listen)
     6      * [Example:](#example)
     7    * [useCachingDNSResolver](#useCachingDNSResolver)
     8    * [prefix](#prefix)
     9      * [Example:](#example-1)
    10    * [headersToPass](#headerstopass)
    11      * [Example:](#example-2)
    12    * [headersToLog](#headerstolog)
    13      * [Example:](#example-3)
    14    * [headersToLog](#define)
    15      * [Example:](#example-4)
    16    * [notFoundStatusCode](#notfoundstatuscode)
    17      * [Example:](#example-5)
    18    * [httpResponseStackTrace](#httpresponsestacktrace)
    19    * [unicodeRangeTables](#unicoderangetables)
    20      * [Example](#example-6)
    21    * [cache](#cache)
    22      * [Example](#example-7)
    23    * [cpus](#cpus)
    24      * [Example](#example-8)
    25    * [tz](#tz)
    26      * [Example](#example-9)
    27    * [extractTagsFromArgs](#extractTagsFromArgs)
    28      * [Example](#example-10)
    29    * [functionsConfig](#functionsconfig)
    30      * [Example](#example-11)
    31      * [Example for timeShift](#example-for-timeshift)
    32    * [graphite](#graphite)
    33      * [Example](#example-12)
    34    * [pidFile](#pidfile)
    35      * [Example](#example-13)
    36    * [graphTemplates](#graphtemplates)
    37      * [Example](#example-14)
    38    * [defaultColors](#defaultcolors)
    39      * [Example](#example-15)
    40    * [expvar](#expvar)
    41      * [Example](#example-16)
    42    * [logger](#logger)
    43      * [Example](#example-17)
    44  * [Carbonzipper configuration](#carbonzipper-configuration)
    45    * [concurency](#concurency)
    46      * [Example](#example-18)
    47    * [maxBatchSize](#maxbatchsize)
    48      * [Example](#example-19)
    49    * [idleConnections](#idleconnections)
    50    * [upstreams](#upstreams)
    51      * [Example](#example-20)
    52        * [For go\-carbon and prometheus](#for-go-carbon-and-prometheus)
    53        * [For VictoriaMetrics](#for-victoriametrics)
    54        * [For graphite\-clickhouse](#for-graphite-clickhouse)
    55        * [For metrictank](#for-metrictank)
    56        * [For IRONdb](#for-irondb)
    57    * [expireDelaySec](#expiredelaysec)
    58      * [Example](#example-21)
    59    * [nudgeStartTimeOnAggregation](#nudgestarttimeonaggregation)
    60    * [useBucketsHighestTimestampOnAggregation](#usebucketshighesttimestamponaggregation)
    61  
    62  # General configuration for carbonapi
    63  
    64  ## listen
    65  
    66  Describe the port and address that carbonapi will bind to. This is the one that you can use to connect to it.
    67  
    68  ### Example:
    69  This will make it available on http://localhost:8081:
    70  ```yaml
    71  listen: "localhost:8081"
    72  ```
    73  
    74  This will make it available on all addresses, port 8080:
    75  ```yaml
    76  listen: ":8080"
    77  ```
    78  
    79  This will make it available on all IPv4 addresses, port 8080:
    80  ```yaml
    81  listen: "0.0.0.0:8080"
    82  ```
    83  
    84  ***
    85  ## useCachingDNSResolver
    86  
    87  **You shouldn't use it unless you know what you are doing.**
    88  
    89  Use custom DNS resolver that have internal cache instead of default Golang one. This is global setting and cannot be overridden on backend level.
    90  
    91  This option might help with environments where using DNS names is highly encouraged but DNS server provided have troubles keeping up with request rate. For example - some older versions of k8s or very specific settings on kube-dns side might rate-limit DNS requests.
    92  
    93  Please note that this DNS resolver is deliberately non-RFC compliant and will ignore TTL for the domain. `cachingDNSRefreshTime` will be used as a TTL instead.
    94  
    95  Default: false
    96  
    97  ***
    98  ## cachingDNSRefreshTime
    99  
   100  If `useCachingDNSResolver` is set to true, this is the TTL for DNS records to be valid.
   101  
   102  Default: 1m
   103  
   104  ***
   105  ## prefix
   106  
   107  Specify prefix for all URLs. Might be useful when you cannot afford to listen on different port.
   108  
   109  Default: None
   110  
   111  ### Example:
   112  This will make carbonapi handlers accessible on `/graphite`, e.x. `http://localhost:8080/render` will become `http://localhost:8080/graphite/render` 
   113  
   114  ```yaml
   115  prefix: "graphite"
   116  ```
   117  
   118  ***
   119  ## headersToPass
   120  
   121  This option controls what headers (if passed by upstream client) will be passed to backends..
   122  
   123  Default: none
   124  
   125  ### Example:
   126  This is example to pass all dashboard/panel ids from Grafana
   127  ```yaml
   128  headersToPass:
   129      - "X-Dashboard-Id"
   130      - "X-Grafana-Org-Id"
   131      - "X-Panel-Id"
   132  ```
   133  
   134  ***
   135  ## headersToLog
   136  
   137  This option controls what headers will be logged by carbonapi (accessLog).
   138  
   139  If header is not present, it won't be logged.
   140  
   141  Headers will be appended to access log and to any other carbonapi logs for this handler if there is any used.
   142  They won't be logged at zipper's level (currently).
   143  
   144  Default: none
   145  
   146  ### Example:
   147  This is example to log all dashboard/panel ids from Grafana
   148  ```yaml
   149  headersToLog:
   150      - "X-Dashboard-Id"
   151      - "X-Grafana-Org-Id"
   152      - "X-Panel-Id"
   153  ```
   154  
   155  ***
   156  ## notFoundStatusCode
   157  
   158  This option controls what status code will be returned if `/render` or `/metrics/find` won't return any metrics 
   159  
   160  In some cases someone would like to override this to "200". Example use case - when you create a dashboard before
   161  service starts to send any data out and don't want to have errors from Grafana.
   162  
   163  Default: 200
   164  
   165  ### Example:
   166  This is example to return HTTP code 200
   167  ```yaml
   168  notFoundStatusCode: 200
   169  ```
   170  
   171  ***
   172  ## httpResponseStackTrace
   173  
   174  This option controls if stack trace should be sent as http answer in case of a panic during `/render` proceeding.
   175  
   176  Default: true
   177  
   178  ***
   179  ## define
   180  
   181  List of custom function aliases (defines)
   182  
   183  Defines are done by templating this custom aliases to known set of functions.
   184  
   185  Templating is done by utilizing golang text template language.
   186  
   187  Supported variables:
   188   - argString - argument as a string. E.x. in query `myDefine(foo, bar, baz)`, argString will be `foo, bar, baz`
   189   - args - indexed array of arguments. E.x. in case of `myDefine(foo, bar)`, `index .args 0` will be first argument, `index .args 1` will be second
   190   - kwargs - key-value arguments (map). This is required to support cases like `myDefine(foo, bar=baz)`, in this case `index .args 0` will contain `foo`, and `index .kwargs "bar"` will contain `baz`
   191  
   192  ### Example:
   193  Create a perMinute function, that do "perSecond" and then scale it by 60
   194  
   195  Config:
   196  ```yaml
   197  define:
   198    -
   199      name: "perMinute"
   200      template: "perSecond({{.argString}})|scale(60)" 
   201  ```
   202  
   203  Example Query:
   204  
   205  `/render/?target=perMinute(foo.bar)`
   206  
   207  ***
   208  ## unicodeRangeTables
   209  
   210  Allow extra charsets in metric names. By default only "Latin" is allowed
   211  
   212  Please note that each unicodeRangeTables will slow down metric parsing a bit
   213  
   214  For list of supported tables, see: https://golang.org/src/unicode/tables.go?#L3437
   215  
   216  Special name "all" reserved to append all tables that's currently supported by Go
   217  
   218  ### Example
   219  This will allow support of Latin, Cyrillic and Japanese characters in metric names:
   220  ```yaml
   221  unicodeRangeTables:
   222     - "Latin"
   223     - "Cyrillic"
   224     - "Hiragana"
   225     - "Katakana"
   226     - "Han"
   227  ```
   228  
   229  Please note that you need to specify "Latin" if you are redefining this list.
   230  
   231  This will allow support of all unicode characters that's supported by Go
   232  ```yaml
   233  unicodeRangeTables:
   234     - "all"
   235   ```
   236  
   237  ***
   238  ## cache
   239  Specify what storage to use for response cache. This cache stores the final
   240  carbonapi response right before sending it to the client. A cache hit to this
   241  cache avoids almost all computations, including rendering images etc. On the
   242  other hand, a request will cause a cache hit only if a previous request with
   243  exactly the same response format and with same maxDataPoints param populated the
   244  cache. Grafana sets maxDataPoints depending on client screen width, reducing the
   245  hit ratio for this cache.
   246  
   247  Supported cache types:
   248   - `mem` - will use integrated in-memory cache. Not distributed. Fast.
   249   - `memcache` - will use specified memcache servers. Could be shared. Slow.
   250   - `null` - disable cache
   251  
   252  Extra options:
   253   - `size_mb` - specify max size of cache, in MiB
   254   - `defaultTimeoutSec` - specify default cache duration. Identical to `DEFAULT_CACHE_DURATION` in graphite-web
   255  ### Example
   256  ```yaml
   257  cache:
   258     type: "memcache"
   259     size_mb: 0
   260     defaultTimeoutSec: 60
   261     memcachedServers:
   262         - "127.0.0.1:1234"
   263         - "127.0.0.2:1235"
   264  ```
   265  
   266  ## backendCache
   267  Specify what storage to use for backend cache. This cache stores the responses
   268  from the backends. It should have more cache hits than the response cache since
   269  the response format and the maxDataPoints paramter are not part of the cache
   270  key, but results from cache still need to be postprocessed (e.g. serialized to
   271  desired response format).
   272  
   273  Supports same options as the response cache.
   274  ### Example
   275  ```yaml
   276  backendCache:
   277     type: "memcache"
   278     size_mb: 0
   279     defaultTimeoutSec: 60
   280     memcachedServers:
   281         - "127.0.0.1:1234"
   282         - "127.0.0.2:1235"
   283  ```
   284  
   285  In many cases two-level cache is useful. Additional parameters for configuration:
   286  - `shortDuration` until-from duration (by default "3h")
   287  - `shortUntilOffsetSec` now-until duration seconds (by default 120)
   288  - `shortTimeoutSec`  - short duration, disabled by default, used when `(from-until<=shortDuration) && (now-until<shortUntilOffsetSec)`
   289  
   290  ### Example for 2-level cache lifetime (short timeout on 1-hour window and long timeout for other) and round timestamps for tune cache efficience
   291  ```yaml
   292  cache:
   293     type: "mem"
   294     size_mb: 0
   295     defaultTimeoutSec: 10800 # Default cache timeout
   296     shortTimeoutSec: 60 # if until - from <= 3hour && now-until < 2min
   297  backendCache:
   298     type: "mem"
   299     size_mb: 0
   300     defaultTimeoutSec: 10800 # Default cache timeout
   301     shortTimeoutSec: 60 # if until - from <= 3hour && now-until < 2min
   302  
   303  truncateTime: # truncate from/until for identifical results between carbonapi instances. Also reduce load on long-range queries
   304    "8760h": "1h"     # Timestamp will be truncated to 1 hour round if (until - from) > 365 days
   305    "2160h": "10m"     # Timestamp will be truncated to 10 minute round if (until - from) > 90 days
   306    "1h": "1m"         # Timestamp will be truncated to 1 minute round if (until - from) > 1 hour
   307    "0": "10s"         # Timestamp will be truncated to 10 seconds round by default
   308  ```
   309  
   310  ***
   311  ## cpus
   312  
   313  Specify amount of CPU Cores that golang can use. 0 - unlimited
   314  
   315  ### Example
   316  ```yaml
   317  cpus: 0
   318  ```
   319  
   320  ***
   321  ## tz
   322  Specify timezone to use.
   323  
   324  Format: `name,offset`
   325  
   326  You need to specify the timezone to use and it's offset from UTC
   327   
   328  Default: "local"
   329  
   330  ### Example
   331  Use timezone that will be called "Europe/Zurich" with offset "7200" seconds (UTC+2)
   332  ```yaml
   333  tz: "Europe/Zurich,7200"
   334  ```
   335  
   336  ***
   337  ## extractTagsFromArgs
   338  
   339  By default, functions like aggregate inherit tags from first series (for compatibility with graphite-web).
   340  
   341  If set extractTagsFromArgs to true, tags are extracted from seriesByTag arguments
   342  
   343  ### Example
   344  
   345  ```yaml
   346  extractTagsFromArgs: true
   347  ```
   348  
   349  ## functionsConfig
   350  
   351  Extra config files for specific functions
   352  
   353  Only the following functions currently support having their own config:
   354    - `graphiteWeb`
   355    - `aliasByPostgres`
   356    - `movingMedian`
   357    - `moving` (applies to `movingAverage`, `movingMin`, `movingMax`, `movingSum`)
   358  
   359  ### Example
   360  ```yaml
   361  functionsConfig:
   362      graphiteWeb: ./graphiteWeb.example.yaml
   363  ```
   364  
   365  ### Example for timeShift
   366  ```yaml
   367  functionsConfig:
   368      timeShift: ./timeShift.example.yaml
   369  ```
   370  
   371  `timeShift.example.yaml`:
   372  ```yaml
   373  resetEndDefaultValue: false
   374  ```
   375  
   376  ***
   377  ## graphite
   378  Specify configuration on how to send internal metrics to graphite.
   379  
   380  Available parameters:
   381    - `host` - specify host where to send metrics. Leave empty to disable
   382    - `interval` - specify how often to send statistics (e.x. `60s` or `1m` for every minute)
   383    - `prefix` - specify metrics prefix
   384    - `pattern` - allow to control how metrics are named.
   385    Special word `{prefix}` will be replaced with content of `prefix` variable.
   386    Special word `{fqdn}` will be replaced with host's full hostname (fqdn)
   387    
   388    
   389  Specifying tags currently not supported.
   390  ### Example
   391  ```yaml
   392  graphite:
   393      host: ""
   394      interval: "60s"
   395      prefix: "carbon.api"
   396      pattern: "{prefix}.{fqdn}"
   397  ```
   398  
   399  ***
   400  ## pidFile
   401  
   402  Specify pidfile. Useful for systemd units
   403  
   404  ### Example
   405  ```yaml
   406  pidFile: ""
   407  ```
   408  
   409  ***
   410  ## graphTemplates
   411  Specify file with graphTemplates.
   412  
   413  ### Example
   414  ```yaml
   415  graphTemplates: graphTemplates.example.yaml
   416  ```
   417  
   418  ***
   419  ## defaultColors
   420  
   421  Specify default color maps to html-style colors, used in png/svg rendering only
   422  
   423  ### Example
   424  This will make the behavior same as in graphite-web as proposed in https://github.com/graphite-project/graphite-web/pull/2239
   425  
   426  Beware this will make dark background graphs less readable
   427  ```yaml
   428  defaultColors:
   429        "red": "ff0000"
   430        "green": "00ff00"
   431        "blue": "#0000ff"
   432        "darkred": "#c80032"
   433        "darkgreen": "00c800"
   434        "darkblue": "002173"
   435  ```
   436  
   437  ***
   438  ## expvar
   439  
   440  Controls whether expvar (contains internal metrics, config, etc) is enabled and if it's accessible on a separate address:port.
   441  Also allows to enable pprof handlers (useful for profiling and debugging).
   442  
   443  Please note, that exposing pprof handlers to untrusted network is *dangerous* and might lead to data leak.
   444  
   445  Exposing expvars to untrusted network is not recommended as it might give 3rd party unnecessary amount of data about your infrastructure.
   446  
   447  ### Example
   448  This describes current defaults: expvar enabled, pprof handlers disabled, listen on the same address-port as main application.
   449  ```yaml
   450  expvar:
   451        enabled: true
   452        pprofEnabled: false
   453        listen: ""
   454  ```
   455  
   456  This is useful to enable debugging and to move all related handlers and add exposed only on localhost, port 7070.
   457  ```yaml
   458  expvar:
   459        enabled: true
   460        pprofEnabled: true
   461        listen: "localhost:7070"
   462  ```
   463  
   464  ***
   465  ## logger
   466  
   467  Allows to fine-tune logger
   468  
   469  Supported loggers:
   470   - `zipper` for all zipper-related messages
   471   - `access` - for access logs
   472   - `slow` - for slow queries
   473   - `functionInit` - for function-specific messages (during initialization, e.x. configs)
   474   - `main` - logger that's used during initial startup
   475   - `registerFunction` - logger that's used when new functions are registered (should be quite)
   476  
   477  Supported options (per-logger):
   478    - `logger` - specify logger name (see above)
   479    - `file` - where log will be written to. Can be file name or `stderr` or `stdout`
   480    - `level` - loglevel. Please note that `debug` is rather verbose, but `info` should mostly stay quiet
   481    - `encoding` - `console`, `json` or `mixed`, first one should be a bit more readable for human eyes
   482    - `encodingTime` - specify how time-dates should be encoded. `iso8601` will follow ISO-8601, `millis` will be epoch with milliseconds, everything else will be epoch only.
   483    - `encodingDuration` - specify how duration should be encoded
   484  
   485  ### Example
   486  ```yaml
   487  logger:
   488      - logger: ""
   489        file: "stderr"
   490        level: "debug"
   491        encoding: "console"
   492        encodingTime: "iso8601"
   493        encodingDuration: "seconds"
   494      - logger: ""
   495        file: "/var/log/carbonapi.log"
   496        level: "info"
   497        encoding: "json"
   498      # disable slow log completely
   499      - logger: "slow"
   500        level: "error"
   501  ```
   502  
   503  
   504  # Carbonzipper configuration
   505  There are two types of configurations supported:
   506   1. Old-style - this is the one that was used in standalone zipper or in bookingcom's zipper
   507   2. New-style - supported since carbonapi 0.12.0 and allows you to specify different type of load-balancing algorithms, etc. 
   508  ## concurency
   509  Specify max metric requests that can be fetched in parallel.
   510  
   511  Default: 1000
   512  
   513  It's overall recommended to set that value to at least `requests_per_second*average_time_per_request`
   514  
   515  If you want to have not more than 20 requests per second (any type of them) and on average request takes about 3 seconds, you should set this value to at least 60.
   516  
   517  For high-performance setup it's **not** recommended to set this value to lower than default.
   518  
   519  ### Example
   520  ```yaml
   521  concurency: 1000
   522  ```
   523  
   524  ***
   525  ## maxBatchSize
   526  (old-style option)
   527  
   528  Specify maximum number of metrics per request (used with old upstream style configuration)
   529  
   530  ### Example
   531  ```yaml
   532  maxBatchSize: 100
   533  ```
   534  
   535  ***
   536  ## idleConnections
   537  (old-style option)
   538  
   539  Maximium idle connections to carbonzipper
   540  
   541  ##Example
   542  ```yaml
   543  idleConnections: 10
   544  ```
   545  
   546  ***
   547  ## upstreams
   548  
   549  (Required)
   550  
   551  Main configuration for backends.
   552  
   553  Supported options:
   554    - `graphite09compat` - enables compatibility with graphite-web 0.9.x in terms of cluster response, default: false
   555    - `buckets` - Number of 100ms buckets to track request distribution in. Used to build `carbon.zipper.hostname.requests_in_0ms_to_100ms` metric and friends.
   556    
   557       The last bucket is **not** called 'requests_in_Xms_to_inf' on purpose, so we can change our minds about how many buckets we want to have and have their names remain consistent.
   558    - `slowLogThreshold` -  threshold for slow requests to be logged.
   559  
   560      If you don't want it to be logged at all, please see [logger](#example-16) section for more details
   561  
   562      Default: "1s"
   563    - `timeouts` - structure that allow to set timeout for `find`, `render` and `connect` phases
   564    - `backendOptions` - extra options to pass for the backend.
   565  
   566      currently, only prometheus backend supports options.
   567  
   568      valid options:
   569        - `step` - (`prometheus` or `victoriametrics` only) define default step for the request
   570        - `start` - (`prometheus` or `victoriametrics` only) define "start" parameter for `/api/v1/series` requests
   571  
   572          supports either unix timestamp or delta from now(). For delta you should specify it in duration format.
   573  
   574          For example `-5m` will mean "5 minutes ago", time will be resolved every time you do find query.
   575        - `max_points_per_query` - (`prometheus` or `victoriametrics` only) define maximum datapoints per query. It will be used to adjust step for queries over big range. Default limit for Prometheus is 11000.
   576        - `force_min_step_interval` - (`prometheus` or `victoriametrics` only) define to force using `step` in all requests ignoring MaxDataPoints param for given interval. Default value for Prometheus and VictoriaMetrics is `0s` so feature is disabled.
   577        - `probe_version_interval` - (`victoriametrics` only) define how often VictoriaMetrics version will be checked (as VM supports certain API endpoints starting from a specific version). Special value to disable: `never`. Default: `600s`.
   578        - `fallback_version` - (`victoriametrics` only) define version string that will be used as a fallback if version_short will be empty (useful when you run master builds, as they will have it empty). Format: "vX.Y.Z", Default: `v0.0.0` (all special VM optimizations will be disabled)
   579        - `vmClusterTenantID` - `victoriametrics` in **cluster mode** only. Use this option to configure `accountID` and `projectID` in the VM-cluster API urls. Tenants are identified by "accountID" or "accountID:projectID". Type: `string`. Default: none (single node VictoriaMetrics).
   580        - `irondb_account_id` - (`irondb` only) Client AccountID, default - `1`
   581        - `irondb_graphite_rollup`- (`irondb` only) Graphite rollup for IRONdb, in seconds. Default - `60`
   582        - `irondb_graphite_prefix`- (`irondb` only) Optional Graphite prefix for IRONdb. Default - `` (empty)
   583        - `irondb_timeout` - (`irondb` only) Timeout gets the timeout duration for HTTP requests to IRONdb. The default value is `10s`, but please make it lower than top level `find` and `render` timeouts.
   584        - `irondb_dial_timeout` - (`irondb` only) DialTimeout gets the initial connection timeout duration for attempts to connect to IRONdb. The default value is `500ms`.
   585        - `irondb_watch_interval` - (`irondb` only) WatchInterval gets the frequency at which a SnowthClient will check for updates to the active status of its nodes if WatchAndUpdate() is called. Default value - `30s`
   586        `irondb_connect_retries` - (`irondb` only) ConnectRetries gets the number of times requests will be retried on other nodes when network errors occur. Default - `-1`, that means unlimited.
   587        `irondb_retries`- (`irondb` only) Retries gets the number of times requests will be retried. Default is taken from `retries` value.
   588    - `concurrencyLimitPerServer` - limit of max connections per server. Likely should be >= maxIdleConnsPerHost. Default: 0 - unlimited
   589    - `maxIdleConnsPerHost` - as we use KeepAlive to keep connections opened, this limits amount of connections that will be left opened. Tune with care as some backends might have issues handling larger number of connections.
   590    - `keepAliveInterval` - KeepAlive interval
   591    - `scaleToCommonStep` - controls if metrics in one target should be aggregated to common step. `true` by default
   592    - `backends` - old-style backend configuration.
   593    
   594      Contains list of servers. Requests will be sent to **ALL** of them. There is a small optimization here - every once in a while, carbonapi will ask all backends about top-level parts of metric names and will try to send requests only to servers which have that in their name.
   595      
   596      This doesn't yet work if there are tags involved.
   597      
   598      Note: `backend` section will override `backendv2` if both specified.
   599    - `carbonsearch` - old-style carbonsearch configuration.
   600    
   601      It supports 2 options:
   602          * `backend` - specify the url where carbonsearch is
   603          * `prefix` - specify metric prefix that will be sent to carbonsearch.
   604    
   605      carbonsearch is an old attempt to implement tags for go-graphite stack: https://github.com/kanatohodets/carbonsearch
   606      
   607      It's not known if it was widely used outside of Booking.com and it's no longer known if Booking.com still use that functionality.
   608      
   609      Example carbonsearch query:
   610      
   611      `virt.v1.*.lb-pool:www.server-state:installed`
   612      
   613      It will fetch all metrics that have tag `lb-pool` set to `www` and  `server-state` set to `installed`
   614      
   615      It's mostly equivalent of:
   616      
   617      `seriesByTags('lb-pool=www','server-state=installed')`
   618      
   619      However metrics will be resolved by a separate server in this case.
   620      
   621    - `carbonsearchv2` - (new-style) configuration for carbonsearch
   622    
   623       Supports following extra options:
   624         * `backends` - list of backend groups. Request will be sent to all backend groups. However inside each of them it might be treated as broadcast or round-robin.
   625           
   626           Should contain:
   627             * `groupName` - name of the carbonsearch backend
   628             * `protocol` - only `carbonapi_v2_pb` make any sense as of now, as the only known implementation implements that protocol.
   629             * `lbMethod` - load-balancing method.
   630             
   631               Supported methods:             
   632                 * `broadcast`, `all` - will send query to all of the servers and combine the response
   633                 * `roundrobin`, `rr`, `any` - will send requests in round-robin manner. This means that all servers will be treated as equals and they all should contain full set of data
   634      
   635    - `backendv2` - (new-style) configuration for backends
   636    
   637       Supports following extra options:
   638         * `backends` - list of backend groups. Request will be sent to all backend groups. However inside each of them it might be treated as broadcast or round-robin.
   639           
   640           Should contain:
   641             * `groupName` - name of the carbonapi's backend
   642             * `protocol` - specify protocol for the backend.
   643             
   644               Supported protocols:
   645                 * `carbonapi_v3_pb` - new native protocol, over http. Should be fastest. Currently supported by [lomik/go-carbon](https://github.com/lomik/go-carbon), [lomik/graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) and [go-graphite/carbonapi](https://github.com/go-graphite/carbonapi)
   646                 * `carbonapi_v3_grpc` - new experimental protocol that instead of HTTP requests, uses gRPC. No known backend support that.
   647                 * `carbonapi_v2_pb`, `protobuf`, `pb`, `pb3` - older protobuf-based protocol. Supported by [lomik/go-carbon](https://github.com/lomik/go-carbon) and [lomik/graphite-clickhouse](https://github.com/lomik/graphite-clickhouse)
   648                 * `msgpack` - message pack encoding, supported by [graphite-project/graphite-web](https://github.com/graphite-project/graphite-web) and [grafana/metrictank](https://github.com/grafana/metrictank)
   649                 * `prometheus` - prometheus HTTP Request API. Can be used with [prometheus](https://prometheus.io) and should be usable with other backends that supports PromQL (backend can do basic fetching at this moment and doesn't offload any functions to the backend).
   650                 * `victoriametrics`, `vm` - special version of prometheus backend, that take advantage of some APIs that's not supported by prometheus. Can be used with [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics).
   651                 * `snowthd`, `irondb` - supports reading Graphite-compatible metrics from [IRONdb](https://docs.circonus.com/irondb/) from [Circonus](https://www.circonus.com/).
   652                 * `auto` - attempts to detect if carbonapi can use `carbonapi_v3_pb` or `carbonapi_v2_pb`
   653             * `lbMethod` - load-balancing method.
   654             
   655               Supported methods:             
   656                 * `broadcast`, `all` - will send query to all of the servers and combine the response
   657                 
   658                   It's best suited for independent backends, like go-carbon
   659                 * `roundrobin`, `rr`, `any` - will send requests in round-robin manner. This means that all servers will be treated as equals and they all should contain full set of data
   660                 
   661                   It's best suited for backends in cluster mode, like Clickhouse.
   662             * `maxTries` - specify amount of retries if query fails
   663             * `maxBatchSize` - max metrics per request.
   664             
   665               0 - unlimited.
   666               
   667               If not 0, carbonapi will do `find` request to determine how many metrics matches criteria and only then will fetch them, not more than `maxBatchSize` per request.
   668               
   669             * `keepAliveInterval` - override global `keepAliveInterval` for this backend group
   670             * `concurrencyLimit` - override global `concurrencyLimit` for this backend group
   671             * `maxIdleConnsPerHost` - override global `maxIdleConnsPerHost` for this backend group
   672             * `timeouts` - override global `timeouts` struct for this backend group
   673             * `servers` - list of sever URLs in this backend groups
   674  
   675  ### Example
   676  
   677  Old-style configuration:
   678  ```yaml
   679  upstreams:
   680      graphite09compat: false
   681      buckets: 10
   682  
   683      timeouts:
   684          find: "2s"
   685          render: "10s"
   686          connect: "200ms"
   687  
   688      concurrencyLimitPerServer: 0
   689      maxIdleConnsPerHost: 100
   690      keepAliveInterval: "30s"
   691  
   692      carbonsearch:
   693          backend: "http://127.0.0.1:8070"
   694          prefix: "virt.v1.*"
   695      backends:
   696          - "http://127.0.0.2:8080"
   697          - "http://127.0.0.3:8080"
   698          - "http://127.0.0.4:8080"
   699          - "http://127.0.0.5:8080"
   700  ```
   701  
   702  #### For go-carbon and prometheus
   703  ```yaml
   704  upstreams:
   705      graphite09compat: false
   706      buckets: 10
   707  
   708      concurrencyLimitPerServer: 0
   709      keepAliveInterval: "30s"
   710      maxIdleConnsPerHost: 100
   711      timeouts:
   712          find: "2s"
   713          render: "10s"
   714          connect: "200ms"
   715  
   716      carbonsearchv2:
   717          prefix: "virt.v1.*"
   718          backends:
   719              -
   720                groupName: "shard-1"
   721                protocol: "carbonapi_v2_pb"
   722                lbMethod: "rr"
   723                servers:
   724                    - "http://192.168.1.1:8080"
   725                    - "http://192.168.1.2:8080"
   726              -
   727                groupName: "shard-2"
   728                protocol: "carbonapi_v2_pb"
   729                lbMethod: "rr"
   730                servers:
   731                    - "http://192.168.1.3:8080"
   732                    - "http://192.168.1.4:8080"
   733      #backends section will override this one!
   734      backendsv2:
   735          backends:
   736            -
   737              groupName: "go-carbon-group1"
   738              protocol: "carbonapi_v3_pb"
   739              lbMethod: "broadcast"
   740              maxTries: 3
   741              maxBatchSize: 100
   742              keepAliveInterval: "10s"
   743              concurrencyLimit: 0
   744              maxIdleConnsPerHost: 1000
   745              timeouts:
   746                  find: "2s"
   747                  render: "50s"
   748                  connect: "200ms"
   749              servers:
   750                  - "http://192.168.0.1:8080"
   751                  - "http://192.168.0.2:8080"
   752            -
   753              groupName: "go-carbon-legacy"
   754              maxBatchSize: 10
   755              concurrencyLimit: 0
   756              maxIdleConnsPerHost: 100
   757              protocol: "carbonapi_v2_pb"
   758              lbMethod: "broadcast"
   759              servers:
   760                  - "http://192.168.0.3:8080"
   761                  - "http://192.168.0.4:8080"
   762            -
   763              groupName: "prometheus"
   764              maxBatchSize: 0
   765              concurrencyLimit: 0
   766              maxIdleConnsPerHost: 1000
   767              protocol: "prometheus"
   768              lbMethod: "broadcast"
   769              servers:
   770                  - "http://192.168.0.5:9090"
   771                  - "http://192.168.0.6:9090"
   772  ```
   773  
   774  #### For VictoriaMetrics
   775  ```yaml
   776  upstreams:
   777      graphite09compat: false
   778      buckets: 10
   779      concurrencyLimitPerServer: 0
   780      keepAliveInterval: "30s"
   781      maxIdleConnsPerHost: 100
   782      timeouts:
   783          find: "2s"
   784          render: "10s"
   785          connect: "200ms"
   786      backendsv2:
   787          backends:
   788            -
   789              groupName: "victoriametrics"
   790              protocol: "victoriametrics"
   791              lbMethod: "broadcast"
   792              maxBatchSize: 0
   793              concurrencyLimit: 0
   794              maxIdleConnsPerHost: 1000
   795              servers:
   796                  - "http://192.168.0.5:8428"
   797                  - "http://192.168.0.6:8428"
   798  ```
   799  
   800  #### For graphite-clickhouse
   801  ```yaml
   802  upstreams:
   803      graphite09compat: false
   804      buckets: 10
   805  
   806      concurrencyLimitPerServer: 0
   807      keepAliveInterval: "30s"
   808      maxIdleConnsPerHost: 100
   809      timeouts:
   810          find: "2s"
   811          render: "10s"
   812          connect: "200ms"
   813  
   814      #backends section will override this one!
   815      backendsv2:
   816          backends:
   817            -
   818              groupName: "clickhouse-cluster1"
   819              protocol: "carbonapi_v2_pb" # "carbonapi_v3_pb" for the latest master
   820              lbMethod: "rr"
   821              maxTries: 3
   822              maxBatchSize: 0
   823              keepAliveInterval: "10s"
   824              concurrencyLimit: 0
   825              maxIdleConnsPerHost: 1000
   826              timeouts:
   827                  find: "2s"
   828                  render: "50s"
   829                  connect: "200ms"
   830              servers:
   831                  - "http://192.168.0.1:8080"
   832                  - "http://192.168.0.2:8080"
   833            -
   834              groupName: "clickhouse-cluster2"
   835              protocol: "carbonapi_v2_pb" # "carbonapi_v3_pb" for the latest master
   836              lbMethod: "rr"
   837              maxTries: 3
   838              maxBatchSize: 0
   839              backendOptions:
   840                  step: "60"
   841                  start: "-5m"
   842              keepAliveInterval: "10s"
   843              concurrencyLimit: 0
   844              maxIdleConnsPerHost: 1000
   845              servers:
   846                  - "http://192.168.0.3:8080"
   847                  - "http://192.168.0.4:8080"
   848  ```
   849  
   850  #### For metrictank
   851  ```yaml
   852  upstreams:
   853      graphite09compat: false
   854      buckets: 10
   855  
   856      concurrencyLimitPerServer: 0
   857      keepAliveInterval: "30s"
   858      maxIdleConnsPerHost: 100
   859      timeouts:
   860          find: "2s"
   861          render: "10s"
   862          connect: "200ms"
   863  
   864      #backends section will override this one!
   865      backendsv2:
   866          backends:
   867            -
   868              groupName: "metrictank"
   869              protocol: "msgpack"
   870              lbMethod: "rr"
   871              maxTries: 3
   872              maxBatchSize: 0
   873              keepAliveInterval: "10s"
   874              concurrencyLimit: 0
   875              maxIdleConnsPerHost: 1000
   876              timeouts:
   877                  find: "2s"
   878                  render: "50s"
   879                  connect: "200ms"
   880              servers:
   881                  - "http://192.168.0.1:6060"
   882                  - "http://192.168.0.2:6060"
   883            -
   884              groupName: "graphite-web"
   885              protocol: "msgpack"
   886              lbMethod: "broadcast"
   887              maxTries: 3
   888              maxBatchSize: 0
   889              keepAliveInterval: "10s"
   890              concurrencyLimit: 0
   891              maxIdleConnsPerHost: 1000
   892              servers:
   893                  - "http://192.168.0.3:8080?format=msgpack"
   894                  - "http://192.168.0.4:8080?format=msgpack"
   895  ```
   896  #### For IronDB
   897  ```yaml
   898  upstreams:
   899      graphite09compat: false
   900      buckets: 10
   901  
   902      concurrencyLimitPerServer: 0
   903      keepAliveInterval: "30s"
   904      maxIdleConnsPerHost: 100
   905      timeouts:
   906          find: "2s"
   907          render: "10s"
   908          connect: "200ms"
   909  
   910      #backends section will override this one!
   911      backendsv2:
   912          backends:
   913            -
   914              groupName: "snowthd"
   915              protocol: "irondb"
   916              lbMethod: "rr" # please use "roundrobin" - broadcast has not much sense here
   917              maxTries: 3
   918              maxBatchSize: 0 # recommended value
   919              keepAliveInterval: "10s"
   920              concurrencyLimit: 0
   921              maxIdleConnsPerHost: 1000
   922              doMultipleRequestsIfSplit: false # recommended value
   923              backendOptions:
   924                irondb_account_id: 1
   925                irondb_timeout: "5s" # ideally shold be less then find or render timeout
   926                irondb_graphite_rollup: 60
   927              servers:
   928                  - "http://192.168.0.1:8112"
   929                  - "http://192.168.0.2:8112"
   930                  - "http://192.168.0.3:8112"
   931  
   932  ```
   933  
   934  
   935  ***
   936  ## expireDelaySec
   937  If not zero, enabled cache for find requests this parameter controls when it will expire (in seconds)
   938  
   939  Default: 600 (10 minutes)
   940  
   941  ### Example
   942  ```yaml
   943  expireDelaySec: 10
   944  ```
   945  
   946  ***
   947  ## nudgeStartTimeOnAggregation
   948  Enables nudging the start time of metrics  when aggregating to honor MaxDataPoints.
   949  The start time is nudged in such way that timestamps always fall in the same bucket.
   950  This is done by GraphiteWeb, and is useful to avoid jitter in graphs when refreshing the page.
   951  
   952  Default: false
   953  
   954  ### Example
   955  ```yaml
   956  nudgeStartTimeOnAggregation: true
   957  ```
   958  
   959  ***
   960  ## useBucketsHighestTimestampOnAggregation
   961  Enables using the highest timestamp of the buckets when aggregating to honor MaxDataPoints, instead of the lowest timestamp.
   962  This prevents results to appear to predict the future.
   963  
   964  Default: false
   965  
   966  ### Example
   967  ```yaml
   968  useBucketsHighestTimestampOnAggregation: true
   969  ```