Keep EOF at end of OpenMetrics output #7982
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Resolves #7981
Now that Helidon's metrics is based on Micrometer, we use Micrometer's Prometheus meter registry for formatting the output. The Prometheus meter registry handles both Prometheus exposition format (which does not include a trailing EOF line) and OpenMetrics (which does).
That said, our formatting needs to do some processing on the output from that registry before returning it and that processing was incorrectly removing the
# EOF
string from the end of OpenMetrics output.The changes here remove that trimming and also enhance unit tests of the formatter to:
# EOF
trailer.,
after tags; the OpenMetrics output does not have that trailing,
and since the tests now specify OpenMetrics format they need to not expect the trailing,
after tags.As a test specific to the use case in the issue, I ran the SE Quickstart app and started a Prometheus server locally using the
prometheus.yml
configuration file below. The Prometheus server now accepts and processes the response from the metrics endpoint. (Most of the config is boilerplate; the interesting part is the lastjob
in thescrape_config
section.)Documentation
No doc impact - this is a bug fix.