Skip to content

Use OpenMetrics format for exposing exemplars #3449

@bastianeicher

Description

@bastianeicher

Feature Request

The OpenMetrics specification extends the Prometheus format with - among other things - support for exemplars. All recent versions of Prometheus support this out of the box and it provides a great way to correlate metrics with traces.

I'd imagine an implementation like this:

  • When a counter or histogram metric is updated, automatically capture Activity.Current (always keeping the latest value per metric).
  • PrometheusExporterMiddleware and PrometheusExporterHttpServer check the Accept header of incoming scrape requests. If this contains application/openmetrics-text; version=1.0.0, append the capture activity/trace IDs to metrics as specified by OpenMetrics.

I believe this would provide great value because it would make integration between two of OpenTelemetry's pillars, tracing and metrics, just work (tm) out of the box.

If you feel that this would be a good fit and could give me some pointers as to the right places in the code to integrate such functionality, I'd be happy to whip up a proof-of-concept PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleIssues and pull requests which have been flagged for closing due to inactivityenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions