-
Notifications
You must be signed in to change notification settings - Fork 593
feat: Add prometheus.echo component for local metrics inspection
#4105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6d9a4fc
add echo
iamrajiv f2347b7
add test
iamrajiv a253d8e
add changelog
iamrajiv 1e44b4e
use prometheus expfmt encoder
iamrajiv df366c9
add doc
iamrajiv ad2d3a7
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv 1622764
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv 9d0b21e
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv 9a983e7
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv db423cb
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv 5e42d55
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv a3d0388
Update docs/sources/reference/components/prometheus/prometheus.echo.md
iamrajiv f1b5fed
Fix build issues
dehaansa 53d52d3
Appease linter and regenerate things
dehaansa 42a04f4
update to go v1.25.5 (#5027)
kalleep f86c8b2
Introduce Shared YAML Dependency File To Manage Replace Directives (#…
blewis12 e9ab344
fix: add StoreBuilder to mimir.alerts.kubernetes eventProcessor (#5010)
synthe102 e1f5704
Add changelog for PR 5002 (#5042)
dehaansa 390d445
Fix missing release note for v1.12 (#5043)
thampiotr bd52fba
remove labelstore from prometheus interceptor (#4890)
kgeckhart c6b36d0
Fix handling of multiplexed long lines in Docker logs (#4713)
axd1x8a c38d836
update changelog
dehaansa c48fc0d
add cloud-provider labels to target metrics (#4942)
matthewnolf 3941a47
stop storage and wal after test (#5056)
kalleep 21d3b2b
Merge branch 'main' into ins
dehaansa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
docs/sources/reference/components/prometheus/prometheus.echo.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| --- | ||
| canonical: https://grafana.com/docs/alloy/latest/reference/components/prometheus/prometheus.echo/ | ||
| description: Learn about prometheus.echo | ||
| labels: | ||
| stage: general-availability | ||
| products: | ||
| - oss | ||
| title: prometheus.echo | ||
| --- | ||
|
|
||
| # `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 | ||
|
|
||
| ```alloy | ||
| prometheus.echo "<LABEL>" { | ||
| } | ||
| ``` | ||
|
|
||
| ## Arguments | ||
|
|
||
| You can use the following arguments with `prometheus.echo`: | ||
|
|
||
| | Name | Type | Description | Default | Required | | ||
| | -------- | -------- | --------------------------------------------------------------- | ------- | -------- | | ||
| | `format` | `string` | The output format for metrics. Must be `text` or `openmetrics`. | `text` | no | | ||
|
|
||
| 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: | ||
|
|
||
| | 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 | ||
| 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. | ||
| 1. The `prometheus.scrape` component scrapes those metrics. | ||
| 1. The `prometheus.echo` component 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 | ||
|
|
||
| ```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. | ||
|
|
||
| <!-- START GENERATED COMPATIBLE COMPONENTS --> | ||
|
|
||
| ## Compatible components | ||
|
|
||
| `prometheus.echo` has exports that can be consumed by the following components: | ||
|
|
||
| - Components that consume [Prometheus `MetricsReceiver`](../../../compatibility/#prometheus-metricsreceiver-consumers) | ||
|
|
||
| {{< admonition type="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. | ||
| {{< /admonition >}} | ||
|
|
||
| <!-- END GENERATED COMPATIBLE COMPONENTS --> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.