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

Clarify MetricReader parameters and temporality controls #2404

Merged
merged 28 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3def12b
Allow view configuration to specify cumulative, delta, or default agg…
Mar 5, 2022
6863a5d
the other exporters
Mar 5, 2022
e4c063e
Changelog
Mar 5, 2022
52ed7d5
PR num fix
Mar 7, 2022
597f8d5
Update specification/metrics/sdk_exporters/stdout.md
jmacd Mar 8, 2022
2f65282
Update specification/metrics/sdk.md
jmacd Mar 8, 2022
8873052
Merge branch 'main' of github.com:open-telemetry/opentelemetry-specif…
Mar 9, 2022
f66dc14
Merge branch 'jmacd/view_tempo' of github.com:jmacd/opentelemetry-spe…
Mar 9, 2022
c49d996
rough draft
Mar 10, 2022
40aec67
remove view aspect
Mar 10, 2022
5f9bb1a
Apply suggestions from code review
jmacd Mar 11, 2022
e8c3476
remove default_enabled, restore original view behavior
Mar 14, 2022
b301b5e
Merge branch 'jmacd/view_tempo' of github.com:jmacd/opentelemetry-spe…
Mar 14, 2022
6a036b3
update changelog
Mar 14, 2022
cd0c4d1
on the basis of..
Mar 14, 2022
cb38fe4
be explicit about UpDownCounter being cumulative even for DELTA prefe…
Mar 14, 2022
eef4876
consistency
Mar 14, 2022
fdd071d
restore delta example
Mar 14, 2022
5c688c8
Apply suggestions from code review
jmacd Mar 15, 2022
d295a6c
update spec matrix
Mar 15, 2022
fa34577
Merge branch 'jmacd/view_tempo' of github.com:jmacd/opentelemetry-spe…
Mar 15, 2022
e508b8e
Merge branch 'main' of github.com:open-telemetry/opentelemetry-specif…
Mar 15, 2022
7260dcd
lint
Mar 15, 2022
efb040f
be explicit about cumulative-to-delta
Mar 16, 2022
158e7ac
Merge branch 'main' of github.com:open-telemetry/opentelemetry-specif…
Mar 16, 2022
2a870f3
Merge branch 'main' into jmacd/view_tempo
reyang Mar 18, 2022
a901987
lint
Mar 18, 2022
e9db2ea
Merge branch 'jmacd/view_tempo' of github.com:jmacd/opentelemetry-spe…
Mar 18, 2022
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ release.
([#2317](https://github.com/open-telemetry/opentelemetry-specification/pull/2317)).
- Clarify that expectations for user callback behavior are documentation REQUIREMENTs.
([#2361](https://github.com/open-telemetry/opentelemetry-specification/pull/2361)).
- Allows Sum, Histogram, and ExponentialHistogram View Aggregations to
define the temporality to "cumulative", "delta", or "default", where
"default" is the default determined by the MetricReader on a per-instrument basis.
([#2404](https://github.com/open-telemetry/opentelemetry-specification/pull/2404)).

### Logs

Expand Down
28 changes: 15 additions & 13 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,15 @@ are the inputs:
will be used by default (TODO: once the Hint API is available, the default
behavior should respect the Hint if it is available).
* The `aggregation` (optional) to be used. If not provided, the SDK MUST
apply a [default aggregation](#default-aggregation). If the aggregation
outputs metric points that use aggregation temporality (e.g. Histogram,
Sum), the SDK SHOULD handle the aggregation temporality based on the
temporality of each [MetricReader](#metricreader) instance.
apply a [default aggregation](#default-aggregation) configurable on a
per-instrument basis according to the [MetricReader](#metricreader) instance.
jmacd marked this conversation as resolved.
Show resolved Hide resolved
jmacd marked this conversation as resolved.
Show resolved Hide resolved
* The aggregation `temporality` (optional), which may be one of
"cumulative", "delta", or "default". If the aggregation outputs
metric points that use aggregation temporality (e.g. Histogram,
Sum), then the SDK MUST export this View using this aggregation
jmacd marked this conversation as resolved.
Show resolved Hide resolved
temporality. The "default" value means the SDK SHOULD set the
aggregation temporality, configurable on a per-instrument basis
according to the [MetricReader](#metricreader) instance.
* The `exemplar_reservoir` (optional) to use for storing exemplars.
This should be a factory or callback similar to aggregation which allows
different reservoirs to be chosen by the aggregation.
Expand All @@ -199,8 +204,11 @@ The SDK SHOULD use the following logic to determine how to process Measurements
made with an Instrument:

* Determine the `MeterProvider` which "owns" the Instrument.
* If the `MeterProvider` has no `View` registered, take the Instrument and apply
the default configuration.
* If the `MeterProvider` has no `View` registered, take the Instrument
and apply the default configuration for Aggregation and
Aggregation Temporality. The SDK MUST support configuring the
Aggregation and Aggregation Temporality on a
per-instrument basis through this configuration.
* If the `MeterProvider` has one or more `View`(s) registered:
* For each View, if the Instrument could match the instrument selection
criteria:
Expand Down Expand Up @@ -672,12 +680,6 @@ 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.
jmacd marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down Expand Up @@ -782,7 +784,7 @@ can run at different schedule, for example:
pipe.

`MetricExporter` SHOULD provide a way to allow `MetricReader` to retrieve its
preferred temporality.
preferred Aggregation Temporality on a per-instrument basis.
jmacd marked this conversation as resolved.
Show resolved Hide resolved

### Push Metric Exporter

Expand Down
5 changes: 3 additions & 2 deletions specification/metrics/sdk_exporters/in-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local memory and allows to inspect it (useful for e.g. unit tests).
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
In-memory Metrics Exporter MUST allow the default [Aggregation
Temporality](../datamodel.md#temporality) to be specified in a
per-instrument basis, as described in
[MetricExporter](../sdk.md#metricexporter).
21 changes: 7 additions & 14 deletions specification/metrics/sdk_exporters/otlp.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ Exporter](../sdk.md#push-metric-exporter) which sends metrics via the
[OpenTelemetry Protocol](../../protocol/README.md).

OTLP Metrics Exporter MUST support both Cumulative and Delta
[Temporality](../datamodel.md#temporality).
[Aggregation Temporality](../datamodel.md#temporality).

OTLP Metrics Exporter MUST allow [Aggregation
Temporality](../datamodel.md#temporality) to be specified, as described in
OTLP Metrics Exporter MUST allow the default [Aggregation
Temporality](../datamodel.md#temporality) to be specified on a
per-instrument basis, 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 preference is not specified,
OTLP Metrics Exporter SHOULD use Cumulative as the default aggregation
temporality.

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`
3 changes: 2 additions & 1 deletion specification/metrics/sdk_exporters/stdout.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ StreamExporter, etc.
[Temporality](../datamodel.md#temporality).

"Standard output" Metrics Exporter MUST allow [Aggregation
Temporality](../datamodel.md#temporality) to be specified, as described in
Temporality](../datamodel.md#temporality) to be specified in a
per-instrument basis, as described in
[MetricExporter](../sdk.md#metricexporter).