Skip to content

[Feature]: Metrics - Bound instrument to achieve extremely high performance #1374

@cijothomas

Description

@cijothomas

Related Problems?

Performance of Metrics SDK is not good enough to be used in critical services.

Describe the solution you'd like:

Majority of the time is spent in locating the time-series to aggregate to. If the key and value are known ahead of time, we can avoid this lookup. This used to exist in the spec as "bound instrument". but was removed from initial stable spec, due to lack of demand for such a feature.

https://github.com/open-telemetry/opentelemetry-specification/blob/12b5b27d4b6a4c0197560f508f0be3c38d190dc4/specification/metrics/old_api.md#bound-instrument-calling-convention

Considered Alternatives

I am not aware of any other solution. Based on SDK benchmarks in OTel Rust and other languages (.NET in particular was used for comparison), the only way to really get blazing fast perf is by avoiding the manipulation/massaging of attributes+lookup of timeseries.

https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-sdk/benches/metric.rs#L82-L87 shows that highest perf is achieved for no attributes, and perf decreases significantly with each attribute.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

A-metricsArea: issues related to metricsenhancementNew feature or requesttriage:todoNeeds to be traiged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions