-
Notifications
You must be signed in to change notification settings - Fork 554
fix: Improved logging for OTLP Tonic Exporter #3108
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
base: main
Are you sure you want to change the base?
fix: Improved logging for OTLP Tonic Exporter #3108
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3108 +/- ##
=======================================
- Coverage 80.1% 80.0% -0.1%
=======================================
Files 126 126
Lines 21957 21981 +24
=======================================
Hits 17603 17603
- Misses 4354 4378 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR improves logging for OTLP Tonic Exporter by separating interceptor failures from export failures and providing more detailed error information while simplifying error messages passed upstream.
- Separates interceptor failure logging from export failure logging to better identify custom interceptor issues
- Enhances debug logging to include individual gRPC error fields (code, message, details) instead of formatting the entire error object
- Simplifies error messages returned to upstream components while maintaining detailed logging
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.
File | Description |
---|---|
opentelemetry-otlp/src/exporter/tonic/trace.rs | Updates trace exporter with improved interceptor and export error logging |
opentelemetry-otlp/src/exporter/tonic/metrics.rs | Updates metrics exporter with improved interceptor and export error logging |
opentelemetry-otlp/src/exporter/tonic/logs.rs | Updates logs exporter with improved interceptor and export error logging |
.map_err(|e| { | ||
otel_debug!( | ||
name: "TonicTracesClient.InterceptorFailed", | ||
grpc_code = format!("{:?}", e.code()), |
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.
Using format!("{:?}", e.code())
is unnecessary since e.code()
already returns a displayable type. Consider using grpc_code = %e.code()
or grpc_code = e.code()
directly to avoid the formatting overhead.
grpc_code = format!("{:?}", e.code()), | |
grpc_code = e.code(), |
Copilot uses AI. Check for mistakes.
name: "TonicTracesClient.InterceptorFailed", | ||
grpc_code = format!("{:?}", e.code()), | ||
grpc_message = e.message(), | ||
grpc_details = format!("{:?}", e.details()) |
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.
Using format!("{:?}", e.details())
is unnecessary since e.details()
should be directly displayable. Consider using grpc_details = %e.details()
or similar to avoid the formatting overhead.
grpc_details = format!("{:?}", e.details()) | |
grpc_details = e.details() |
Copilot uses AI. Check for mistakes.
Err(OTelSdkError::InternalFailure(error)) | ||
otel_debug!( | ||
name: "TonicTracesClient.ExportFailed", | ||
grpc_code = format!("{:?}", e.code()), |
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.
Using format!("{:?}", e.code())
is unnecessary since e.code()
already returns a displayable type. Consider using grpc_code = %e.code()
or grpc_code = e.code()
directly to avoid the formatting overhead.
grpc_code = format!("{:?}", e.code()), | |
grpc_code = e.code(), |
Copilot uses AI. Check for mistakes.
name: "TonicTracesClient.ExportFailed", | ||
grpc_code = format!("{:?}", e.code()), | ||
grpc_message = e.message(), | ||
grpc_details = format!("{:?}", e.details()) |
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.
Using format!("{:?}", e.details())
is unnecessary since e.details()
should be directly displayable. Consider using grpc_details = %e.details()
or similar to avoid the formatting overhead.
grpc_details = format!("{:?}", e.details()) | |
grpc_details = e.details() |
Copilot uses AI. Check for mistakes.
)) | ||
otel_debug!( | ||
name: "TonicMetricsClient.InterceptorFailed", | ||
grpc_code = format!("{:?}", e.code()), |
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.
Using format!("{:?}", e.code())
is unnecessary since e.code()
already returns a displayable type. Consider using grpc_code = %e.code()
or grpc_code = e.code()
directly to avoid the formatting overhead.
grpc_code = format!("{:?}", e.code()), | |
grpc_code = e.code(), |
Copilot uses AI. Check for mistakes.
name: "TonicMetricsClient.ExportFailed", | ||
grpc_code = format!("{:?}", e.code()), | ||
grpc_message = e.message(), | ||
grpc_details = format!("{:?}", e.details()) |
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.
Using format!("{:?}", e.details())
is unnecessary since e.details()
should be directly displayable. Consider using grpc_details = %e.details()
or similar to avoid the formatting overhead.
grpc_details = format!("{:?}", e.details()) | |
grpc_details = e.details() |
Copilot uses AI. Check for mistakes.
.map_err(|e| { | ||
otel_debug!( | ||
name: "TonicLogsClient.InterceptorFailed", | ||
grpc_code = format!("{:?}", e.code()), |
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.
Using format!("{:?}", e.code())
is unnecessary since e.code()
already returns a displayable type. Consider using grpc_code = %e.code()
or grpc_code = e.code()
directly to avoid the formatting overhead.
grpc_code = format!("{:?}", e.code()), | |
grpc_code = e.code(), |
Copilot uses AI. Check for mistakes.
name: "TonicLogsClient.InterceptorFailed", | ||
grpc_code = format!("{:?}", e.code()), | ||
grpc_message = e.message(), | ||
grpc_details = format!("{:?}", e.details()) |
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.
Using format!("{:?}", e.details())
is unnecessary since e.details()
should be directly displayable. Consider using grpc_details = %e.details()
or similar to avoid the formatting overhead.
grpc_details = format!("{:?}", e.details()) | |
grpc_details = %e.details() |
Copilot uses AI. Check for mistakes.
Err(OTelSdkError::InternalFailure(error)) | ||
otel_debug!( | ||
name: "TonicLogsClient.ExportFailed", | ||
grpc_code = format!("{:?}", e.code()), |
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.
Using format!("{:?}", e.code())
is unnecessary since e.code()
already returns a displayable type. Consider using grpc_code = %e.code()
or grpc_code = e.code()
directly to avoid the formatting overhead.
grpc_code = format!("{:?}", e.code()), | |
grpc_code = e.code(), |
Copilot uses AI. Check for mistakes.
name: "TonicLogsClient.ExportFailed", | ||
grpc_code = format!("{:?}", e.code()), | ||
grpc_message = e.message(), | ||
grpc_details = format!("{:?}", e.details()) |
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.
Using format!("{:?}", e.details())
is unnecessary since e.details()
should be directly displayable. Consider using grpc_details = %e.details()
or similar to avoid the formatting overhead.
grpc_details = format!("{:?}", e.details()) | |
grpc_details = e.details() |
Copilot uses AI. Check for mistakes.
Improved logging
Related to #3021