Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change StatusCode to 200 when no metrics are collected #3643

Merged
merged 3 commits into from
Sep 11, 2022

Conversation

dszmigielski
Copy link
Contributor

@dszmigielski dszmigielski commented Sep 9, 2022

Fixes #3582.

Changes

If Prometheus Exporter have no metrics to collect it reports StatusCode 200 now instead of 204.

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
    * [ ] Design discussion issue #
    * [ ] Changes in public API reviewed

@codecov
Copy link

codecov bot commented Sep 9, 2022

Codecov Report

Merging #3643 (c07397f) into main (872a52f) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3643      +/-   ##
==========================================
+ Coverage   87.22%   87.29%   +0.06%     
==========================================
  Files         282      282              
  Lines       10132    10132              
==========================================
+ Hits         8838     8845       +7     
+ Misses       1294     1287       -7     
Impacted Files Coverage Δ
...metheus.AspNetCore/PrometheusExporterMiddleware.cs 67.85% <100.00%> (ø)
....Prometheus.HttpListener/PrometheusHttpListener.cs 82.66% <100.00%> (ø)
src/OpenTelemetry/Logs/Pool/LogRecordSharedPool.cs 78.94% <0.00%> (-21.06%) ⬇️
...Propagators/OpenTelemetryPropagatorsEventSource.cs 87.50% <0.00%> (-12.50%) ⬇️
...emetry.Api/Internal/OpenTelemetryApiEventSource.cs 73.52% <0.00%> (-8.83%) ⬇️
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 97.65% <0.00%> (+0.78%) ⬆️
src/OpenTelemetry/Logs/OpenTelemetryLogger.cs 88.88% <0.00%> (+2.22%) ⬆️
...tpListener/Internal/PrometheusCollectionManager.cs 80.48% <0.00%> (+2.43%) ⬆️
...metryProtocol/Implementation/ActivityExtensions.cs 95.05% <0.00%> (+3.29%) ⬆️
...ZPages/Implementation/ZPagesExporterEventSource.cs 62.50% <0.00%> (+6.25%) ⬆️
... and 2 more

@dszmigielski dszmigielski marked this pull request as ready for review September 9, 2022 09:15
@dszmigielski dszmigielski requested a review from a team September 9, 2022 09:15
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM, would be even better to have a test case.

@cijothomas cijothomas merged commit cea14d3 into open-telemetry:main Sep 11, 2022
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.

Prometheus exporter should return empty body with 200 code not 204 when no metrics
4 participants