-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Metric endpoint is summing up same metric #14497
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
Closed
pulkitmehra
wants to merge
8
commits into
spring-projects:master
from
pulkitmehra:14066_metric_endpoint_summing_values
Closed
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cda2e52
14066: finding first matching meters from nested MeterRegistries
pulkitmehra d4fd6d1
14066: adding more test case to find meters inside CompositeRegistries
pulkitmehra 3555e40
Merge remote-tracking branch 'upstream/master' into 14066_metric_endp…
pulkitmehra 45613ef
14066: removed a flaky test
pulkitmehra 1658bde
Merge remote-tracking branch 'upstream/master' into 14066_metric_endp…
pulkitmehra 13fef7d
14066: incorporate review comments to fix metric endpoint sum up values
pulkitmehra f72050a
14066: refactoring MetricEndpoint to use Collection instead of List
pulkitmehra d228116
Merge remote-tracking branch 'upstream/master' into 14066_metric_endp…
pulkitmehra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
No need to wrap this. The list returned is already an immutable copy.
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.
Thanks @jkschneider , the reason I am wrapping it into
Listis to avoid returningCollectionfrom this method.Collection<Meter> metersFound = registry.find(name).tags(tags).meters();If we return
Collection, theMetricEndpointmethods should be refactored so thatCollectioncould be pass around instead ofListinterface OR the return type should be downcasted toList(which is dangerous as we dont have control onMeterRegistry#find)Changing
MetricEndpointmethods to passCollectionis minor refactoring, with following highlight.spring-boot/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/MetricsEndpoint.java
Line 93 in 13fef7d
will be change to
meters.iterator().next().getId();Please confirm should I go ahead and do this minor change?
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.
The minor refactoring seems preferable to me to generating extra garbage in this case, as minor as that will be.
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.
Thanks @jkschneider, pls review.