Skip to content

Conversation

davidhewitt
Copy link

@davidhewitt davidhewitt commented Aug 20, 2025

Fixes #3132

Changes

Removes the default implementation of shutdown_with_timeout from LogProcessor, to match SpanProcessor which also requires this method.

This fixes two non-test LogProcessor implementations which had implemented shutdown but not shutdown_with_timeout, meaning that they were doing a no-op shutdown as identified in #3132:

  • SimpleLogProcessor
  • async BatchLogProcessor

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)

@davidhewitt davidhewitt requested a review from a team as a code owner August 20, 2025 15:48
Copy link

codecov bot commented Aug 20, 2025

Codecov Report

❌ Patch coverage is 89.28571% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.6%. Comparing base (353bbb0) to head (9803d0c).

Files with missing lines Patch % Lines
opentelemetry-sdk/src/logs/log_processor.rs 75.0% 2 Missing ⚠️
opentelemetry-sdk/src/logs/mod.rs 50.0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3133   +/-   ##
=====================================
  Coverage   80.6%   80.6%           
=====================================
  Files        126     126           
  Lines      22195   22218   +23     
=====================================
+ Hits       17898   17919   +21     
- Misses      4297    4299    +2     

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

@davidhewitt davidhewitt changed the title make shutdown_with_timeout required on LogProcessor fix: make shutdown_with_timeout required on LogProcessor Aug 20, 2025
fn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult {
Ok(())
}
fn shutdown_with_timeout(&self, _timeout: Duration) -> OTelSdkResult;
Copy link
Member

Choose a reason for hiding this comment

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

we cannot make this change, as this is breaking.

Copy link
Author

Choose a reason for hiding this comment

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

I documented it in the changelog as breaking, am fully aware.

I defend it as a good change because as evidenced here there are existing bugs in production where implementations got that wrong.

The span processor trait does not have this implementation, so removing it improves consistency too.

But if you prefer I can close the PR.

Copy link
Member

Choose a reason for hiding this comment

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

Logs (and Metrics) SDK were declared stable, so we should not make any breaking change.
(trace/span sdk is beta, so we can fix anything there.)

there are existing bugs in production where implementations got that wrong.

Given we can't make breaking change, only option is to better document this so custom processor authors' won't make the mistake!
The existing bug (in this repo) is in an experimental component only right?

But if you prefer I can close the PR.

Let's fix the bug by implementing the right shutdown method in log_processor - that should be a good fix and no breaking change issues.

Agree it's not great. IIRC, we did have some discussions about providing default implementations before declaring stable, and ended up with a less-than-ideal choice :(

Copy link
Author

Choose a reason for hiding this comment

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

Understood. I'll aim to come back to this PR probably on Monday.

The existing bug (in this repo) is in an experimental component only right?

Unfortunately when running this change I found it also affects SimpleLogProcessor.

https://github.com/open-telemetry/opentelemetry-rust/pull/3133/files#diff-834c43f0e4972291eea6782a3ebf19e9b93f150d0b699dd5991f2ff52dc9c1fcR120

Agree it's not great. IIRC, we did have some discussions about providing default implementations before declaring stable, and ended up with a less-than-ideal choice :(

Ouch.

I guess we can document that shutdown usually should not be implemented and shutdown_with_timeout should be? Can we change the default implementation of shutdown_with_timeout to log a warning? Or is that still too breaking?

Copy link
Member

Choose a reason for hiding this comment

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

adding a log is fine. It is not common for users to write processors that require implementing any of these.. Most use cases are around enrichment (adding more attributes), and they don't need to worry about shutdown method at all.

Copy link
Author

Choose a reason for hiding this comment

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

I pushed a commit which re-adds this default implementation with an internal warning log.

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.

[Bug]: experimental async log exporter does not shutdown properly
2 participants