prometheus.echo
The prometheus.echo component receives Prometheus metrics and writes them to stdout in Prometheus exposition format.
This component is useful for debugging and testing the flow of metrics through a pipeline, allowing you to see exactly what metrics are being received at a particular point in your configuration.
Usage
prometheus.echo "<LABEL>" {
}Arguments
You can use the following arguments with prometheus.echo:
The format argument controls how metrics are encoded when written to stdout:
text- Uses the Prometheus text exposition format (default).openmetrics- Uses the OpenMetrics text format.
Blocks
The prometheus.echo component doesn’t support any blocks. You can configure this component with arguments.
Exported fields
The following fields are exported and can be referenced by other components:
Component health
prometheus.echo is only reported as unhealthy if given an invalid configuration.
In those cases, exported fields retain their last healthy values.
Debug information
prometheus.echo doesn’t expose any component-specific debug information.
Debug metrics
prometheus.echo doesn’t expose any component-specific debug metrics.
Example
This example creates a metrics generation and inspection pipeline:
prometheus.exporter.unix "default" {
}
prometheus.scrape "demo" {
targets = prometheus.exporter.unix.default.targets
forward_to = [prometheus.echo.debug.receiver]
}
prometheus.echo "debug" {
format = "text"
}In this example:
- The
prometheus.exporter.unixcomponent exposes system metrics. - The
prometheus.scrapecomponent scrapes those metrics. - The
prometheus.echocomponent receives the scraped metrics and writes them to stdout in Prometheus text format.
When you run this configuration, you’ll see the metrics being written to stdout, which is useful to:
- Debug metric collection issues
- Verify metric labels and values
- Test metric transformations
- Understand the structure of metrics in your pipeline
Example with OpenMetrics format
prometheus.scrape "demo" {
targets = [
{"__address__" = "localhost:9090"},
]
forward_to = [prometheus.echo.debug.receiver]
}
prometheus.echo "debug" {
format = "openmetrics"
}This example outputs metrics using the OpenMetrics format instead of the traditional Prometheus text format.
Compatible components
prometheus.echo has exports that can be consumed by the following components:
- Components that consume Prometheus
MetricsReceiver
Note
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.