-
Notifications
You must be signed in to change notification settings - Fork 780
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
Output EOF following the OpenMetrics exposition recommendation #3654
Conversation
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static int WriteEof(byte[] buffer, int cursor) | ||
{ | ||
cursor = WriteAsciiStringNoEscape(buffer, cursor, "# EOF"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know enough about prometheus, but I assume this won't cause an older prometheus scrapper to blow up?
Also, is simply adding # EOF
enough to warrant a change to the content-type to application/openmetrics-text
?
Line 76 in a87f8f7
response.ContentType = "text/plain; charset=utf-8; version=0.0.4"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know enough about prometheus, but I assume this won't cause an older prometheus scrapper to blow up?
I've tested this with older version of scrappers.
Also, is simply adding
# EOF
enough to warrant a change to the content-type toapplication/openmetrics-text
?Line 76 in a87f8f7
response.ContentType = "text/plain; charset=utf-8; version=0.0.4";
I guess the answer is no, I keep learning new things while reading the OpenMetrics spec, e.g. #3651. I think we need to do a full scan of the spec, maybe it's okay to flip the content-type earlier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's okay to flip the content-type earlier?
Probably fine to wait since content-type might be a thing that would affect older scrapers. But may become necessary with exemplar support?
src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusCollectionManager.cs
Show resolved
Hide resolved
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3654 +/- ##
==========================================
- Coverage 87.88% 87.57% -0.32%
==========================================
Files 283 283
Lines 10264 10276 +12
==========================================
- Hits 9021 8999 -22
- Misses 1243 1277 +34
|
I do not check the specification, but it is worth to double check how it should behave when there is no metrics to export. Ref: #3643 |
Good point, the current approach is returning HTTP 200 without content/content-type, so technically it is not a Prometheus nor OpenMetrics exposition format (which means OpenMetrics spec won't apply). |
Changes
Reference: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#overall-structure
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes