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

Fix OTLP Metrics Exporter error when attributes is nil #1681

Closed
kaylareopelle opened this issue Aug 14, 2024 · 0 comments · Fixed by #1683
Closed

Fix OTLP Metrics Exporter error when attributes is nil #1681

kaylareopelle opened this issue Aug 14, 2024 · 0 comments · Fixed by #1683
Labels

Comments

@kaylareopelle
Copy link
Contributor

During testing, I've run into issues with OTLP export when an instrument is recorded without attributes.

For example, when record is called on a histogram without attributes: histogram.record(123)

This error is logged:

E, [2024-08-01T13:41:56.081704 #86303] ERROR -- : OpenTelemetry error: unexpected error in OTLP::MetricsExporter#encode - undefined method map' for nil`

Which comes from this LOC because hdp.attributes is nil.

I haven't been able to track down a specific line in the spec that explains whether attributes must be present, but my hunch is that they're optional.

After this discussion, @xuan-cao-swi and I think the best approach would be to update update the default value of the attributes argument on the record methods to be an empty hash.

Looking at the code, it seems like histogram and up_down_counter need to be fixed, but there may be other areas that need updates as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant