feat: add methods to get `Resource` set on in memory exporters
Changes
As per title.
I was testing my pipeline setup and found that there was no way to validate the resource was getting all the way to the exporter correctly (I had a bug in a LogProcessor which was not forwarding it correctly).
If I had these methods, I'd be able to assert my pipeline was implemented correctly end-to-end.
Merge requirement checklist
- [ ] CONTRIBUTING guidelines followed
- [ ] Unit tests added/updated (if applicable)
- [ ] Appropriate
CHANGELOG.mdfiles updated for non-trivial, user-facing changes - [ ] Changes in public API reviewed (if applicable)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 80.2%. Comparing base (
0e3511e) to head (e3c0b07).
Additional details and impacted files
@@ Coverage Diff @@
## main #3070 +/- ##
=====================================
Coverage 80.1% 80.2%
=====================================
Files 126 126
Lines 21949 21979 +30
=====================================
+ Hits 17603 17634 +31
+ Misses 4346 4345 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-sdk/src/logs/mod.rs#L119 One can indirectly validate that resource is setup correctly, as the exported telemetry is associated with the Resource and can catch issues like processor not passing Resource to exporter.
This is a small change, so I am okay with it. Please see if the above solves the issue you are trying to address and the PR is really needed.
Same/similar issue was reported https://github.com/open-telemetry/opentelemetry-rust/issues/3068#issuecomment-3084275740 too.
Thanks for the review. So I think the confusion I had is that InMemorySpanExporter just emits SpanData which does not seems to have an associated resource. So this differs from InMemoryLogExporter, where there is already a solution as you show.
So I guess either we merge this to make it possible to access the resource in this (same) new way in both, or we should change to produce SpanDataWithResource and associate the resource that way?