Skip to content

Commit

Permalink
Clarify metrics SDK limits handling (open-telemetry#2007)
Browse files Browse the repository at this point in the history
* Clarify metrics SDK limits handling

* fix link

* Update specification/metrics/sdk.md

Co-authored-by: Armin Ruech <[email protected]>

* Update specification/metrics/sdk.md

Co-authored-by: Armin Ruech <[email protected]>

* Apply suggestions from code review

Co-authored-by: Armin Ruech <[email protected]>

* lowercase

* update changelog

Co-authored-by: Armin Ruech <[email protected]>
  • Loading branch information
reyang and arminru authored Oct 15, 2021
1 parent e642f80 commit 79cee63
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 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.
([#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

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

0 comments on commit 79cee63

Please sign in to comment.