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
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)
* [Limits Handling](#limits-handling)
reyang marked this conversation as resolved.
Show resolved Hide resolved
* [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.

## Limits Handling
reyang marked this conversation as resolved.
Show resolved Hide resolved

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

If the SDK receives float/double value from [Instruments](./api.md#instrument),
reyang marked this conversation as resolved.
Show resolved Hide resolved
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
reyang marked this conversation as resolved.
Show resolved Hide resolved
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
reyang marked this conversation as resolved.
Show resolved Hide resolved
errors/exceptions are taken care of.

## Compatibility requirements

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