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 want to use ObservableGauge as a metric for my class.
I need to create observable gauges in real time, for example in some vector. great!
The problem I am facing is how can I push some args into calleble method which allow me to distinguish what observable object was called?
Once I pass same callable method I am not able to distinguish what object is called.
Example code:
`void foo_library::observable_counter_example(const std::string &name)
{
std::string counter_name = name + "_observable_counter";
auto provider = metrics_api::Provider::GetMeterProvider();
nostd::shared_ptr<metrics_api::Meter> meter = provider->GetMeter(name, "1.2.0");
double_observable_counter = meter->CreateDoubleObservableCounter(counter_name);
double_observable_counter->AddCallback(MeasurementFetcher::Fetcher, nullptr);
}`
In above example you can define some static Fetcher method but you cant pass any args. Maybe this nullptr is ptr to args?
in documentation this ptr is called *state which nothing says to me.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello guys,
I want to use ObservableGauge as a metric for my class.
I need to create observable gauges in real time, for example in some vector. great!
The problem I am facing is how can I push some args into calleble method which allow me to distinguish what observable object was called?
Once I pass same callable method I am not able to distinguish what object is called.
Example code:
`void foo_library::observable_counter_example(const std::string &name)
{
std::string counter_name = name + "_observable_counter";
auto provider = metrics_api::Provider::GetMeterProvider();
nostd::shared_ptr<metrics_api::Meter> meter = provider->GetMeter(name, "1.2.0");
double_observable_counter = meter->CreateDoubleObservableCounter(counter_name);
double_observable_counter->AddCallback(MeasurementFetcher::Fetcher, nullptr);
}`
In above example you can define some static Fetcher method but you cant pass any args. Maybe this nullptr is ptr to args?
in documentation this ptr is called *state which nothing says to me.
Any idea?
Beta Was this translation helpful? Give feedback.
All reactions