APT and RPM repositories at repositories.timber.io will be decommissioned on February 28th Migration instructions

Prometheus scrape

Collect metrics via the Prometheus client

status: stable role: daemon role: sidecar delivery: at-least-once acknowledgements: no 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"
      ]
    }
  }
}
[sources.my_source_id]
type = "prometheus_scrape"
endpoints = [ "http://localhost:9090/metrics" ]
sources:
  my_source_id:
    type: prometheus_scrape
    endpoints:
      - http://localhost:9090/metrics
{
  "sources": {
    "my_source_id": {
      "type": "prometheus_scrape",
      "endpoints": [
        "http://localhost:9090/metrics"
      ],
      "query": {
        "match[]": [
          "{job=\"somejob\"}",
          "{__name__=~\"job:.*\"}"
        ]
      },
      "scrape_interval_secs": 15,
      "scrape_timeout_secs": 5
    }
  }
}
[sources.my_source_id]
type = "prometheus_scrape"
endpoints = [ "http://localhost:9090/metrics" ]
scrape_interval_secs = 15
scrape_timeout_secs = 5

  [sources.my_source_id.query]
  "match[]" = [ "{job=\"somejob\"}", "{__name__=~\"job:.*\"}" ]
sources:
  my_source_id:
    type: prometheus_scrape
    endpoints:
      - http://localhost:9090/metrics
    query:
      "match[]":
        - '{job="somejob"}'
        - '{__name__=~"job:.*"}'
    scrape_interval_secs: 15
    scrape_timeout_secs: 5

auth

optional object

Configuration of the authentication strategy for HTTP requests.

HTTP authentication should be used with HTTPS only, as the authentication credentials are passed as an HTTP header without any additional encryption beyond what is provided by the transport itself.

auth.password

required string literal
The basic authentication password.
Relevant when: strategy = "basic"
Examples
"${PASSWORD}"
"password"

auth.strategy

required string literal enum
The authentication strategy to use.
Enum options
OptionDescription
basic

Basic authentication.

The username and password are concatenated and encoded via base64.

bearer

Bearer authentication.

The bearer token value (OAuth2, JWT, etc.) is passed as-is.

Examples
"basic"
"bearer"

auth.token

required string literal
The bearer authentication token.
Relevant when: strategy = "bearer"

auth.user

required string literal
The basic authentication username.
Relevant when: strategy = "basic"
Examples
"${USERNAME}"
"username"

endpoint_tag

optional string literal

The tag name added to each event representing the scraped instance’s endpoint.

The tag value is the endpoint of the scraped instance.

endpoints

required [string]
Endpoints to scrape metrics from.

Warning

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

honor_labels

optional bool

Controls how tag conflicts are handled if the scraped source has tags to be added.

If true, the new tag is not added if the scraped metric has the tag already. If false, the conflicting tag is renamed by prepending exported_ to the original name.

This matches Prometheus’ honor_labels configuration.

default: false

instance_tag

optional string literal

The tag name added to each event representing the scraped instance’s host:port.

The tag value is the host and port of the scraped instance.

proxy

optional object

Proxy configuration.

Configure to proxy traffic through an HTTP(S) proxy when making external requests.

Similar to common proxy configuration convention, you can set different proxies to use based on the type of traffic being proxied, as well as set specific hosts that should not be proxied.

proxy.enabled

optional bool
Enables proxying support.
default: true

proxy.http

optional string literal

Proxy endpoint to use when proxying HTTP traffic.

Must be a valid URI string.

Examples
"http://foo.bar:3128"

proxy.https

optional string literal

Proxy endpoint to use when proxying HTTPS traffic.

Must be a valid URI string.

Examples
"http://foo.bar:3128"

proxy.no_proxy

optional [string]

A list of hosts to avoid proxying.

Multiple patterns are allowed:

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

query

optional object

Custom parameters for the scrape request query string.

One or more values for the same parameter key can be provided. The parameters provided in this option are appended to any parameters manually provided in the endpoints option. This option is especially useful when scraping the /federate endpoint.

query.*

required [string]
A query string parameter.

scrape_interval_secs

optional uint
The interval between scrapes. Requests are run concurrently so if a scrape takes longer than the interval a new scrape will be started. This can take extra resources, set the timeout to a value lower than the scrape interval to prevent this from happening.
default: 15 (seconds)

scrape_timeout_secs

optional float
The timeout for each scrape request.
default: 5 (seconds)

tls

optional object
TLS configuration.

tls.alpn_protocols

optional [string]

Sets the list of supported ALPN protocols.

Declare the supported ALPN protocols, which are used during negotiation with peer. They are prioritized in the order that they are defined.

tls.ca_file

optional string literal

Absolute path to an additional CA certificate file.

The certificate must be in the DER or PEM (X.509) format. Additionally, the certificate can be provided as an inline string 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 server.

The certificate must be in DER, PEM (X.509), or PKCS#12 format. Additionally, the certificate can be provided as an inline string 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 server.

The key must be in DER or PEM (PKCS#8) format. Additionally, the key can be provided as an inline string in PEM format.

Examples
"/path/to/host_certificate.key"

tls.key_pass

optional string literal

Passphrase used to unlock the encrypted key file.

This has no effect unless key_file is set.

Examples
"${KEY_PASS_ENV_VAR}"
"PassWord1"

Enables certificate verification.

If enabled, certificates must not be expired and must be issued by a trusted issuer. This verification operates in a hierarchical manner, checking that the leaf certificate (the certificate presented by the client/server) is not only valid, but that the issuer of that certificate is also valid, and so on until the verification process reaches a root certificate.

Relevant for both incoming and outgoing connections.

Do NOT set this to false unless you understand the risks of not verifying the validity of certificates.

tls.verify_hostname

optional bool

Enables hostname verification.

If enabled, the hostname used to connect to the remote host must be present in the TLS certificate presented by the remote host, either as the Common Name or as an entry in the Subject Alternative Name extension.

Only relevant for outgoing connections.

Do NOT set this to false unless you understand the risks of not verifying the remote hostname.

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
*

Outputs

<component_id>

Default output stream of the component. Use this component’s ID as an input to downstream transforms and sinks.

Output Data

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_discarded_events_total

counter
The number of events dropped by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
intentional
True if the events were discarded intentionally, like a filter transform, or false if due to an error.
pid optional
The process ID of the Vector instance.

component_errors_total

counter
The total number of errors encountered by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
error_type
The type of the error
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
stage
The stage within the component at which the error occurred.

component_received_bytes_total

counter
The number of raw bytes accepted by this component from source origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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_received_event_bytes_total

counter
The number of event bytes accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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_received_events_count

histogram

A histogram of the number of events passed in each internal batch in Vector’s internal topology.

Note that this is separate than sink-level batching. It is mostly useful for low level debugging performance issues in Vector due to small internal batches.

component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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_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
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

http_client_response_rtt_seconds

histogram
The round-trip time (RTT) of HTTP requests, tagged with the response code.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
status optional
The HTTP status code of the request.

http_client_responses_total

counter
The total number of HTTP requests, tagged with the response code.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
status optional
The HTTP status code of the request.

source_lag_time_seconds

histogram
The difference between the timestamp recorded in each event and the time when it was ingested, expressed as fractional seconds.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

How it works

Context

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

Duplicate tag names

Multiple tags with the same name are invalid within Prometheus. Prometheus itself will reject a metric with duplicate tags. Vector will accept the metric, but will only take the last value for each tag name specified.

State

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

Transport Layer Security (TLS)

Vector uses OpenSSL for TLS protocols due to OpenSSL’s maturity. You can enable and adjust TLS behavior via the tls.* options and/or via an OpenSSL configuration file. The file location defaults to /usr/local/ssl/openssl.cnf or can be specified with the OPENSSL_CONF environment variable.