Skip to content

fix: cancel retries on shutdown#6340

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

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
Copy Markdown
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
Copy Markdown
Member Author

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

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions Bot added the stale label Apr 13, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

This PR was closed because it has been stale for 14 days with no activity.

@github-actions github-actions Bot closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant