Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Convert spring boot actuator metrics to prometheus #251

Closed
hsdmiranda wants to merge 2 commits intoprometheus:masterprometheus/client_java:masterfrom
hsdmiranda:masterhsdmiranda/client_java:masterCopy head branch name to clipboard
Closed

Convert spring boot actuator metrics to prometheus #251
hsdmiranda wants to merge 2 commits intoprometheus:masterprometheus/client_java:masterfrom
hsdmiranda:masterhsdmiranda/client_java:masterCopy head branch name to clipboard

Conversation

@hsdmiranda
Copy link
Contributor

Spring boot actuator already measures some HTTP metrics and expose them, but the spring boot integration with prometheus just convert them in a way that is not really useful. See example bellow:

Spring boot actuator format:

"gauge.response.GET.metrics": 76.0,
"gauge.response.GET.info": 7.0,
"gauge.response.info": 25.0,
"gauge.response.metrics": 76.0

How is current been converted, what is quite useless if you try to create some dashboards

# HELP gauge_response_GET_metrics gauge_response_GET_metrics
# TYPE gauge_response_GET_metrics gauge
gauge_response_GET_metrics 6.0
# HELP gauge_response_metrics gauge_response_metrics
# TYPE gauge_response_metrics gauge
gauge_response_metrics 5.0

And this is how is supposed to be:

# HELP gauge_response gauge_response
# TYPE gauge_response gauge
gauge_response{endpoint="/metrics", method="GET"} 4534.0
gauge_response{endpoint="/metrics"} 22.0

In case this PR is accepted I can also create another converter for COUNTERs.

@t0kieu
Copy link

t0kieu commented Jun 7, 2017

Hi, Is possible add HTTP response code (example: 200,400,500) to labels?

@hsdmiranda
Copy link
Contributor Author

It is for counters. Spring actuator expose those as well, but not for gauge.
"counter.status.GET.200.prometheus": 4913
If this PR is accepter i will also create a converter for it. In order to make spring boot expose all those metrics you need to enable in the configuration like this:

endpoints:
  metrics:
    filter:
      gauge-submissions: per-http-method, merged
      counter-submissions: per-http-method, merged

@brian-brazil
Copy link
Contributor

This seems very fragile and depends on assumptions of metric naming that are not going to be true in general. I don't think this is something we can include out of the box, as it's going to be environment specific.

@hsdmiranda
Copy link
Contributor Author

I did feel the same way once I wrote it, but it is environment specific just for spring boot. Without this converter the metrics becomes quite useless.

@brian-brazil
Copy link
Contributor

It's environment specific to what other metrics you have lying around, and which endpoints you have.

The spring boot metrics integration is only meant to be a stop gap until you can get instrumentation with the client library in place.

@checketts
Copy link
Contributor

The spring boot metrics integration is only meant to be a stop gap until you can get instrumentation with the client library in place

@hsdmiranda Spring has initial support to milti-dimensional metrics coming https://github.com/spring-projects/spring-metrics/blob/master/src/main/java/org/springframework/metrics/instrument/web/MetricsWebFilter.java

It has a few point releases, so you can pull it in via maven. It is pretty new, but coming together pretty quickly.

I agree that the current SpringbootMetricsCollector is really useless in its current form without your changes, I would even recommend we deprecate it.

@hsdmiranda
Copy link
Contributor Author

The spring boot metrics integration is only meant to be a stop gap until you can get instrumentation with the client library in place

I don't really agree with that. But I strongly agree with the fragile reason.

@hsdmiranda hsdmiranda closed this Jun 7, 2017
@brian-brazil
Copy link
Contributor

I agree that the current SpringbootMetricsCollector is really useless in its current form without your changes, I would even recommend we deprecate it.

The same could be said about the Dropwizard integration. It's better than nothing, and gives you something to work from when starting out.

@hsdmiranda
Copy link
Contributor Author

I agree that is better than nothing. But with the current solution for spring boot is just like nothing :)

I think the solution as proposed by @checketts will be a better one, once they release the multi-dimension metrics

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

Comments

Close sidebar
Morty Proxy This is a proxified and sanitized view of the page, visit original site.