-
Notifications
You must be signed in to change notification settings - Fork 79
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
efc31e6
Set global opentelemetry error handler to use tracing::error
yuandrew 513c533
Add OTel HTTP support
yuandrew f390cfc
Revert "Add OTel HTTP support"
yuandrew d4eb94d
Merge branch 'master' into otel-tracing-error
yuandrew 289145a
Merge branch 'master' into otel-tracing-error
yuandrew 6d582af
attempting to write a new test to validate this new setting
yuandrew 5386ced
Added test
yuandrew a55969a
Merge branch 'master' into otel-tracing-error
yuandrew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ use super::{ | |
}; | ||
use crate::{abstractions::dbg_panic, telemetry::metrics::DEFAULT_S_BUCKETS}; | ||
use opentelemetry::{ | ||
self, | ||
self, global, | ||
metrics::{Meter, MeterProvider as MeterProviderT}, | ||
Key, KeyValue, Value, | ||
}; | ||
|
@@ -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| { | ||
tracing::error!("{}", err); | ||
})?; | ||
Comment on lines
+124
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
let mut exporter = | ||
opentelemetry_otlp::TonicExporterBuilder::default().with_endpoint(opts.url.to_string()); | ||
if opts.url.scheme() == "https" || opts.url.scheme() == "grpcs" { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 think my concern is whether other people want to upgrade to 0.27+. I am not sure what Cargo's auto-upgrade logic is for zero-ver. Obviously one day we will need to as well even if that day is not today (can't stay on 0.26 forever).
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.
Who are the "other" people mentioned here? customers?
I assume cargo wouldn't auto-upgrade from 0.26 to 0.27, since there are a number of breaking changes with that update.
Agreed, I'm just reluctant to upgrade today 😅 but now that I've written a test, that future upgrade should be easier
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.
Nope just us internally
Works for me