---
title: "prometheus.echo | Grafana Alloy documentation"
description: "Learn about prometheus.echo"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# `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. You can place `prometheus.echo` at any stage in your pipeline to inspect the metrics passing through it.

You can specify multiple `prometheus.echo` components by giving them different labels.

## Usage

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
prometheus.echo "<LABEL>" {
}
```

## Arguments

You can use the following arguments with `prometheus.echo`:

Expand table

| Name     | Type     | Description                                                     | Default | Required |
|----------|----------|-----------------------------------------------------------------|---------|----------|
| `format` | `string` | The output format for metrics. Must be `text` or `openmetrics`. | `text`  | no       |

The `format` argument controls how the component encodes metrics when written to `stdout`:

- `text` - Uses the Prometheus text exposition format. This is the 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:

Expand table

| Name       | Type              | Description                                               |
|------------|-------------------|-----------------------------------------------------------|
| `receiver` | `MetricsReceiver` | A value that other components can use to send metrics to. |

## 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:

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
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:

1. The `prometheus.exporter.unix` component exposes system metrics.
2. The `prometheus.scrape` component scrapes those metrics.
3. The `prometheus.echo` component receives the scraped metrics and writes them to `stdout` in Prometheus text format.

When you run this configuration, the component writes metrics 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

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
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`](../../../compatibility/#prometheus-metricsreceiver-consumers)

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