Prometheus Exporter

Output metric events to a Prometheus exporter running on the host

status: stable delivery: best effort acknowledgements: yes egress: expose state: stateful previously known as: prometheus

Alias

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

[sinks.my_prometheus_exporter_sink]
+type = "prometheus_exporter"
-type = "prometheus"

Warnings

High cardinality metric names and labels are discouraged by Prometheus as they can provide performance and reliability problems. You should consider alternative strategies to reduce the cardinality. Vector offers a tag_cardinality_limit transform as a way to protect against this.

Configuration

Example configurations

{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ]
    }
  }
}
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "address": "0.0.0.0:9598",
      "flush_period_secs": 60
    }
  }
}
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
address = "0.0.0.0:9598"
flush_period_secs = 60
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
    address: 0.0.0.0:9598
    flush_period_secs: 60

acknowledgements

optional object

Controls how acknowledgements are handled for this sink.

See End-to-end Acknowledgements for more information on how event acknowledgement is handled.

Whether or not end-to-end acknowledgements are enabled.

When enabled for a sink, any source connected to that sink, where the source supports end-to-end acknowledgements as well, waits for events to be acknowledged by all connected sinks before acknowledging them at the source.

Enabling or disabling acknowledgements at the sink level takes precedence over any global acknowledgements configuration.

address

optional string literal

The address to expose for scraping.

The metrics are exposed at the typical Prometheus exporter path, /metrics.

Examples
"192.160.0.10:9598"
default: 0.0.0.0:9598

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"

buckets

optional [float]
Default buckets to use for aggregating distribution metrics into histograms.
Array float
default: [0.005 0.01 0.025 0.05 0.1 0.25 0.5 1 2.5 5 10]

buffer

optional object

Configures the buffering behavior for this sink.

More information about the individual buffer types, and buffer behavior, can be found in the Buffering Model section.

buffer.max_events

optional uint
The maximum number of events allowed in the buffer.
Relevant when: type = "memory"
default: 500

buffer.max_size

required uint

The maximum size of the buffer on disk.

Must be at least ~256 megabytes (268435488 bytes).

Relevant when: type = "disk"

buffer.type

optional string literal enum
The type of buffer to use.
Enum options
OptionDescription
disk

Events are buffered on disk.

This is less performant, but more durable. Data that has been synchronized to disk will not be lost if Vector is restarted forcefully or crashes.

Data is synchronized to disk every 500ms.

memory

Events are buffered in memory.

This is more performant, but less durable. Data will be lost if Vector is restarted forcefully or crashes.

default: memory

buffer.when_full

optional string literal enum
Event handling behavior when a buffer is full.
Enum options
OptionDescription
block

Wait for free space in the buffer.

This applies backpressure up the topology, signalling that sources should slow down the acceptance/consumption of events. This means that while no data is lost, data will pile up at the edge.

drop_newest

Drops the event instead of waiting for free space in buffer.

The event will be intentionally dropped. This mode is typically used when performance is the highest priority, and it is preferable to temporarily lose events rather than cause a slowdown in the acceptance/consumption of events.

default: block

default_namespace

optional string literal

The default namespace for any metrics sent.

This namespace is only used if a metric has no existing namespace. When a namespace is present, it is used as a prefix to the metric name, and separated with an underscore (_).

It should follow the Prometheus naming conventions.

distributions_as_summaries

optional bool

Whether or not to render distributions as an aggregated histogram or aggregated summary.

While distributions as a lossless way to represent a set of samples for a metric is supported, Prometheus clients (the application being scraped, which is this sink) must aggregate locally into either an aggregated histogram or aggregated summary.

default: false

flush_period_secs

optional uint

The interval, in seconds, on which metrics are flushed.

On the flush interval, if a metric has not been seen since the last flush interval, it is considered expired and is removed.

Be sure to configure this value higher than your client’s scrape interval.

default: 60 (seconds)

healthcheck

optional object
Healthcheck configuration.

healthcheck.enabled

optional bool
Whether or not to check the health of the sink when Vector starts up.
default: true

inputs

required [string]

A list of upstream source or transform IDs.

Wildcards (*) are supported.

See configuration for more info.

Array string literal
Examples
[
  "my-source-or-transform-id",
  "prefix-*"
]

quantiles

optional [float]
Quantiles to use for aggregating distribution metrics into a summary.
Array float
default: [0.5 0.75 0.9 0.95 0.99]

suppress_timestamp

optional bool

Suppresses timestamps on the Prometheus output.

This can sometimes be useful when the source of metrics leads to their timestamps being too far in the past for Prometheus to allow them, such as when aggregating metrics over long time periods, or when replaying old metrics from a disk buffer.

default: false

tls

optional object
Configures the TLS options for incoming/outgoing connections.

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.enabled

optional bool

Whether or not to require TLS for incoming or outgoing connections.

When enabled and used for incoming connections, an identity certificate is also required. See tls.crt_file for more information.

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"

tls.server_name

optional string literal

Server name to use when using Server Name Indication (SNI).

Only relevant for outgoing connections.

Examples
"www.example.com"

Enables certificate verification. For components that create a server, this requires that the client connections have a valid client certificate. For components that initiate requests, this validates that the upstream has a valid certificate.

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.

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.

Telemetry

Metrics

link

buffer_byte_size

gauge
The number of bytes current in the buffer.
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.

buffer_discarded_events_total

counter
The number of events dropped by this non-blocking buffer.
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.

buffer_events

gauge
The number of events currently in the buffer.
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.

buffer_received_event_bytes_total

counter
The number of bytes received by this buffer.
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.

buffer_received_events_total

counter
The number of events received by this buffer.
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.

buffer_sent_event_bytes_total

counter
The number of bytes sent by this buffer.
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.

buffer_sent_events_total

counter
The number of events sent by this buffer.
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.

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_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_bytes_total

counter
The number of raw bytes sent by this component to destination sinks.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
endpoint optional
The endpoint to which the bytes were sent. For HTTP, this will be the host and path only, excluding the query string.
file optional
The absolute path of the destination file.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
protocol
The protocol used to send the bytes.
region optional
The AWS region name to which the bytes were sent. In some configurations, this may be a literal hostname.

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_server_handler_duration_seconds

histogram
The duration spent handling a HTTP request.
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.
method optional
The HTTP method of the request.
path
The path that produced the error.
pid optional
The process ID of the Vector instance.
status optional
The HTTP status code of the request.

http_server_requests_received_total

counter
The total number of HTTP requests received.
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.
method optional
The HTTP method of the request.
path
The path that produced the error.
pid optional
The process ID of the Vector instance.

http_server_responses_sent_total

counter
The total number of HTTP responses sent.
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.
method optional
The HTTP method of the request.
path
The path that produced the error.
pid optional
The process ID of the Vector instance.
status optional
The HTTP status code of the request.

utilization

gauge
A ratio from 0 to 1 of the load on a component. A value of 0 would indicate a completely idle component that is simply waiting for input. A value of 1 would indicate a that is never idle. This value is updated every 5 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.

Examples

Counter

Given this event...
{
  "metric": {
    "counter": {
      "value": 1.5
    },
    "kind": "incremental",
    "name": "logins",
    "tags": {
      "host": "my-host.local"
    }
  }
}
...and this configuration...
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
    default_namespace: service
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
default_namespace = "service"
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "default_namespace": "service"
    }
  }
}
...this Vector event is produced:
# HELP service_logins logins
# TYPE service_logins counter
service_logins{host="my-host.local"} 1.5

Gauge

Given this event...
{
  "metric": {
    "gauge": {
      "value": 1.5
    },
    "kind": "absolute",
    "name": "memory_rss",
    "namespace": "app",
    "tags": {
      "host": "my-host.local"
    }
  }
}
...and this configuration...
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ]
    }
  }
}
...this Vector event is produced:
# HELP app_memory_rss memory_rss
# TYPE app_memory_rss gauge
app_memory_rss{host="my-host.local"} 1.5

Histogram

Given this event...
{
  "metric": {
    "histogram": {
      "buckets": [
        {
          "count": 0,
          "upper_limit": 0.005
        },
        {
          "count": 1,
          "upper_limit": 0.01
        },
        {
          "count": 0,
          "upper_limit": 0.025
        },
        {
          "count": 1,
          "upper_limit": 0.05
        },
        {
          "count": 0,
          "upper_limit": 0.1
        },
        {
          "count": 0,
          "upper_limit": 0.25
        },
        {
          "count": 0,
          "upper_limit": 0.5
        },
        {
          "count": 0,
          "upper_limit": 1
        },
        {
          "count": 0,
          "upper_limit": 2.5
        },
        {
          "count": 0,
          "upper_limit": 5
        },
        {
          "count": 0,
          "upper_limit": 10
        }
      ],
      "count": 2,
      "sum": 0.789
    },
    "kind": "absolute",
    "name": "response_time_s",
    "tags": {}
  }
}
...and this configuration...
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ]
    }
  }
}
...this Vector event is produced:
# HELP response_time_s response_time_s
# TYPE response_time_s histogram
response_time_s_bucket{le="0.005"} 0
response_time_s_bucket{le="0.01"} 1
response_time_s_bucket{le="0.025"} 0
response_time_s_bucket{le="0.05"} 1
response_time_s_bucket{le="0.1"} 0
response_time_s_bucket{le="0.25"} 0
response_time_s_bucket{le="0.5"} 0
response_time_s_bucket{le="1.0"} 0
response_time_s_bucket{le="2.5"} 0
response_time_s_bucket{le="5.0"} 0
response_time_s_bucket{le="10.0"} 0
response_time_s_bucket{le="+Inf"} 0
response_time_s_sum 0.789
response_time_s_count 2

