[Exporter.Prometheus] Remove DisableTimestamp#7176
Conversation
Removes the `DisableTimestamp` option from both OpenTelemetry.Exporter.Prometheus.AspNetCore and OpenTelemetry.Exporter.Prometheus.HttpListener. Contributes to open-telemetry#7150.
Add PR number.
Note the breaking change.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7176 +/- ##
==========================================
- Coverage 89.08% 89.00% -0.08%
==========================================
Files 271 271
Lines 13073 13043 -30
==========================================
- Hits 11646 11609 -37
- Misses 1427 1434 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Pull request overview
Removes the DisableTimestamp configuration surface from the Prometheus exporters and updates the shared serializer implementation to never emit explicit sample timestamps, aligning behavior with Prometheus/OpenMetrics guidance and the linked issue.
Changes:
- Removed
DisableTimestampfromPrometheusAspNetCoreOptionsandPrometheusHttpListenerOptions(plus associated internal plumbing). - Updated the Prometheus serializer to stop writing timestamps and removed the now-unused timestamp writer helper.
- Updated unit/integration tests and benchmarks to reflect the new timestamp-less output.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests/PrometheusSerializerTests.cs | Updates serializer output assertions to no longer expect timestamps; removes disableTimestamp parameterization. |
| test/OpenTelemetry.Exporter.Prometheus.HttpListener.Tests/PrometheusHttpListenerTests.cs | Updates integration tests to stop configuring/expecting timestamps. |
| test/OpenTelemetry.Exporter.Prometheus.AspNetCore.Tests/PrometheusExporterMiddlewareTests.cs | Updates middleware integration tests to stop configuring/expecting timestamps (and removes timestamp parsing logic). |
| test/Benchmarks/Exporter/PrometheusSerializerBenchmarks.cs | Updates benchmark call site for the new serializer signature without disableTimestamp. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/PrometheusHttpListenerOptions.cs | Removes public DisableTimestamp option from HttpListener options. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/PrometheusHttpListenerMeterProviderBuilderExtensions.cs | Stops forwarding DisableTimestamp into exporter options. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusSerializerExt.cs | Removes timestamp emission during metric point serialization and updates method signature. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusSerializer.cs | Removes WriteTimestamp helper since timestamps are no longer written. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusExporterOptions.cs | Removes DisableTimestamp and adjusts options initialization. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusExporter.cs | Removes internal DisableTimestamp state. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusCollectionManager.cs | Updates serializer invocation to new signature (no timestamp flag). |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/CHANGELOG.md | Notes breaking change for PrometheusHttpListenerOptions removal. |
| src/OpenTelemetry.Exporter.Prometheus.HttpListener/.publicApi/PublicAPI.Unshipped.txt | Removes unshipped API entries for DisableTimestamp on HttpListener options. |
| src/OpenTelemetry.Exporter.Prometheus.AspNetCore/PrometheusAspNetCoreOptions.cs | Removes public DisableTimestamp option from AspNetCore options. |
| src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md | Notes breaking change for PrometheusAspNetCoreOptions removal. |
| src/OpenTelemetry.Exporter.Prometheus.AspNetCore/.publicApi/PublicAPI.Unshipped.txt | Removes unshipped API entries for DisableTimestamp on AspNetCore options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Update text for PR link.
cijothomas
left a comment
There was a problem hiding this comment.
Agree with this. (left non-blocking comments about unrelated changed)
191daf0
Fixes #7150
Changes
Removes the
DisableTimestampoption from both OpenTelemetry.Exporter.Prometheus.AspNetCore and OpenTelemetry.Exporter.Prometheus.HttpListener.As the Prometheus spec is MUST NOT and OpenMetrics is SHOULD NOT, I thought the cleanest option was complete removal, especially as these packages aren't stable yet anyway.
Alternative approaches could be:
true.[Obsolete]before removing.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes