Skip to content

fix: cancel retries on shutdown#6340

Draft
pichlermarc wants to merge 5 commits intoopen-telemetry:mainfrom
dynatrace-oss-contrib:fix/speed-up-shutdown
Draft

fix: cancel retries on shutdown#6340
pichlermarc wants to merge 5 commits intoopen-telemetry:mainfrom
dynatrace-oss-contrib:fix/speed-up-shutdown

Conversation

@pichlermarc
Copy link
Member

@pichlermarc pichlermarc commented Jan 26, 2026

Which problem is this PR solving?

With the fix from #6147, we started re-trying failed exports more aggressively. The result is that shutdown now hangs for a couple of seconds before it finishes. (ref: open-telemetry/opentelemetry-js-contrib#3349)

This PR introduces several changes to address this:

  • OTLP exporters now cancel in-flight retries when exporter.forceFlush() is called
  • BatchSpanProcessor#shutdown() now schedules exports, but calls SpanExporter#forceFlush() right after scheduling the export, signaling the exporter to speed up
  • BatchLogRecordProcessor#shutdown() does the same
  • PeriodicExportingMetricReader#shutdown() does the same

The diff for this is fairly large, and I don't expect anybody to review this PR, so I'll break this down into smaller chunks, keeping this PR in draft to show all changes working together.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Existing tests (had to make some changes as the previous tests were relying heavily on behvaior that was not guaranteed by the API)
  • Added test in @opentelemetry/sdk-node to test the same shutdown code path used in @opentelemetry/auto-instrumentation-node

@pichlermarc
Copy link
Member Author

I'm spinning off mutiple PRs from this one, the first one is #6356

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.

1 participant

Comments