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 metrics SDK limits handling #2007

Merged
merged 11 commits into from
Oct 15, 2021
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.
([#1915](https://github.com/open-telemetry/opentelemetry-specification/pull/1915))
- Add exponential histogram to the metrics data model.
([#1935](https://github.com/open-telemetry/opentelemetry-specification/pull/1935))
- Add clarifications on how to handle numerical limits.
([#2007](https://github.com/open-telemetry/opentelemetry-specification/pull/2007))

### Logs

Expand Down
19 changes: 19 additions & 0 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Table of Contents
* [Push Metric Exporter](#push-metric-exporter)
* [Pull Metric Exporter](#pull-metric-exporter)
* [Defaults and configuration](#defaults-and-configuration)
* [Numerical limits handling](#numerical-limits-handling)
* [Compatibility requirements](#compatibility-requirements)
* [Concurrency requirements](#concurrency-requirements)

Expand Down Expand Up @@ -775,6 +776,24 @@ modeled to interact with other components in the SDK:
The SDK MUST provide configuration according to the [SDK environment
variables](../sdk-environment-variables.md) specification.

## Numerical limits handling
reyang marked this conversation as resolved.
Show resolved Hide resolved

The SDK MUST handle numerical limits in a graceful way according to [Error
handling in OpenTelemetry](../error-handling.md).

If the SDK receives float/double values from [Instruments](./api.md#instrument),
it MUST handle all the possible values. For example, if the language runtime
supports [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754), the SDK needs to
handle NaNs and Infinites.

It is unspecified _how_ the SDK should handle the input limits. The SDK authors
MAY leverage/follow the language runtime behavior for better performance, rather
than perform a check on each value coming from the API.

It is unspecified _how_ the SDK should handle the output limits (e.g. integer
overflow). The SDK authors MAY rely on the language runtime behavior as long as
errors/exceptions are taken care of.

## Compatibility requirements

All the metrics components SHOULD allow new methods to be added to existing
Expand Down