Prometheus Source

The Vector prometheus source ingests data through the Prometheus text exposition format and outputs metric events.

Configuration

vector.toml
[sources.my_source_id]
type = "prometheus" # must be: "prometheus"
hosts = ["http://localhost:9090"] # example
scrape_interval_secs = 1 # example

Options

2 items
common[string]required

hosts

Host addresses to scrape metrics from.

No default
View examples
commonintrequired

scrape_interval_secs

The interval between scrapes in seconds.

No default
View examples

Output

The prometheus source ingests data through the Prometheus text exposition format and outputs metric events. For example:

  • Counter
  • Gauge

Given the following input:

# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 100

A metric event will be output with the following structure:

{
"name": "promhttp_metric_handler_requests_total",
"kind": "absolute",
"timestamp": "2019-05-02T12:22:46.658503Z" // current time / time ingested
"tags": {
"code": "200"
},
"value": {
"type": "counter",
"value": 100.0
}
}

How It Works

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.