2
votes

I have a spring boot app with some REST APIs. I would like to collect usage metrics on these APIs. Metrics would be like how many times did a user hit the service in a time period. The user id is available in request header. Is there any framework that will help me with this reducing the boiler plate? Will splunk help?

3

3 Answers

3
votes

Spring Boot Actuator seems what you need to have these metrics available. Here are some resources to get you started:

On top of the pre-defined metrics, you also have the ability to define custom metrics. Here's an answer to that: Spring boot actuator - Implement custom metrics

0
votes

In our e-commerce project we use the DropWizard metrics:

https://github.com/dropwizard/metrics
https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-core
https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-healthchecks

With dropwizard you have timers, counters, meters, gauges, histograms, etc...

Getting started: https://metrics.dropwizard.io/3.1.0/getting-started/

0
votes

Spring Boot actuators will give the info you are looking. But if you are looking for any sophisticated tool(which is for enterprise apps), I would suggest to check "Dynatrace", which is best for tracking the traffic and no.of hits to a given API, of course, it gives LOT of options. Check it. if your API is already configured in Splunk, then I think, in the dashboard you can track the incoming requests with which you can write the query to fetch your desired output.