Distribution to histogram

Given this event...
{
  "metric": {
    "distribution": {
      "samples": [
        {
          "rate": 4,
          "value": 0
        },
        {
          "rate": 2,
          "value": 1
        },
        {
          "rate": 1,
          "value": 4
        }
      ],
      "statistic": "histogram"
    },
    "kind": "incremental",
    "name": "request_retries",
    "tags": {
      "host": "my-host.local"
    }
  }
}
...and this configuration...
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
    buckets:
      - 0
      - 1
      - 3
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
buckets = [ 0, 1, 3 ]
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "buckets": [
        0,
        1,
        3
      ]
    }
  }
}
...this Vector event is produced:
# HELP request_retries request_retries
# TYPE request_retries histogram
request_retries_bucket{host="my-host.local",le="0"} 4
request_retries_bucket{host="my-host.local",le="1"} 6
request_retries_bucket{host="my-host.local",le="3"} 6
request_retries_bucket{host="my-host.local",le="+Inf"} 7
request_retries_sum{host="my-host.local"} 6
request_retries_count{host="my-host.local"} 7

Distribution to summary

Given this event...
{
  "metric": {
    "distribution": {
      "samples": [
        {
          "rate": 3,
          "value": 0
        },
        {
          "rate": 2,
          "value": 1
        },
        {
          "rate": 1,
          "value": 4
        }
      ],
      "statistic": "summary"
    },
    "kind": "incremental",
    "name": "request_retries",
    "tags": {}
  }
}
...and this configuration...
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
    quantiles:
      - 0.5
      - 0.75
      - 0.95
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
quantiles = [ 0.5, 0.75, 0.95 ]
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "quantiles": [
        0.5,
        0.75,
        0.95
      ]
    }
  }
}
...this Vector event is produced:
# HELP request_retries request_retries
# TYPE request_retries summary
request_retries{quantile="0.5"} 0
request_retries{quantile="0.75"} 1
request_retries{quantile="0.95"} 4
request_retries_sum 6
request_retries_count 6
request_retries_min 0
request_retries_max 4
request_retries_avg 1

Summary

Given this event...
{
  "metric": {
    "kind": "absolute",
    "name": "requests",
    "summary": {
      "count": 6,
      "quantiles": [
        {
          "upper_limit": 0.01,
          "value": 1.5
        },
        {
          "upper_limit": 0.5,
          "value": 2
        },
        {
          "upper_limit": 0.99,
          "value": 3
        }
      ],
      "sum": 12
    },
    "tags": {
      "host": "my-host.local"
    }
  }
}
...and this configuration...
sinks:
  my_sink_id:
    type: prometheus_exporter
    inputs:
      - my-source-or-transform-id
[sinks.my_sink_id]
type = "prometheus_exporter"
inputs = [ "my-source-or-transform-id" ]
{
  "sinks": {
    "my_sink_id": {
      "type": "prometheus_exporter",
      "inputs": [
        "my-source-or-transform-id"
      ]
    }
  }
}
...this Vector event is produced:
# HELP requests requests
# TYPE requests summary
requests{host="my-host.local",quantile="0.01"} 1.5
requests{host="my-host.local",quantile="0.5"} 2
requests{host="my-host.local",quantile="0.99"} 3
requests_sum{host="my-host.local"} 12
requests_count{host="my-host.local"} 6

How it works

Buffers

This component buffers events as shown in the diagram above. This helps to smooth out data processing if the downstream service applies backpressure. Buffers are controlled via the buffer.* options.

Duplicate tag names

Multiple tags with the same name are invalid within Prometheus and Prometheus will reject a metric with duplicate tag names. When sending a tag with multiple values for each name, Vector will only send the last value specified.

Histogram Buckets

Choosing the appropriate buckets for Prometheus histograms is a complicated point of discussion. The Histograms and Summaries Prometheus guide provides a good overview of histograms, buckets, summaries, and how you should think about configuring them. The buckets you choose should align with your known range and distribution of values as well as how you plan to report on them. The aforementioned guide provides examples on how you should align them.

Default Buckets

The buckets option defines the global default buckets for histograms. These defaults are tailored to broadly measure the response time (in seconds) of a network service. Most likely, however, you will be required to define buckets customized to your use case.

Memory Usage

Like other Prometheus instances, the prometheus_exporter sink aggregates metrics in memory which keeps the memory footprint to a minimum if Prometheus fails to scrape the Vector instance over an extended period of time. The downside is that data will be lost if Vector is restarted. This is by design of Prometheus’ pull model approach, but is worth noting if restart Vector frequently.

State

This component is stateful, meaning its behavior changes based on previous inputs (events). State is not preserved across restarts, therefore state-dependent behavior will reset between restarts and depend on the inputs (events) received since the most recent restart.