Skip to content

Commit

Permalink
collect ignores resource information from metric producers
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Aug 1, 2023
1 parent 065b250 commit e39653c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ release.
([#3546](https://github.com/open-telemetry/opentelemetry-specification/pull/3546))
- Revise the exemplar default reservoirs.
([#3627](https://github.com/open-telemetry/opentelemetry-specification/pull/3627))
- MetricReader.Collect ignores Resource from MetricProducer.Produce.
([#3636](https://github.com/open-telemetry/opentelemetry-specification/pull/3636))

### Logs

Expand Down
10 changes: 6 additions & 4 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,12 @@ SDK](../overview.md#sdk) authors MAY choose to add parameters (e.g. callback,
filter, timeout). [OpenTelemetry SDK](../overview.md#sdk) authors MAY choose the
return value type, or do not return anything.

`Collect` SHOULD invoke [Produce](#produce-batch) on registered
[MetricProducers](#metricproducer). If the bastch of metric points from
`Produce` includes [Resource](../resource/sdk.md) information, `Collect` SHOULD
ignore `Resource` from `Produce`, and use the `Resource` provided when
constructing the MeterProvider instead.

Note: it is expected that the `MetricReader.Collect` implementations will be
provided by the SDK, so it is RECOMMENDED to prevent the user from accidentally
overriding it, if possible (e.g. `final` in C++ and Java, `sealed` in C#).
Expand Down Expand Up @@ -1406,10 +1412,6 @@ in-memory state MAY implement the `MetricProducer` interface for convenience.
`AggregationTemporality` of produced metrics. SDK authors MAY provide utility
libraries to facilitate conversion between delta and cumulative temporalities.

If the batch of [Metric points](./data-model.md#metric-points) returned by
`Produce()` includes a [Resource](../resource/sdk.md), the `MetricProducer` MUST
accept configuration for the [Resource](../resource/sdk.md).

```text
+-----------------+ +--------------+
| | Metrics... | |
Expand Down

0 comments on commit e39653c

Please sign in to comment.