Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require MetricReader to have ForceFlush #3609

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ release.

- Add experimental metric attributes advice API.
([#3546](https://github.com/open-telemetry/opentelemetry-specification/pull/3546))
- Do not require `MetricReader` to have `ForceFlush`.
([#3609](https://github.com/open-telemetry/opentelemetry-specification/pull/3609))

### Logs

Expand Down
32 changes: 17 additions & 15 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,13 @@ decide if they want to make the shutdown timeout configurable.
### ForceFlush

This method provides a way for provider to notify the registered
[MetricReader](#metricreader) and [MetricExporter](#metricexporter) instances,
so they can do as much as they could to consume or send the metrics. Note:
unlike [Push Metric Exporter](#push-metric-exporter) which can send data on its
own schedule, [Pull Metric Exporter](#pull-metric-exporter) can only send the
data when it is being asked by the scraper, so `ForceFlush` would not make much
sense.
[MetricReader](#metricreader) instances that have an associated
[Push Metric Exporters](#push-metric-exporter), so they can do as much
as they could to collect and send the metrics.

`ForceFlush` MUST invoke `ForceFlush` on all
[Push Metric Exporter](#push-metric-exporter) instances
that are associated with registered [MetricReader](#metricreader) instances.

`ForceFlush` SHOULD provide a way to let the caller know whether it succeeded,
failed or timed out. `ForceFlush` SHOULD return some **ERROR** status if there
Expand All @@ -176,10 +177,6 @@ implemented as a blocking API or an asynchronous API which notifies the caller
via a callback or an event. [OpenTelemetry SDK](../overview.md#sdk) authors MAY
decide if they want to make the flush timeout configurable.

`ForceFlush` MUST invoke `ForceFlush` on all registered
[MetricReader](#metricreader) and [Push Metric Exporter](#push-metric-exporter)
instances.

### View

A `View` provides SDK users with the flexibility to customize the metrics that
Expand Down Expand Up @@ -1029,7 +1026,7 @@ determines the following capabilities:
* Registering [MetricProducer](#metricproducer)(s)
* Collecting metrics from the SDK and any registered
[MetricProducers](#metricproducer) on demand.
* Handling the [ForceFlush](#forceflush) and [Shutdown](#shutdown) signals from
* Handling the [Shutdown](#shutdown) signals from
the SDK.

To construct a `MetricReader` when setting up an SDK, the caller
Expand Down Expand Up @@ -1088,10 +1085,9 @@ one `MeterProvider` instance.
```

The SDK SHOULD provide a way to allow `MetricReader` to respond to
[MeterProvider.ForceFlush](#forceflush) and [MeterProvider.Shutdown](#shutdown).
[MeterProvider.Shutdown](#shutdown).
[OpenTelemetry SDK](../overview.md#sdk) authors MAY decide the language
idiomatic approach, for example, as `OnForceFlush` and `OnShutdown` callback
functions.
idiomatic approach, for example, as and `OnShutdown` callback function.

### MetricReader operations

Expand Down Expand Up @@ -1238,6 +1234,12 @@ components in the SDK:
+---------------------------------+
```

The SDK SHOULD provide a way to allow Push Metric Exporter to respond to
[MeterProvider.ForceFlush](#forceflush) and [MeterProvider.Shutdown](#shutdown).
[OpenTelemetry SDK](../overview.md#sdk) authors MAY decide the language
idiomatic approach, for example, as `OnForceFlush` and `OnShutdown` callback
functions.

#### Interface Definition

A Push Metric Exporter MUST support the following functions:
Expand Down Expand Up @@ -1487,5 +1489,5 @@ called concurrently.

**MetricReader** - `Collect` and `Shutdown` are safe to be called concurrently.

**MetricExporter** - `ForceFlush` and `Shutdown` are safe to be called
**Push Metric Exporter** - `ForceFlush` and `Shutdown` are safe to be called
concurrently.
Loading