Skip to content

Reconsider usage of generics in sdk/metric/internal/aggregate #7589

@dashpole

Description

@dashpole

Problem Statement

Measure functions in the metrics SDK are very performance-sensitive, as they are expected to be called on the host path for user applications.

As pointed out in #7474 (comment), type switching when recording values can come with overhead.

Proposed Solution and Alternatives

We could eliminate generics from the package entirely, but that would come with a lot of code duplication. A more viable approach might be to perform a single type switch at the beginning of the measure function, and then use type-specific implementations for various "data points" and atomic types.

It is very possible these optimizations are not worth it, so benchmarks are important to validate the theory that removing type switching will improve performance.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions