Skip to content

VictoriaMetrics, Thanos, Prometheus

Дар'я Харлан edited this page Sep 16, 2022 · 7 revisions

Source file config

Property Type Description
type String Specify source type: victoria, prometheus, thanos
name String Unique source name - also the config file name
config Object Source configuration

All properties are required

config object properties:

Property Type Required Description
url String yes URL to fetch data from, e.g. http://victoriametrics:8428
username String no username
password String no password
verify_ssl Boolean no whether to verify SSL certificate when connecting via HTTPS, default: true
query_timeout Integer no Query timeout in seconds, 15 by default

Example

[
  {
  "name": "test_victoria",
  "type": "victoria",
  "config": {
    "url": "http://victoriametrics:8428",
    "username": "",
    "password": ""
  }
}
]

Example

[
  {
  "name": "prometheus_server",
  "type": "prometheus",
  "config": {
    "url": "http://prometheus_server:8428",
    "username": "",
    "password": ""
  }
}
]

Pipeline File config

Properties list

Property name in config file Required Value type in config file Description
source yes String Source config name
pipeline_id yes String Unique pipeline identifier (use human-readable name so you could easily use it further)
query yes String Query to export data, query may contain any PromQL selector
aggregated_metric_name no String The name that will be applied to query results that aggregate multiple metrics (for example increase() or rate() functions)
days_to_backfill yes Integer Collect data starting N days ago
interval yes Integer Query data every N seconds
delay no Integer Collect data with a specified delay, e.g. the pipeline will retrieve data until now -(minus) delay, it will not fetch the latest data immediately, unit - minutes
properties no Object with key-value pairs Dimensions with static values to pass to Anodot.
tags no Object with key-value pairs Tags
dimensions no List of dimensions List of dimensions to extract from query results, needed only when using metric 3.0 protocol
values no List of metric names List of metric names to extract from query results, needed only when using metric 3.0 protocol. Note: VictoriaMetrics supports only one metric per query.
units no Object Key-value pairs (value:unit). The value must be from the values column, units can be any.
uses_schema no Boolean Whether the pipeline uses schema or not
transform no Object Object containing either transformation file path or transformation configuration, see transformations page for more details
request_headers no Object Key-value pairs of custom headers to be used in queries
tag_configurations no Object Configure tags with dynamic values. Each value in these configurations is a field. To learn about fields visit the fields wiki page

Examples

Simple:

[{
  "query": "{__name__=~\"go_gc_.*\"}",
  "days_to_backfill": 3,
  "interval": 10,
  "pipeline_id": "victoria_test",
  "source": "victoria_test"
}]

Advanced:

[{
  "query": "{__name__=~\"go_gc_.*\"}",
  "days_to_backfill": 3,
  "interval": 10,
  "pipeline_id": "victoria_test",
  "source": "victoria_test",
  "aggregated_metric_name": "my_metric",
  "delay": 10,
  "properties": { "version": "1.10" },
  "tags": { "env": "prod" },
  "request_headers": { "Host": "victoriametrics-prod1.com" }
}]

Using Protocol 3.0 and Anodot schema

To enable schema for PromQL metric pipelines you need to specify measurements and dimensions in the pipeline config. Note that only specified dimensions will be sent to Anodot, if the metric has other labels they will be ignored

  [{
    "source": "test_victoria",
    "pipeline_id": "test_promql_schema",
    "query": "diff_dims[10000s]",
    "days_to_backfill": 10,
    "interval": 10000,
    "dimensions": [
      "instance",
      "location",
      "job"
    ],
    "values": {
      "diff_dims": "gauge"
    },
    "units": {
      "diff_dims": "unit"
    },
    "tag_configurations": {
      "Tag_name1": {
        "value_path": "property1"
      },
      "Tag_name2": {
        "value_path": "property2"
      }
    }
  }]

If your query has aggregation functions like rate, you need to specify aggregated_metric_name in addition to dimension and values. The new name then has to be specified in the values config

  [{
    "source": "test_victoria",
    "pipeline_id": "test_promql_schema_rate",
    "query": "rate(diff_dims[10000s])",
    "days_to_backfill": 10,
    "interval": 10000,
    "aggregated_metric_name": "counter_rate",
    "dimensions": [
      "instance",
      "location",
      "job"
    ],
    "values": {
      "counter_rate": "gauge"
    },
    "units": {
      "counter_rate": "unit"
    }
  }]
Clone this wiki locally