Skip to content
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

Prometheus implementation of MetricRegistry #47

Open
tirsen opened this issue Dec 10, 2020 · 2 comments
Open

Prometheus implementation of MetricRegistry #47

tirsen opened this issue Dec 10, 2020 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@tirsen
Copy link

tirsen commented Dec 10, 2020

I'd like to observe the behavior of the concurrency limits using Prometheus metrics. It's not immediately clear to me how to implement the MetricRegistry using https://github.com/prometheus/client_golang

Could you perhaps provide a quick sketch of how to do that? Or maybe even a full implementation?

@platinummonkey
Copy link
Owner

this seems relatively straightforward. It just seems to expose an http server with expvar-like query patterns.

could create a new registry that registers the http listener similar to https://github.com/platinummonkey/go-concurrency-limits/blob/master/metric_registry/datadog/registry.go#L50-L119 just swap the dd client reference for the http listener. From here you'd want to register all the available metrics https://github.com/prometheus/client_golang/blob/master/examples/random/main.go#L65-L68 on start and add them during-runtime when they are changed through the Register* interface.

the run loop would be pretty simple: https://github.com/platinummonkey/go-concurrency-limits/blob/master/metric_registry/datadog/registry.go#L143-L148 just swap this out with a pattern used here https://github.com/prometheus/client_golang/blob/master/examples/random/main.go#L83-L84 where it takes the metric samples and "observe"'s them

@platinummonkey platinummonkey added enhancement New feature or request good first issue Good for newcomers labels Oct 31, 2021
@jhalterman
Copy link
Contributor

@tirsen Did you ever tackle this? I'm interested in the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants