Skip to content

refactor: create a new prometheus registry for every server#3170

Open
miparnisari wants to merge 1 commit into
mainfrom
avoid-dup-metrics
Open

refactor: create a new prometheus registry for every server#3170
miparnisari wants to merge 1 commit into
mainfrom
avoid-dup-metrics

Conversation

@miparnisari

@miparnisari miparnisari commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

To avoid the "duplicate metrics registration" problem.

@github-actions github-actions Bot added area/cli Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Jun 10, 2026
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.47619% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/cache/cache_otter.go 0.00% 2 Missing and 1 partial ⚠️
internal/dispatch/cluster/cluster.go 60.00% 1 Missing and 1 partial ⚠️
...ationtesting/consistencytestutil/clusteranddata.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

github-actions[bot]

This comment was marked as off-topic.

@miparnisari miparnisari force-pushed the avoid-dup-metrics branch 3 times, most recently from 0c9aa08 to 5823f28 Compare June 10, 2026 21:16
mux := http.NewServeMux()

mux.Handle("/metrics", promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
// TODO(miparnisari): use a custom registry instead of the default one!

@miparnisari miparnisari Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i rabbit-holed into this: https://github.com/authzed/spicedb/pull/2966/files but it got gnarly. Too many places to change

@miparnisari miparnisari marked this pull request as ready for review June 10, 2026 21:19
@miparnisari miparnisari requested a review from a team as a code owner June 10, 2026 21:19
@github-actions github-actions Bot added the area/datastore Affects the storage system label Jun 10, 2026
@github-actions github-actions Bot added the area/dispatch Affects dispatching of requests label Jun 10, 2026
Comment thread internal/dispatch/caching/caching.go Outdated
@miparnisari miparnisari force-pushed the avoid-dup-metrics branch 2 times, most recently from ee2a2e1 to 3a39fe7 Compare June 10, 2026 22:32
Comment thread internal/dispatch/caching/caching.go Outdated
if opts.prometheusSubsystem == "" {
opts.prometheusSubsystem = "dispatch_client"
if opts.metrics.PrometheusSubsystem == "" {
opts.metrics.PrometheusSubsystem = "dispatch_client"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should put these literals in consts while we're in here

Comment thread internal/dispatch/metrics.go
Comment thread pkg/cache/cache_otter.go Outdated
@miparnisari miparnisari enabled auto-merge (squash) June 10, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli Affects the command line area/datastore Affects the storage system area/dispatch Affects dispatching of requests area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants