Skip to content

Conversation

@stefanobaghino
Copy link
Contributor

@stefanobaghino stefanobaghino commented Nov 22, 2025

Fixes #2777

Changes

This follows the approach suggested here by @scottgerring:

The issue is in TonicLogsClient which uses tokio::sync::Mutex (async) but the LogExporter::shutdown_with_timeout() trait method is synchronous. This prevents calling .lock().await, so the current implementation has a TODO and just returns Ok() without actually shutting down the gRPC client.

Comparing shutdown on TonicMetricsClient , and in particular the type of the mutex used for the inner client and locked in the shutdown, seems to show a workable pattern.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 22, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: cijothomas / name: Cijo Thomas (a92adb7)

@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.7%. Comparing base (53c9f47) to head (a92adb7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-otlp/src/exporter/tonic/logs.rs 0.0% 22 Missing ⚠️
opentelemetry-otlp/src/exporter/tonic/metrics.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3255     +/-   ##
=======================================
- Coverage   80.8%   80.7%   -0.1%     
=======================================
  Files        129     129             
  Lines      23203   23212      +9     
=======================================
  Hits       18750   18750             
- Misses      4453    4462      +9     

☔ 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.

@stefanobaghino stefanobaghino changed the title Handle shutdown in logs exporter fix: handle shutdown in logs exporter Nov 22, 2025
@stefanobaghino stefanobaghino marked this pull request as ready for review November 22, 2025 14:10
@stefanobaghino stefanobaghino requested a review from a team as a code owner November 22, 2025 14:10
Copy link
Member

@scottgerring scottgerring left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

}
None => Err(tonic::Status::failed_precondition(
"exporter is already shut down",
"metrics exporter is already shut down",
Copy link
Member

Choose a reason for hiding this comment

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

I think this is helpful; I don't think the user would necessarily see which failed otherwise

@scottgerring
Copy link
Member

@stefanobaghino that was a quick turnaround :D

@stefanobaghino
Copy link
Contributor Author

I'd be happy to take any additional feedback on this. If this is not a satisfactory approach, I also have nothing against closing this. Please let me know how to progress. Thanks.

@scottgerring
Copy link
Member

I'd be happy to take any additional feedback on this. If this is not a satisfactory approach, I also have nothing against closing this. Please let me know how to progress. Thanks.

Hey @stefanobaghino should be fine; let's just wait on @cijothomas 's feedback! He ultimately holds the merge approval.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@cijothomas cijothomas merged commit 483b420 into open-telemetry:main Dec 2, 2025
26 of 27 checks passed
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.

OTLP Stabilization: Handle shutdown in OTLP/gRPC

3 participants