Skip to content

Conversation

@cijothomas
Copy link
Member

Addresses #2331 (comment)
Adds log when Get fails due to posion.

@cijothomas cijothomas requested a review from a team as a code owner November 24, 2024 15:44
otel_info!(name: "MeterProvider.GlobalSet", message = "Global meter provider is set. Meters can now be created using global::meter() or global::meter_with_scope().");
} else {
otel_error!(name: "MeterProvider.GlobalSetFailed", message = "Global meter provider is not set due to lock poison. Meters created using global::meter() or global::meter_with_scope() will not function.");
otel_error!(name: "MeterProvider.GlobalSetFailed", message = "Setting global meter provider failed. Meters created using global::meter() or global::meter_with_scope() will not function. Report this issue in OpenTelemetry repo.");
Copy link
Member Author

Choose a reason for hiding this comment

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

in a future PR, i'll try to make this consistent, by providing an attribute "suggested_action" where the value can inform users about actions they can do. In this case there are 2

  1. Report it at OpenTelemetry repro.
  2. Use meters from other meter provider instance, if they have access to.

This requires some time to come up with a consistent way across entire repo to ensure every warn/err logs have a clear action for end users.

@codecov
Copy link

codecov bot commented Nov 24, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.5%. Comparing base (a6e2cd6) to head (687dbfb).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry/src/global/metrics.rs 57.1% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2333   +/-   ##
=====================================
  Coverage   79.5%   79.5%           
=====================================
  Files        123     123           
  Lines      21363   21365    +2     
=====================================
+ Hits       17002   17004    +2     
  Misses      4361    4361           

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


🚨 Try these New Features:

provider.clone()
} else {
otel_error!(name: "MeterProvider.GlobalGetFailed", message = "Getting global meter provider failed. Meters created using global::meter() or global::meter_with_scope() will not function. Report this issue in OpenTelemetry repo.");
Arc::new(crate::metrics::noop::NoopMeterProvider::new())
Copy link
Member

Choose a reason for hiding this comment

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

This does great, to maintain continuity for application. Additionally, we can also consider trying to recover the poisoned provider, check if it's still intact (since corruption could happen if another thread panicked while holding the lock), and return it if everything is good. Of course, this would need to be handled on a case-by-case basis, and only where recovery makes sense. Something, to be tried separate of this PR, I will have a look if it is possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

agree. we absolutely cannot panic here so this is the minimal change to meet that goal. lets see if we can recover nicely.

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.

Thanks for the fix.

@cijothomas cijothomas merged commit dd982e3 into open-telemetry:main Nov 24, 2024
21 of 23 checks passed
pitoniak32 pushed a commit to pitoniak32/opentelemetry-rust that referenced this pull request Dec 4, 2024
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.

2 participants