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

Specify preferred Aggregtion and Aggregation Temporality on a per-instrument basis #2407

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ release.
- Clarify that the periodic metric reader is the default metric reader to be
paired with push metric exporters (OTLP, stdout, in-memory)
([#2379](https://github.com/open-telemetry/opentelemetry-specification/pull/2379)).
- Specify that preferred Aggregation and Aggregation Temporality are provided on the
basis of instrument kind by the Exporter for the Reader's information.
([#2407](https://github.com/open-telemetry/opentelemetry-specification/pull/2407))

### Logs

Expand Down
41 changes: 20 additions & 21 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,25 +672,9 @@ The SDK SHOULD provide a way to allow `MetricReader` to respond to
idiomatic approach, for example, as `OnForceFlush` and `OnShutdown` callback
functions.

The SDK SHOULD provide a way to allow the preferred [Aggregation
Temporality](./datamodel.md#temporality) to be specified for a `MetricReader`
instance during the setup (e.g. initialization, registration, etc.) time. If the
preferred temporality is explicitly specified then the SDK SHOULD respect that,
otherwise use Cumulative.

[OpenTelemetry SDK](../overview.md#sdk)
authors MAY choose the best idiomatic design for their language:

* Whether to treat the temporality settings as recommendation or enforcement.
For example, if the temporality is set to Delta, would the SDK want to perform
Cumulative->Delta conversion for an [Asynchronous
Counter](./api.md#asynchronous-counter), or downgrade it to a
[Gauge](./datamodel.md#gauge), or keep consuming it as Cumulative due to the
consideration of [memory
efficiency](./supplementary-guidelines.md#memory-management)?
* Refer to the [supplementary
guidelines](./supplementary-guidelines.md#aggregation-temporality), which have
more context and suggestions.
The SDK MUST provide a way to allow the default [Aggregation](#aggregation) and [Aggregation
Temporality](./datamodel.md#temporality) to be determined on the basis of instrument kind
for a `MetricReader` instance during setup (e.g. initialization, registration, etc.) time.

### MetricReader operations

Expand Down Expand Up @@ -781,8 +765,23 @@ can run at different schedule, for example:
* Exporter D is a pull exporter which reacts to another scraper over a named
pipe.

`MetricExporter` SHOULD provide a way to allow `MetricReader` to retrieve its
preferred temporality.
`MetricExporter` MUST provide a way to allow `MetricReader` to retrieve its
default Aggregation and Aggregation Temporality on the basis of instrument kind.

For Exporters not specified in the [supported SDK exporters for
metrics](./sdk_exporters), [OpenTelemetry Exporter](#metric-exporter)
authors MAY choose the best design for the corresponding protocol:

* Whether to treat the temporality settings as recommendation or enforcement.
For example, if the temporality is set to Delta, would the MetricExporter want to perform
Cumulative->Delta conversion for an [Asynchronous
Counter](./api.md#asynchronous-counter), or downgrade it to a
[Gauge](./datamodel.md#gauge), or keep consuming it as Cumulative due to the
consideration of [memory
efficiency](./supplementary-guidelines.md#memory-management)?
* Refer to the [supplementary
guidelines](./supplementary-guidelines.md#aggregation-temporality), which have
more context and suggestions.

### Push Metric Exporter

Expand Down
9 changes: 6 additions & 3 deletions specification/metrics/sdk_exporters/in-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ by default the exporter MUST be paired with a
In-memory Metrics Exporter MUST support both Cumulative and Delta
[Temporality](../datamodel.md#temporality).

In-memory Metrics Exporter MUST allow [Aggregation
Temporality](../datamodel.md#temporality) to be specified, as described in
[MetricExporter](../sdk.md#metricexporter).
In-memory Metrics Exporter MUST allow the default [Aggregation
Temporality](../datamodel.md#temporality) to be specified on the basis of
instrument kind, as described in [MetricExporter](../sdk.md#metricexporter).

If the default Aggregation Temporality is not specified, In-memory Metrics
Exporter SHOULD use Cumulative as the default.
19 changes: 5 additions & 14 deletions specification/metrics/sdk_exporters/otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,12 @@ by default the exporter MUST be paired with a
OTLP Metrics Exporter MUST support both Cumulative and Delta
[Temporality](../datamodel.md#temporality).

OTLP Metrics Exporter MUST allow [Aggregation
Temporality](../datamodel.md#temporality) to be specified, as described in
[MetricExporter](../sdk.md#metricexporter).
OTLP Metrics Exporter MUST allow the default [Aggregation
Temporality](../datamodel.md#temporality) to be specified on the basis of
instrument kind, as described in [MetricExporter](../sdk.md#metricexporter).

If the temporality is not specified, OTLP Metrics Exporter SHOULD use Cumulative
as the default temporality.
If the default Aggregation Temporality is not specified, OTLP Metrics
Exporter SHOULD use Cumulative as the default.

The exporter MUST provide configuration according to the [OpenTelemetry Protocol
Exporter](../../protocol/exporter.md) specification.

In addition, the exporter MUST provide the following configuration (note: this
section will be merged to the [OpenTelemetry Protocol
Exporter](../../protocol/exporter.md) specification once it reaches
[Stable](../../document-status.md)):

| Description | Default | Env variable |
| ----------- | ------- | ------------ |
| The preferred output [Aggregation Temporality](../datamodel.md#temporality), either `CUMULATIVE` or `DELTA` (case insensitive) | `CUMULATIVE` | `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY`
9 changes: 6 additions & 3 deletions specification/metrics/sdk_exporters/stdout.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ StreamExporter, etc.
"Standard output" Metrics Exporter MUST support both Cumulative and Delta
[Temporality](../datamodel.md#temporality).

"Standard output" Metrics Exporter MUST allow [Aggregation
Temporality](../datamodel.md#temporality) to be specified, as described in
[MetricExporter](../sdk.md#metricexporter).
"Standard output" Metrics Exporter MUST allow the default [Aggregation
Temporality](../datamodel.md#temporality) to be specified on the basis of
instrument kind, as described in [MetricExporter](../sdk.md#metricexporter).

If the default Aggregation Temporality is not specified, "Standard output" Metrics
Exporter SHOULD use Cumulative as the default.