-
Notifications
You must be signed in to change notification settings - Fork 812
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
[sdk-metrics] Metric Instruments are not available in MetricReaders added after creation #4112
Comments
Forgot to add the output, only testCounter2 is available in console { |
Hmm, I think our metrics SDK is not built in a way to handle this case. IIRC none of the other language implementations support registering readers after creating a MeterProvider. @hectorhdzg In your specific case, would it be possible to move the second call to I think offering this kind of after-the-fact registration was not optimal and something we should consider dropping in SDK 2.0. Maybe we should only allow to add readers via |
I just ran into this same issue today and it creates for some really unintuitive and hard-to-debug behavior in the Otel library. Do note in our case we do create the For an example of the type of trickery people run into when trying to enforce calling order, see this issue filed against our project: autometrics-dev/autometrics-ts#113 |
@pichlermarc you pointed out that #4419 fixes this issue. I've tried with the latest version and indeed it works. IIUC the deprecation of I'm not opposing to that change but I guess we should highlight this and provide some guidance so users (like autometrics-dev) can adapt their codebase. |
@david-luna IIUC this issue would really be fixed by implementing a delegating no-op for metrics as defined in #3622. 🤔 As all data-points written to the instruments would be dropped anyway in absence of a This would also mean that this issue here is a duplicate of #3622 |
What happened?
Steps to Reproduce
Create some Metric instruments in a specific Meter, then create another Metric reader exporting the data somewhere else.
Expected Result
All Metric instruments are available in all Metric readers
Actual Result
Only Metrics instruments created while the readers were present are available
Additional Details
This is a simplistic code to demonstrate the issue, the actual problem we are having is that the Metric Instruments are created from OTel Instrumentation libraries in Azure distro package, and we will like to export those using a different exporter.
OpenTelemetry Setup Code
package.json
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: