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

Best practice for listening for changes to the metrics registry #37

Open
hmillison opened this issue Jan 21, 2021 · 1 comment
Open

Comments

@hmillison
Copy link

Hey! Great work with this library, i'm currently working on using it to start instrumenting my org's app.

I'm curious to hear what the best approach is for listening to changes to counters, histograms, etc created by a registry so you know to send an update to your Prometheus Gateway.

I was expecting that maybe the registry would expose some sort of onChange listener you could use to trigger new requests to send the latest metrics to your backend.

For now i'm just checking the registry.metrics() output for changes on an interval and using that to send the latest metrics to the backend. Curious to know if anyone has a recommended way to do this?

@SergiuB
Copy link

SergiuB commented Mar 12, 2021

Instead of directly using the histogram API, I've created a wrapper over it that notifies listeners when observe is called.

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

No branches or pull requests

2 participants