Prometheus scrape

Collect metrics via the Prometheus client

status: beta role: daemon role: sidecar delivery: at-least-once egress: batch state: stateless output: metrics previously known as: prometheus

Alias

This component was previously called the prometheus source. Make sure to update your Vector configuration to accommodate the name change:

[sources.my_prometheus_scrape_source]
+type = "prometheus_scrape"
-type = "prometheus"

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "prometheus_scrape",
      "endpoints": [
        "http://localhost:9090/metrics"
      ],
      "scrape_interval_secs": 15,
      "instance_tag": "instance",
      "endpoint_tag": "endpoint",
      "honor_labels": null
    }
  }
}
[sources.my_source_id]
type = "prometheus_scrape"
endpoints = [ "http://localhost:9090/metrics" ]
scrape_interval_secs = 15
instance_tag = "instance"
endpoint_tag = "endpoint"
---
sources:
  my_source_id:
    type: prometheus_scrape
    endpoints:
      - http://localhost:9090/metrics
    scrape_interval_secs: 15
    instance_tag: instance
    endpoint_tag: endpoint
    honor_labels: null
{
  "sources": {
    "my_source_id": {
      "type": "prometheus_scrape",
      "endpoints": [
        "http://localhost:9090/metrics"
      ],
      "scrape_interval_secs": 15,
      "instance_tag": "instance",
      "endpoint_tag": "endpoint",
      "honor_labels": null
    }
  }
}
[sources.my_source_id]
type = "prometheus_scrape"
endpoints = [ "http://localhost:9090/metrics" ]
scrape_interval_secs = 15
instance_tag = "instance"
endpoint_tag = "endpoint"
---
sources:
  my_source_id:
    type: prometheus_scrape
    endpoints:
      - http://localhost:9090/metrics
    scrape_interval_secs: 15
    instance_tag: instance
    endpoint_tag: endpoint
    honor_labels: null
    proxy: null
    tls: null
    auth: null

auth

optional object
Configures the authentication strategy.

auth.password

optional string literal
The basic authentication password.
Examples
"${PROMETHEUS_PASSWORD}"
"password"

auth.strategy

optional string literal enum
The authentication strategy to use.
Enum options
OptionDescription
basicThe basic authentication strategy.
bearerThe bearer token authentication strategy.
Examples
"basic"
"bearer"

auth.token

optional string literal
The token to use for bearer authentication
Examples
"${API_TOKEN}"
"xyz123"

auth.user

optional string literal
The basic authentication user name.
Examples
"${PROMETHEUS_USERNAME}"
"username"

endpoint_tag

common optional string literal
The tag name added to each event representing the scraped instance’s endpoint.
Examples
"endpoint"

endpoints

required [string]
Endpoints to scrape metrics from.

Warning

You must explicitly add the path to your endpoints. Vector will not automatically add /metics.
Array string literal
Examples
[
  "http://localhost:9090/metrics"
]

honor_labels

common optional bool
Controls how tag conflicts are handled if the scraped source has tags that Vector would add. If true, Vector will not add the new tag if the scraped metric has the tag already. If false, Vector will rename the conflicting tag by adding exported_ to it. This matches Prometheus’s honor_labels configuration.
default: false

instance_tag

common optional string literal
The tag name added to each event representing the scraped instance’s host:port.
Examples
"instance"

proxy

optional object
Configures an HTTP(S) proxy for Vector to use. By default, the globally configured proxy is used.

proxy.enabled

optional bool
If false the proxy will be disabled.
default: true

proxy.http

optional string literal
The URL to proxy HTTP requests through.
Examples
"http://foo.bar:3128"

proxy.https

optional string literal
The URL to proxy HTTPS requests through.
Examples
"http://foo.bar:3128"

proxy.no_proxy

optional [string]

A list of hosts to avoid proxying. Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.com matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

scrape_interval_secs

common optional uint
The interval between scrapes, in seconds.
default: 15 (seconds)

tls

optional object
Configures the TLS options for incoming connections.

tls.ca_file

optional string literal
Absolute path to an additional CA certificate file, in DER or PEM format (X.509), or an inline CA certificate in PEM format.
Examples
"/path/to/certificate_authority.crt"

tls.crt_file

optional string literal
Absolute path to a certificate file used to identify this connection, in DER or PEM format (X.509) or PKCS#12, or an inline certificate in PEM format. If this is set and is not a PKCS#12 archive, key_file must also be set.
Examples
"/path/to/host_certificate.crt"

