No output if callback function ObserverResultT does not match ObservableInstrument primitive . #2694
Labels
bug
Something isn't working
Stale
triage/needs-information
Indicates an issue needs more information in order to work on it.
There is an "issue" to where if the primitive used in the instrument is not the same as the primitive used in the observer result template, when observe is called, there is no output. I was unable to trace exactly where there should be an exception or something similar. You can reproduce the error using the lines below. Please notice that the instrument is of type double, while the observer result is of type long (int64).
for instance, if we have the instrument:
static auto ramObs = meter2->CreateDoubleObservableGauge("RAM", "Free RAM", "MB");
And the in the callback function, we have the line:
opentelemetry::nostd::get<opentelemetry::nostd::shared_ptr<opentelemetry::metrics::ObserverResultT>>(observer_result)->Observe(value_, labels);
Then there is no output. My thought would be to have a comparison between the instrument primitive and the observer result primitive, but I cannot find a way to do so without changing any function signatures since the instrument has no knowledge of the workings of the callback function.
I'm happy to try and resolve this myself but can't seem to find a way that does not majorly change any of the existing code to where portability and compatibility would be maintained. Thanks in advance!
The text was updated successfully, but these errors were encountered: