Skip to main content

http_server

Serves metrics as JSON object with the service wide HTTP service at the endpoints /stats and /metrics.

# Config fields, showing default values
metrics:
http_server:
prefix: benthos
path_mapping: ""

This metrics type is useful for debugging as it provides a human readable format that you can parse with tools such as jq

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.

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() }

Object Format​

The metrics object takes the form of a hierarchical representation of the dot paths for each metric combined. So, for example, if Benthos exposed two metric counters foo.bar and bar.baz then the resulting object might look like this:

{
"foo": {
"bar": 9
},
"bar": {
"baz": 3
}
}