tls.key_file

optional string literal
Absolute path to a private key file used to identify this connection, in DER or PEM format (PKCS#8), or an inline private key in PEM format. If this is set, crt_file must also be set.
Examples
"/path/to/host_certificate.key"

tls.key_pass

optional string literal
Pass phrase used to unlock the encrypted key file. This has no effect unless key_file is set.
Examples
"${KEY_PASS_ENV_VAR}"
"PassWord1"

tls.verify_hostname

optional bool
If true (the default), Vector will validate the configured remote host name against the remote host’s TLS certificate. Do NOT set this to false unless you understand the risks of not verifying the remote hostname.
default: true

Environment variables

HTTPS_PROXY

common optional string literal

The global URL to proxy HTTPS requests through.

If another HTTPS proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

HTTP_PROXY

common optional string literal

The global URL to proxy HTTP requests through.

If another HTTP proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

NO_PROXY

common optional string literal

List of hosts to avoid proxying globally.

Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.come matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

If another no_proxy value is set in the configuration file or at a component level, this one is overridden.

The lowercase variant has priority over the uppercase one.

Examples
localhost,.example.com,192.168.0.0./16
*

http_proxy

common optional string literal

The global URL to proxy HTTP requests through.

If another HTTP proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

https_proxy

common optional string literal

The global URL to proxy HTTPS requests through.

If another HTTPS proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

no_proxy

common optional string literal

List of hosts to avoid proxying globally.

Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.come matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

If another no_proxy value is set in the configuration file or at a component level, this one is overridden.

The lowercase variant has priority over the uppercase one.

Examples
localhost,.example.com,192.168.0.0./16
*

Output

Metrics

counter

counter
A single value that can be incremented or reset to a zero value but not decremented.
* optional
Any tags present on the metric.
endpoint optional
Any endpoint of the scraped instance. Only present if endpoint_tag is set.
instance optional
The host:port of the scraped instance. Only present if instance_tag is set.

gauge

gauge
A gauge represents a point-in-time value that can increase and decrease. Vector’s internal gauge type represents changes to that value. Gauges should be used to track fluctuations in values, like current memory or CPU usage.
* optional
Any tags present on the metric.
endpoint optional
Any endpoint of the scraped instance. Only present if endpoint_tag is set.
instance optional
The host:port of the scraped instance. Only present if instance_tag is set.

histogram

gauge
Also called a timer. A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets. It also provides a sum of all observed values.
* optional
Any tags present on the metric.
endpoint optional
Any endpoint of the scraped instance. Only present if endpoint_tag is set.
instance optional
The host:port of the scraped instance. Only present if instance_tag is set.

summary

gauge
Similar to a histogram, a summary samples observations (usually things like request durations and response sizes). While it also provides a total count of observations and a sum of all observed values, it calculates configurable quantiles over a sliding time window.
* optional
Any tags present on the metric.
endpoint optional
Any endpoint of the scraped instance. Only present if endpoint_tag is set.
instance optional
The host:port of the scraped instance. Only present if instance_tag is set.

Telemetry

Metrics

link

component_received_events_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

events_in_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins. This metric is deprecated and will be removed in a future version. Use component_received_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

events_out_total

counter
The total number of events emitted by this component. This metric is deprecated and will be removed in a future version. Use component_sent_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

http_error_response_total

counter
The total number of HTTP error responses for this component.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

http_request_errors_total

counter
The total number of HTTP request errors for this component.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

parse_errors_total

counter
The total number of errors parsing metrics for this component.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

processed_bytes_total

counter
The number of bytes processed by the component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the bytes originate.
file optional
The file from which the bytes originate.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the bytes originate.
peer_path optional
The pathname from which the bytes originate.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the bytes originate.
uri optional
The sanitized URI from which the bytes originate.

processed_events_total

counter
The total number of events processed by this component. This metric is deprecated in place of using component_received_events_total and component_sent_events_total metrics.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

request_duration_seconds

histogram
The total request duration in seconds.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

requests_completed_total

counter
The total number of requests completed by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

How it works

Context

By default, the prometheus_scrape source augments events with helpful context keys.

State

This component is stateless, meaning its behavior is consistent across each input.

Transport Layer Security (TLS)

Vector uses OpenSSL for TLS protocols. You can adjust TLS behavior via the tls.* options.