Skip to content

Prometheus exporter: Stabilize section 'Content Negotiation'#5136

Open
ArthurSens wants to merge 2 commits into
open-telemetry:mainfrom
ArthurSens:promexporter-stabilize-content-negotiation
Open

Prometheus exporter: Stabilize section 'Content Negotiation'#5136
ArthurSens wants to merge 2 commits into
open-telemetry:mainfrom
ArthurSens:promexporter-stabilize-content-negotiation

Conversation

@ArthurSens

Copy link
Copy Markdown
Member

Fixes #4991

Changes

Stabilize the section Content Negotiation in the Prometheus exporter spec.

While reviewing the SDK implementation, I found these:

Fully compliant

  • Go SDK - Let's Prometheus Go SDK handle content negotiation; it is fully compliant.
  • Java SDK - Owns Content negotiation, but let's Prometheus Java SDK handle the transformation of a Registry into the output. Is fully compliant.
  • Collector's Prometheus exporter - Let's Prometheus Go SDK handle content negotiation; It is fully compliant.

Almost compliant

  • Python SDK - Let's Prometheus Python SDK handle content negotiation, but Prometheus Python SDK doesn't honor q weights and doesn't support protobuf.
  • DotNet - It parses Accept headers, supports text/plain and application/openmetrics, respects q weights, and falls back to Prometheus text 0.0.4. It doesn't support. allow-utf-8 is treated the same way as underscores, they are always escaped.

Non compliant

  • JS SDK - No content negotiation.
  • C++ SDK - No content negotiation.
  • Rust SDK - No content negotiation.
  • Swift SDK - No content negotiation.

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens requested review from a team as code owners June 5, 2026 20:02
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>

@krajorama krajorama left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

**Status**: [Development](../../document-status.md)
**Status**: [Stable](../../document-status.md)

A Prometheus Exporter MUST support content negotiation to allow clients to request

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually after reading #5062 , it seems like we should specify what to do if no Accept header is presented by the client to make it explicit. Fall back to text/plain version=0.0.4 and underscores translation. Text format 0.0.4 doesn't support utf-8.

@krajorama

Copy link
Copy Markdown
Member

Also there's a dependency to #5134 as that modifies the content negotiation part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stabilize Prometheus Metrics Exporter spec: Content Negotiation

4 participants