Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

cijothomas
Copy link
Member

Improved logging

  1. Interceptor failures are logged separately from export failures. Built-in interceptor simply adds Metadata, and has no scope of failure, so if this fails, it indicates user has added custom interceptors which is failing.
  2. Log individual fields in the OTLP exporter, and then return Result contains just the minimal info about failure as OTLP's own log already has sufficient information, and no need to duplicate it by upstream component like batchexportprocessor/readers.

Related to #3021

@cijothomas cijothomas requested a review from a team as a code owner August 2, 2025 19:49
Copy link

codecov bot commented Aug 2, 2025

Codecov Report

❌ Patch coverage is 0% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.4%. Comparing base (86dfd4b) to head (fedaec0).

Files with missing lines Patch % Lines
opentelemetry-otlp/src/exporter/tonic/metrics.rs 0.0% 14 Missing ⚠️
opentelemetry-otlp/src/exporter/tonic/logs.rs 0.0% 12 Missing ⚠️
opentelemetry-otlp/src/exporter/tonic/trace.rs 0.0% 12 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3108     +/-   ##
=======================================
- Coverage   80.4%   80.4%   -0.1%     
=======================================
  Files        126     126             
  Lines      22237   22261     +24     
=======================================
  Hits       17898   17898             
- Misses      4339    4363     +24     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cijothomas cijothomas requested a review from Copilot August 2, 2025 19:59
Copy link
Contributor

@Copilot Copilot AI left a 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

grpc_message = e.message(),
grpc_details = format!("{:?}", e.details())
);
OTelSdkError::InternalFailure("Logs export failed in interceptor".into())
Copy link
Member

@lalitb lalitb Aug 7, 2025

Choose a reason for hiding this comment

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

should we at least add the grpc_code here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

neutral to it..we already log it here. And upstream SDK would log again... I can add just the grpc_code alone to the failure message.

Copy link
Member

Choose a reason for hiding this comment

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

Also, add TODO to do selective error handling - i.e. return detailed info for non-auth errors

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.

LGTM with nit comments

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