Skip to main content

prometheus

Host endpoints (/metrics and /stats) for Prometheus scraping.

# Common config fields, showing default values
metrics:
prometheus:
prefix: benthos
path_mapping: ""

Metrics paths will differ from the standard list in order to comply with Prometheus naming restrictions, where dots are replaced with underscores (and underscores replaced with double underscores). This change is made before the mapping from path_mapping is applied.

Fields​

prefix​

A string prefix to add to all metrics.

Type: string
Default: "benthos"

path_mapping​

An optional Bloblang mapping that allows you to rename or prevent certain metrics paths from being exported. When metric paths are created, renamed and dropped a trace log is written, enabling TRACE level logging is therefore a good way to diagnose path mappings. BETA FEATURE: Labels can also be created for the metric path by mapping meta fields.

Type: string
Default: ""

# Examples
path_mapping: this.replace("input", "source").replace("output", "sink")
path_mapping: |-
if ![
"benthos_input_received",
"benthos_input_latency",
"benthos_output_sent"
].contains(this) { deleted() }
path_mapping: |-
let matches = this.re_find_all_submatch("resource_processor_([a-zA-Z]+)_(.*)")
meta processor = $matches.0.1 | deleted()
root = $matches.0.2 | deleted()

use_histogram_timing​

Whether to export timing metrics as a histogram, if false a summary is used instead. For more information on histograms and summaries refer to: https://prometheus.io/docs/practices/histograms/.

Type: bool
Default: false
Requires version 3.63.0 or newer

histogram_buckets​

Timing metrics histogram buckets (in seconds). If left empty defaults to DefBuckets (https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#pkg-variables)

Type: array
Default: []
Requires version 3.63.0 or newer

push_url​

An optional Push Gateway URL to push metrics to.

Type: string
Default: ""

push_interval​

The period of time between each push when sending metrics to a Push Gateway.

Type: string
Default: ""

push_job_name​

An identifier for push jobs.

Type: string
Default: "benthos_push"

push_basic_auth​

The Basic Authentication credentials.

Type: object

push_basic_auth.username​

The Basic Authentication username.

Type: string
Default: ""

push_basic_auth.password​

The Basic Authentication password.

Type: string
Default: ""

Push Gateway​

The field push_url is optional and when set will trigger a push of metrics to a Prometheus Push Gateway once Benthos shuts down. It is also possible to specify a push_interval which results in periodic pushes.

The Push Gateway is useful for when Benthos instances are short lived. Do not include the "/metrics/jobs/..." path in the push URL.

If the Push Gateway requires HTTP Basic Authentication it can be configured with push_basic_auth.