-
Notifications
You must be signed in to change notification settings - Fork 14
Eliminate duplicate values in metricFamilySamples #1
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
base: master
Are you sure you want to change the base?
Conversation
|
@pkutschera I'm so sorry - for some reason I didn't notice your PR in a timely manner. I'll have a look at it the next weeks. Thank you very much for enhancing this project 👍 |
|
@pkutschera The build is failing. Code depends on Guava. I would like to avoid further dependencies. Please modify code to not depend on additional libraries. |
| @RequestMapping(produces = TextFormat.CONTENT_TYPE_004) | ||
| void writeMetrics(HttpServletResponse response) throws IOException { | ||
| try (Writer writer = response.getWriter()) { | ||
| Iterator<Collector.MetricFamilySamples> iterator = Collections.list(CollectorRegistry.defaultRegistry.metricFamilySamples()).stream().distinct().iterator(); |
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.
Remove dependency on Guava here.
Consider to just collect the stream into a List and then use Collections.enumeration( list ) instead below
|
Btw - could you please tell me exactly which values where duplicated ? Just did a quick sanity check on my test case.... don't see any |
|
@moelholm I think that you only get duplicated metrics when you have something like netflix ribbon on your system. For example: |
|
any progress on this PR ? |
Duplicate values are now removed from metrics before sending to prometheus, everything works fine for me now (spring boot 1.5.2 and prometheus 1.5.2