From 8000528ebde8752c14efc4369a9540219e4d4014 Mon Sep 17 00:00:00 2001 From: Meysam Date: Sat, 5 Sep 2026 13:48:26 +0700 Subject: [PATCH] feat(prometheus.receive_http): accept Pushgateway format (#1) --- .../prometheus/prometheus.receive_http.md | 76 ++- example/.gitignore | 3 +- example/pushgateway/README.md | 20 + example/pushgateway/config.alloy | 15 + example/pushgateway/docker-compose.yml | 8 + .../prometheus/receive_http/pushgateway.go | 268 +++++++++++ .../receive_http/pushgateway_test.go | 455 ++++++++++++++++++ .../prometheus/receive_http/receive_http.go | 7 +- 8 files changed, 844 insertions(+), 8 deletions(-) create mode 100644 example/pushgateway/README.md create mode 100644 example/pushgateway/config.alloy create mode 100644 example/pushgateway/docker-compose.yml create mode 100644 internal/component/prometheus/receive_http/pushgateway.go create mode 100644 internal/component/prometheus/receive_http/pushgateway_test.go diff --git a/docs/sources/reference/components/prometheus/prometheus.receive_http.md b/docs/sources/reference/components/prometheus/prometheus.receive_http.md index 346080ab35d..428712068d0 100644 --- a/docs/sources/reference/components/prometheus/prometheus.receive_http.md +++ b/docs/sources/reference/components/prometheus/prometheus.receive_http.md @@ -14,11 +14,15 @@ title: prometheus.receive_http `prometheus.receive_http` listens for HTTP requests containing Prometheus metric samples and forwards them to other components capable of receiving metrics. -The HTTP API exposed is compatible with [Prometheus `remote_write` API][prometheus-remote-write-docs]. -This means that other [`prometheus.remote_write`][prometheus.remote_write] components can be used as a client and send requests to `prometheus.receive_http` which enables using {{< param "PRODUCT_NAME" >}} as a proxy for Prometheus metrics. +The component exposes two HTTP APIs: + +* The [Prometheus `remote_write` API][prometheus-remote-write-docs], so that other [`prometheus.remote_write`][prometheus.remote_write] components can be used as a client and send requests to `prometheus.receive_http`. + This enables using {{< param "PRODUCT_NAME" >}} as a proxy for Prometheus metrics. +* The [Pushgateway push API][pushgateway-docs], so that short-lived jobs can push metrics with the Prometheus client library or tooling they already use. [prometheus.remote_write]: ../prometheus.remote_write/ [prometheus-remote-write-docs]: https://prometheus.io/docs/prometheus/latest/querying/api/#remote-write-receiver +[pushgateway-docs]: https://github.com/prometheus/pushgateway#api ## Usage @@ -32,11 +36,16 @@ prometheus.receive_http "