Eliminate duplicate values in metricFamilySamples#1
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.
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