Skip to content

Async instrument state: implement InstrumentCardinalityLimit #410

@jmacd

Description

@jmacd

Is your feature request related to a problem? Please describe.
The async instrument code path has a "feature" I would eliminate. It suppresses duplicate observations and ensures that each attribute set is counted once even when you repeat an observation (i.e., a duplicate measurement) in the same callback.

I would change the implementation to correctly sum these. Currently, #385 adds a View-state limit to the asynchronous instruments, because if implemented with the current duplicate suppression inside Async-state, the overflow aggregator observations are not correctly summed.

Describe the solution you'd like
The Async-state package should implement InstrumentCardinalityLimit by preventing more than a certain number of observed attribute sets. However, as currently implemented, the result of overflow handling would also re-order observations arbitrarily, because of an intermediate map, combined with Golang map iteration. To address this, the Async-state package should pass-through the observations in the order they are made, but then cut off the use of new attribute sets if the callback makes too many observations (correctly aggregating them into the overflow set).

Describe alternatives you've considered
Current code base -- considered not great, thus not much testing is done and no overflow handling is done in Async-state.

Additional context
open-telemetry/opentelemetry-specification#2960

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions