Skip to content

[Feature]: Implement MetricProducer #2505

Open
@divergentdave

Description

@divergentdave

Related Problems?

This was removed in #2105 to reduce scope prior to 1.0.

Describe the solution you'd like:

I wanted to file a feature request for the eventual re-implementation of this part of the spec, and share my use case for it.

I'm using MetricProducer from opentelemetry_sdk v0.24.1 to adapt runtime metrics from the Tokio async runtime library, and to export them alongside application-defined metrics that use the OpenTelemetry SDK in a more traditional way. My main reason for using a MetricProducer is that it lets me create a HistogramDataPoint from already-aggregated histogram counter values produced by the Tokio library. Each Tokio worker thread has an array of histogram counters representing different buckets, and these counters are incremented during performance-sensitive operations by the library. When MetricProducer::produce() is called, my implementation reads those per-thread bucket counts, and outputs a HistogramDataPoint. I cannot use SDK histogram instruments, because Tokio does not expose the elapsed time underlying this histogram to user code, only the already-aggregated histogram, and the only API that SDK histogram instruments provide is record().

For reference, here's the source: https://github.com/divviup/janus/blob/e21f8663ad33902b03f5cf627b9cb6223646ad1f/aggregator/src/metrics/tokio_runtime.rs

Considered Alternatives

No response

Additional Context

MetricProducer is defined in the specification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-traceArea: issues related to tracingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions