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 error message caused by race condition when using PeriodicReader #1481

Merged
merged 5 commits into from
Feb 8, 2024

Conversation

izquierdo
Copy link
Contributor

@izquierdo izquierdo commented Jan 18, 2024

Fixes #1244

Changes

This defers starting the exporting thread until MeterProviderBuilder#build has been called.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Copy link

linux-foundation-easycla bot commented Jan 18, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: izquierdo / name: Daniel Izquierdo (fe62c82, c80cd40)
  • ✅ login: cijothomas / name: Cijo Thomas (8e6afc9, 051a760)
  • ✅ login: lalitb / name: Lalit Kumar Bhasin (826ab4f)

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (8688e7e) 61.8% compared to head (c80cd40) 61.8%.
Report is 3 commits behind head on main.

❗ Current head c80cd40 differs from pull request most recent head 051a760. Consider uploading reports for the commit 051a760 to get more accurate results

Files Patch % Lines
opentelemetry-sdk/src/metrics/periodic_reader.rs 92.3% 4 Missing ⚠️
opentelemetry-sdk/src/logs/log_emitter.rs 90.9% 1 Missing ⚠️
opentelemetry/src/logs/noop.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1481   +/-   ##
=====================================
  Coverage   61.8%   61.8%           
=====================================
  Files        144     144           
  Lines      19810   19821   +11     
=====================================
+ Hits       12256   12267   +11     
  Misses      7554    7554           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lalitb
Copy link
Member

lalitb commented Jan 23, 2024

@izquierdo The changes look to be in the right direction. Wondering if you plan to make this ready for review. Thanks.

@izquierdo
Copy link
Contributor Author

@izquierdo The changes look to be in the right direction. Wondering if you plan to make this ready for review. Thanks.

Yes, I haven't done so yet because of the new lines that are missing test coverage. Will mark it for review after updating the tests. Thank you.

@izquierdo izquierdo force-pushed the issue-1244 branch 2 times, most recently from e83f838 to ebb7b7e Compare January 26, 2024 08:31
@izquierdo izquierdo marked this pull request as ready for review January 26, 2024 10:04
@izquierdo izquierdo requested a review from a team as a code owner January 26, 2024 10:04
let result = reader.collect(&mut rm);
result.expect_err("error expected when reader is not registered");
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be easy to add the test for success scenario (something like):

  • create PeriodicReader
  • Create SdkMeterProvider instance / or Pipelines with the above created reader.
  • This should invoke worker, and collect cycle.

If not straightforward, we can park it for later. (Ideally, this test should have existed at first place before this PR.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a shot 👍

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done. Thanks for the PR :)

@cijothomas
Copy link
Member

Oops! Merge confict... Could you resolve that?

@cijothomas
Copy link
Member

Thanks @izquierdo for your contribution! Hope you can continue with more! We could really use more hands here.

@cijothomas cijothomas merged commit 3f327a1 into open-telemetry:main Feb 8, 2024
12 checks passed
@izquierdo izquierdo deleted the issue-1244 branch February 8, 2024 20:56
hdost pushed a commit that referenced this pull request Feb 14, 2024
Add a success scenario test for PeriodicReader as suggested in #1481 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race when using PeriodicReader to export metrics
3 participants