Skip to content

Require ForceFlush in periodic exporting MetricReader Shutdown - #5305

Merged
pellared merged 7 commits into
open-telemetry:mainfrom
danielgblanco:add-forceflush-to-shutdown
Sep 18, 2026
Merged

pellared merged 7 commits into
open-telemetry:mainfrom
danielgblanco:add-forceflush-to-shutdown

Conversation

@danielgblanco

@danielgblanco danielgblanco commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2983

Changes

Specifies that Shutdown of the periodic exporting MetricReader MUST include the effects of ForceFlush, so a final collection and export of pending metrics happens when MeterProvider.Shutdown() is called, not just on an explicit ForceFlush().

Today, there's no requirement to flush pending data. This means metrics recorded shortly before an application exits can be silently dropped unless the caller separately calls ForceFlush() before Shutdown(). This change mirrors the existing SpanProcessor.Shutdown() and LogRecordProcessor.Shutdown(), which already state "Shutdown MUST include the effects of ForceFlush".

As documented in #2983 (comment) all languages, except C++ and Ruby, already implement this behaviour. Issues for those language repos will follow.

@danielgblanco
danielgblanco requested a review from a team as a code owner September 8, 2026 17:11
Comment thread CHANGELOG.md Resolved
@danielgblanco

Copy link
Copy Markdown
Contributor Author

I'm unsure if this change would require tracking on the compliance matrix, but will add if deemed so.

@pellared pellared left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about "prototypes"? What are the existing SDKs doing? I just found:

all languages, except C++ and Ruby, already implement this behaviour. Issues for those language repos will follow.

I'm unsure if this change would require tracking on the compliance matrix, but will add if deemed so.

Personally, I do not think this should be needed.

Comment thread specification/metrics/sdk.md Resolved
@reyang

reyang commented Sep 8, 2026

Copy link
Copy Markdown
Member

What about "prototypes"? What are the existing SDKs doing?

Check #2983 (comment)

@pellared pellared left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one suggestion #5305 (comment)

Co-authored-by: Robert PajΔ…k <pellared@hotmail.com>
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged Β· refreshed 2026-09-18 05:49 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@cijothomas cijothomas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@pellared

Copy link
Copy Markdown
Member

I'll merge this PR by the end of Sep. 18th, 2026 unless there is blocking concerns.

@pellared pellared self-assigned this Sep 15, 2026
@pellared
pellared added this pull request to the merge queue Sep 18, 2026
Merged via the queue into open-telemetry:main with commit dbb606b Sep 18, 2026
11 checks passed
@carlosalberto carlosalberto mentioned this pull request Oct 20, 2026
lizthegrey pushed a commit to honeycombio/opentelemetry-specification that referenced this pull request Oct 23, 2026
### Traces

- Add `Sampler.Shutdown` operation.

([open-telemetry#5335](open-telemetry#5335))
- Clarify that calls to the Development `SpanProcessor.OnEnding` method
are not
  allowed after `Shutdown`.

([open-telemetry#5316](open-telemetry#5316))

### Metrics

- Specify that `Shutdown` of the periodic exporting MetricReader MUST
include
  the effects of `ForceFlush`.

([open-telemetry#5305](open-telemetry#5305))

### Logs

- Add systemd-journald example mapping to the logs data model appendix
and align syslog mapping.

([open-telemetry#4995](open-telemetry#4995))

### Resource

- Update resource detectors to generate entities and indicate resource
detectors should be entity-aware
  unless new `OTEL_EXPERIMENTAL_ENTITIES_ENABLED != true`.

([open-telemetry#5147](open-telemetry#5147))

### Entities

- Add in-development entity-resource startup specification.

([open-telemetry#5057](open-telemetry#5057))
- Remove `OTEL_ENTITIES` from general env var configuration spec.

([open-telemetry#5147](open-telemetry#5147))

### Common

- Stabilize Attribute and Attribute Collection representation for
non-OTLP.

([open-telemetry#5149](open-telemetry#5149))
  
### OpenTelemetry Protocol

- Clarify that the OTLP exporter timeout bounds the entire batch export,
including all request attempts and waits between retries, and that
earlier
  caller deadlines take precedence.

([open-telemetry#5347](open-telemetry#5347))

### Compatibility

- Stabilize Prometheus Unknown-typed metric transformation.

([open-telemetry#5213](open-telemetry#5213))
- Stabilize Prometheus Info metric transformation.

([open-telemetry#5211](open-telemetry#5211))

### SDK Configuration

- Declarative config should gracefully degrade when encountering
unrecognized
resource detectors. Other SDK plugin components continue to produce
errors
  when missing.

([open-telemetry#5323](open-telemetry#5323))

### Supplementary Guidelines

- Allow narrowly scoped security-related changes to stable SDK and
Contrib
behavior, configuration defaults, supported values, and emitted
telemetry
without a major version bump, while preserving API compatibility and
requiring
release notes describing the security rationale, user impact, and
migration.

([open-telemetry#5357](open-telemetry#5357))

### OTEPs

- Add OTEP proposing a top-level span type field in API, SDK, and OTLP.

([open-telemetry#5233](open-telemetry#5233))
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.

PeriodicExportingMetricReader should collect all metrics on shutdown

6 participants