Skip to content

Conversation

@pkutschera
Copy link

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

@moelholm
Copy link
Owner

@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 👍

@moelholm
Copy link
Owner

@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();
Copy link
Owner

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

@moelholm
Copy link
Owner

moelholm commented Jul 17, 2017

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

@filipepinheiro
Copy link

filipepinheiro commented Sep 20, 2017

@moelholm I think that you only get duplicated metrics when you have something like netflix ribbon on your system.
Ribbon load balancing system will duplicate some of the metrics.

For example:

# HELP counter_servo_loadbalancer_chooseserver counter_servo_loadbalancer_chooseserver
# TYPE counter_servo_loadbalancer_chooseserver gauge
counter_servo_loadbalancer_chooseserver 1.0
....
# HELP counter_servo_loadbalancer_chooseserver counter_servo_loadbalancer_chooseserver
# TYPE counter_servo_loadbalancer_chooseserver gauge
counter_servo_loadbalancer_chooseserver 0.0

@Vity01
Copy link

Vity01 commented Oct 31, 2017

any progress on this PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants