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 metrics #62

Open
popravich opened this issue Oct 31, 2019 · 3 comments
Open

Prometheus metrics #62

popravich opened this issue Oct 31, 2019 · 3 comments

Comments

@popravich
Copy link
Collaborator

popravich commented Oct 31, 2019

We are currently running swindon in kubernetes and so we have prometheus for metrics.
I have several options to expose swindon's metrics to prometheus:

  1. Implement new !PrometheusMetrics handler that will render current Cantal metrics in Prometheus readable format.
  2. Add Prometheus metrics alongside Cantal metrics (or through feature);
  3. Do not touch swindon code at all and implement a separate prometheus-cantal-exporter that will read cantal files and render prometheus metrics.

@tailhook , your thoughts?

@tailhook
Copy link
Collaborator

tailhook commented Nov 1, 2019

I think a special handler is good. (I also noticed that we don't have the documentation for SelfStatus handler which exposes current metrics)

Whether you need a cargo feature or not depends on whether you need some large dependencies to implement Prometheus exporter.

And hopefully, you can do it in top of libcantal::Collection metrics so we don't need to duplicate code at collection time.

@popravich
Copy link
Collaborator Author

Oh, it more complicated than I'd expected.
SelfStatus uses self-meter-http lib, which implements json serialization and does not expose wrapped meters (or reports from self-meter).
libcantal as well provides Json serializer and no other means to iterate metrics.

@tailhook
Copy link
Collaborator

For libcantal: Collection has a visit method.

Regarding self-meter-http there were two considerations:

  1. Backward compatibility if we change the internals of self-meter
  2. We can access data only when holding mutex, so serializing was kinda a way to ensure that lock isn't being hold too much.

Рerhaps we can expose something like .with(|metrics| ...) to at least disallow holding mutex in async code. And we can expose self_meter structure as it's quite stable for the time being?

It might also be possible to just write a Serializer to prometeus protocol. But that's probably "too clever" for the task.

popravich added a commit that referenced this issue Feb 25, 2020
Add a handler that renders cantal metrics in Prometheus plain text format.
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