You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose a new feature for prometheus-cpp that would add an async or callback mode to the instrument types. This would allow a user to add a callback method (such as a std::function) to an instrument. The callback would be called during Collect() to set the value of the instrument before it’s exported to prometheus. The difference here with normal operation is that it avoids needing to directly record a value periodically, and lets the prometheus export set it only when it’s actually needed.
Does this seem like something worthwhile to add? I don’t mind doing the work, but I just wanted to gauge the interest before I got started on it.
If you need a (possibly overly-complicated) example, opentelemetry-cpp has a similar feature in their “Observable” instruments.
The text was updated successfully, but these errors were encountered:
I have same requirement, to implement sth like GaugeAdapter to collect metric from our internal statistics data on demand.
It's too complex & inefficient to sync such data with prometheus-cpp's internal registry.
For example, we have one counter to track the number of objects. Internally we use std::atomic_int to count, but it's so inefficient to call Gauge::Set in object's constructor/destructor.
I'd like to propose a new feature for prometheus-cpp that would add an async or callback mode to the instrument types. This would allow a user to add a callback method (such as a
std::function
) to an instrument. The callback would be called duringCollect()
to set the value of the instrument before it’s exported to prometheus. The difference here with normal operation is that it avoids needing to directly record a value periodically, and lets the prometheus export set it only when it’s actually needed.Does this seem like something worthwhile to add? I don’t mind doing the work, but I just wanted to gauge the interest before I got started on it.
If you need a (possibly overly-complicated) example, opentelemetry-cpp has a similar feature in their “Observable” instruments.
The text was updated successfully, but these errors were encountered: