Skip to content
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

Duplicate metrics #271

Closed
ewolff opened this issue Jul 10, 2017 · 4 comments
Closed

Duplicate metrics #271

ewolff opened this issue Jul 10, 2017 · 4 comments

Comments

@ewolff
Copy link

ewolff commented Jul 10, 2017

I just published an update to the project https://github.com/ewolff/microservice-consul . It basically a simple sample application to show microservices and Consul. Now I added Prometheus. However, some metrics were duplicated so I did a hack https://github.com/ewolff/microservice-consul/blob/master/microservice-consul-demo/microservice-consul-demo-order/src/main/java/com/ewolff/microservice/order/prometheus/MetricsServletFix.java . This resolves the issue. gauge_servo_response_health and gauge_servo_response_prometheus were examples. Upon startup there were no duplicates. So it happened after the /health or /prometheus Endpoint were accessed.

I tried to implement a minimal version to make it easier to reproduce but that seems to be hard. I.e. https://github.com/thomasdarimont/spring-boot-prometheus-example doesn't have that problem. So maybe I did something stupid but I am not sure what.

@brian-brazil
Copy link
Contributor

This usually means you registered the same metric twice somewhere, with newer versions of the client you'll get an error at registration time if that happens. What client version are you on, and where are these metrics coming from?

@ewolff
Copy link
Author

ewolff commented Jul 10, 2017

I am using 0.0.23. I just have one single SpringBootMetricsCollector similar to the sample and to what it says in the documentation. I have no idea how a metric could be registered twice.

Upon startup the metrics mentioned do not exist. They are created once specific endpoints are accessed. So there might be a problem in that code. But the endpoints are created by Spring Boot Actuator. Therefore the problem has to be either in Spring Boot or the Prometheus client IMHO - unless I did something stupid.

@brian-brazil
Copy link
Contributor

Ah, this is likely a bug in whatever is producing those Spring metrics as a few modules are known to have duplicates (including servo). I'd suggest filing a bug with servo. See #130

@ewolff
Copy link
Author

ewolff commented Jul 10, 2017

Ah, thanks - that sounds a lot like my problem. I didn't look hard enough :-)

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

No branches or pull requests

2 participants