-
Notifications
You must be signed in to change notification settings - Fork 78
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
Have Opentelemetry error handler to use tracing::error #852
base: master
Are you sure you want to change the base?
Conversation
global::set_error_handler(|err| { | ||
tracing::error!("{}", err); | ||
})?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is a better more global place to set this instead of on each build_otlp_metric_exporter
call? Unsure if we have global metric initialization code.
@@ -120,6 +120,9 @@ pub(super) fn augment_meter_provider_with_defaults( | |||
pub fn build_otlp_metric_exporter( | |||
opts: OtelCollectorOptions, | |||
) -> Result<CoreOtelMeter, anyhow::Error> { | |||
global::set_error_handler(|err| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this was removed recently in 0.27 (ref open-telemetry/opentelemetry-rust#2260), so we either need to say in the dep that we are 0.26 (not sure if you can say < 0.27
) or look at that migration guide and see if just upgrading to 0.27 is enough to get proper logs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the change only changes the behavior on how you can override their default logging behavior, we would still need to override their behavior, just in a different way now. I'm not sure it's worth upgrading to 0.27 over this.
What was changed
Set OpenTelemetry global setting to log to
tracing::error
Why?
Checklist
Closes [Feature Request] Have OpenTelemetry failure logs go to logger instead of stderr #810
How was this tested: