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 view conflicts #2462

Merged
merged 14 commits into from
Apr 13, 2022
Merged
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 @@ -13,6 +13,9 @@ release.

### Metrics

- Clarify SDK behavior when view conflicts are present
([#2462](https://github.com/open-telemetry/opentelemetry-specification/pull/2462)).

### Logs

### Resource
Expand Down
19 changes: 12 additions & 7 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,10 @@ In order to avoid conflicts, views which specify a name SHOULD have an
instrument selector that selects at most one instrument. For the registration
mechanism described above, where selection is provided via configuration, the
SDK SHOULD NOT allow Views with a specified name to be declared with instrument
selectors that may select more than one instrument (e.g. wild card instrument name)
in the same Meter.
selectors that may select more than one instrument (e.g. wild card instrument
name) in the same Meter. For this and other cases where registering a view will
cause a conflict, SDKs MAY fail fast in accordance with
initialization [error handling principles](../error-handling.md#basic-error-handling-principles).

The SDK SHOULD use the following logic to determine how to process Measurements
made with an Instrument:
Expand All @@ -209,11 +211,14 @@ made with an Instrument:
* If the `MeterProvider` has one or more `View`(s) registered:
* For each View, if the Instrument could match the instrument selection
criteria:
* Try to apply the View configuration. If there is an error or a conflict
(e.g. the View requires to export the metrics using a certain name, but
the name is already used by another View), provide a way to let the user
know (e.g. expose
[self-diagnostics logs](../error-handling.md#self-diagnostics)).
* Try to apply the View configuration. If applying the View results
cijothomas marked this conversation as resolved.
Show resolved Hide resolved
in [conflicting metric identities](./datamodel.md#opentelemetry-protocol-data-model-producer-recommendations)
the implementation SHOULD apply the View and emit a warning. If it is not
possible to apply the View without producing semantic errors (e.g. the
View sets an asynchronous instrument to use
the [Explicit bucket histogram aggregation](#explicit-bucket-histogram-aggregation))
the implementation SHOULD emit a warning and proceed as if the View did
not exist.
* If the Instrument could not match with any of the registered `View`(s), the
SDK SHOULD enable the instrument using the default aggregation and temporality.
Users can configure match-all Views using [Drop aggregation](#drop-aggregation)
Expand Down