Skip to content

feat(output): prometheus-scrape pull endpoint (PIPE-1488, BP-469) - #321

Open
Dylan-M wants to merge 2 commits into
dylanmyers/pipe-1487-prometheus-remote-write-output-push-clientfrom
dylanmyers/pipe-1488-prometheus-scrape-output-pull-endpoint
Open

Dylan-M wants to merge 2 commits into
dylanmyers/pipe-1487-prometheus-remote-write-output-push-clientfrom
dylanmyers/pipe-1488-prometheus-scrape-output-pull-endpoint

Conversation

@Dylan-M

@Dylan-M Dylan-M commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Proposed Change

Adds a prometheus-scrape output: a metrics-only pull endpoint. It hosts an HTTP /metrics endpoint in Prometheus text exposition format, so a Prometheus server or the collector prometheusreceiver scrapes blitz directly. Sibling to the push-based prometheus-remote-write output; both serialize from the shared internal/prommap model.

The output keeps the latest value per series (name, type, label set) in an in-memory registry and serves a snapshot on each scrape.
By default no explicit timestamp is written and the scraper stamps at scrape time (idiomatic).
Option emitTimestamps: true appends each sample's millisecond timestamp (rare, but does exist in the wild).

Hand-rolled as a Round 3 output now. Will need to migrate to the later Effector / Push Core server model.

Checklist
  • Changes are tested
  • CI has passed

@Dylan-M
Dylan-M requested review from a team as code owners September 24, 2026 19:40
Comment thread output/promscrape/encode.go Outdated
sort.Slice(sorted, func(i, j int) bool { return sorted[i].Name < sorted[j].Name })

var b strings.Builder
for _, fam := range sorted {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The registry keeps one family per label set, and this loop writes # HELP/# TYPE for each one, so system_cpu_time got 80 TYPE lines. promtool check metrics fails with text format parsing error in line 13: second HELP line for metric name "system_cpu_time", and client_golang/expfmt-based consumers reject the scrape. The Prometheus server tolerates it.

Comment thread output/promscrape/registry.go Outdated
func (r *registry) upsert(fam prommap.MetricFamily) {
k := familyKey(fam)
r.mu.Lock()
r.fams[k] = fam

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

series never expire.

@Dylan-M
Dylan-M force-pushed the dylanmyers/pipe-1488-prometheus-scrape-output-pull-endpoint branch from ee5b3c0 to c791197 Compare September 28, 2026 18:09
@Dylan-M
Dylan-M requested a review from eKuG September 28, 2026 18:09
@eKuG
eKuG added this pull request to stack #326 September 28, 2026 18:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants