metrics/prometheus: fix count field of metric #965
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
With changes done in #881 and #893, the
count
field of a metric was added into summary and was calculated in wrong way. The tests didn't complain as they were updated in few places to cater to the new logic or the values according to the new logic vs old logic turned out to be same for the test caseE.g. histogram count should be ideally 0 as no values are reported but it was changed to 6 which actually denotes the total percentile values reported. In case of timers, the values reported were 6 and the percentiles were also 6 so the test didn't catch this check.
This PR updates (or actually reverts) the reporting of count metric. Instead of reporting count as
len(values)
where values are the total percentiles reported, we fetch it directly frommetric.Count()
function as earlier (and also similar to how geth does).Changes
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
Checklist
Cross repository changes
Testing
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it