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

MetricProducer.Produce can include a Resource parameter #3636

Merged
merged 5 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -19,6 +19,8 @@ release.
([#3627](https://github.com/open-telemetry/opentelemetry-specification/pull/3627))
- Mark Metric No-Op API as stable.
([#3642](https://github.com/open-telemetry/opentelemetry-specification/pull/3642))
- MetricReader.Collect ignores Resource from MetricProducer.Produce.
([#3636](https://github.com/open-telemetry/opentelemetry-specification/pull/3636))

### Logs

Expand Down
14 changes: 9 additions & 5 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 batch of metric points from
`Produce` includes [Resource](../resource/sdk.md) information, `Collect` MAY
replace the `Resource` from the MetricProducer with 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 All @@ -1432,7 +1434,9 @@ A `MetricProducer` MUST support the following functions:

`Produce` provides metrics from the MetricProducer to the caller. `Produce`
MUST return a batch of [Metric points](./data-model.md#metric-points).
`Produce` does not have any required parameters, however, [OpenTelemetry
If the batch of [Metric points](./data-model.md#metric-points) includes
resource information, `Produce` SHOULD require a resource as a parameter.
`Produce` does not have any other required parameters, however, [OpenTelemetry
reyang marked this conversation as resolved.
Show resolved Hide resolved
SDK](../overview.md#sdk) authors MAY choose to add required or optional
parameters (e.g. timeout).

Expand Down
Loading