Skip to content

goodhistogram: add PrometheusCollector for registry integration#2

Open
angles-n-daemons wants to merge 2 commits intomainfrom
bdillmann/prometheus-collector
Open

goodhistogram: add PrometheusCollector for registry integration#2
angles-n-daemons wants to merge 2 commits intomainfrom
bdillmann/prometheus-collector

Conversation

@angles-n-daemons
Copy link
Copy Markdown
Contributor

Summary

  • Add PrometheusCollector type that implements prometheus.Collector, allowing a *Histogram to be registered with a Prometheus registry via h.ToPrometheusCollector(desc).
  • Recording stays on the *Histogram directly — the collector only participates in the scrape path, adding zero overhead to the hot path.
  • Update README to document the registry integration pattern and distinguish it from direct proto export.

Test plan

  • go build ./... passes
  • go test ./... passes

@cockroachlabs-cla-agent
Copy link
Copy Markdown

cockroachlabs-cla-agent bot commented Apr 16, 2026

CLA assistant check
All committers have signed the CLA.

angles-n-daemons and others added 2 commits April 16, 2026 15:45
Add a thin PrometheusCollector wrapper that implements
prometheus.Collector, allowing a goodhistogram to be registered
directly with a Prometheus registry for scraping. Recording remains
on the Histogram itself; the collector only participates in the
export path, adding zero overhead to the hot path.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
Add HistogramVec, a label-partitioned collection of Histograms that
implements prometheus.Collector. WithLabelValues returns a *Histogram
for direct int64 recording on the hot path; the vec handles Prometheus
registration and scrape-time export with label pairs.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@angles-n-daemons angles-n-daemons force-pushed the bdillmann/prometheus-collector branch from 79f22bd to 83a0ed6 Compare April 16, 2026 20:06
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.

1 participant