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 configuring aggregations with MetricReaders #2643

Open
legendecas opened this issue Jul 4, 2022 · 7 comments
Open

Clarify configuring aggregations with MetricReaders #2643

legendecas opened this issue Jul 4, 2022 · 7 comments
Assignees
Labels
[label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR spec:metrics Related to the specification/metrics directory

Comments

@legendecas
Copy link
Member

#2404 updated the requirements to construct a metric reader:

https://github.com/open-telemetry/opentelemetry-specification/blob/v1.12.0/specification/metrics/sdk.md#metricreader

To construct a MetricReader when setting up an SDK, the caller SHOULD provide at least the following:
...

  • The default output aggregation (optional), a function of instrument kind. If not configured, the default aggregation SHOULD be used.
  • The default output temporality (optional), a function of instrument kind. If not configured, the Cumulative temporality SHOULD be used.

It stated that a MetricReader can be constructed with a function to select aggregations for an instrument kind. However, the spec also says that aggregation is configured via the view APIs:

https://github.com/open-telemetry/opentelemetry-specification/blob/v1.12.0/specification/metrics/sdk.md#aggregation

An Aggregation, as configured via the View, informs the SDK on the ways and means to compute Aggregated Metrics from incoming Instrument Measurements.

AFAICT, aggregations configured with views are visible to all metric readers. There are two problems with configuring aggregation with MetricReaders:

  1. It is not clear if the aggregation configured by a MetricReader should be visible to other metric readers, as it is said that MetricReader.collect should not cause side-effects to other metric readers, but not mentioning other MetricReader methods like the constructor.
  2. How to handle conflicts since MetricReader can not change the name of the instrument like views?

The SDK MUST support multiple MetricReader instances to be registered on the same MeterProvider, and the MetricReader.Collect invocation on one MetricReader instance SHOULD NOT introduce side-effects to other MetricReader instances.

@legendecas legendecas added the spec:metrics Related to the specification/metrics directory label Jul 4, 2022
@jsuereth jsuereth added the [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR label Jul 8, 2022
@legendecas
Copy link
Member Author

@jsuereth hi, thank you for taking a look at this issue. But I'm not sure what the label "triaged-accepted" means -- as there aren't any resolutions settled yet for this issue.

@jsuereth
Copy link
Contributor

It means this is an issue and should get worked on. We started a spec-triaging meeting Fridays to help get through the backlog of Specification issues. The result is either:

  • Closing the bug as invalid/won't fix (triage-rejected)
  • Asking for more information via (triage-needmoreinfo)
  • Accepting the bug (triage-accepted) - the Owner/Reporter should work together to fix the bug.

Hope that helps!

@jsuereth
Copy link
Contributor

It is not clear if the aggregation configured by a MetricReader should be visible to other metric readers, as it is said that MetricReader.collect should not cause side-effects to other metric readers, but not mentioning other MetricReader methods like the constructor.

It (generally) should not be visible. The naive implementation of this specification would lead to a per-reader "in memory storage" of metrics. If SDKs can optimise metric storage to "share" between readers, that's up to them. However, practically, with these changes I'd almost think we're (mostly) forced into per-metric-reader storage.

@reyang had a design that allowed sharing of partial-aggregated data between metric readers however I think, in practice, this is at odds with the real goal of #2404 - Minimizing the amount of memory consumed based on who is using the metric, and letting the "best" knowledgeable component make that decision (the exporter).

In more succinct terms:

  • The default aggregation of a metric should be chosen by the exporter, as this will lead to optimal memory overhead.
  • Views are a means to override default aggregation by users. They were designed before per-exporter aggregation, but they are still meant to be the user's last line of "no I know better" over defaults.
  • I think the open question in the specification now is whether Views should be aware of exporter, given their intended role in the SDK.

How to handle conflicts since MetricReader can not change the name of the instrument like views?

@reyang can confirm, but I think the intention here was always this order:

  • View configuration always wins
  • Once they exist, API hints would be used at this level
  • Next, Exporter defaults are used.
  • Lastly, there's an overriding OTEL default

So to me that leaves two open AIs if you agree:

  • Clarify in the specification the override order of aggregation (View, then Exporter, then Pure Default)
  • Decide (or reject) whether or not views should have access to Exporter when determining aggregation (i.e. make it explicit they override Exporter config).

@jmacd
Copy link
Contributor

jmacd commented Jul 12, 2022

See also #2288

@jsuereth
Copy link
Contributor

Discussed in Specificaiton SiG:

Action Items:

@jmacd
Copy link
Contributor

jmacd commented Nov 17, 2022

I propose to close this issue in favor of #2746 and #2810.

@legendecas
Copy link
Member Author

#2643 (comment)
A PR to the specification to make it clear override semantics of Views + Reader defaults.

@jmacd I believe this action item is still applicable and distinct to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR spec:metrics Related to the specification/metrics directory
Projects
None yet
Development

No branches or pull requests

3 participants