I am using Spring Boot v2.1.3 and Micrometer Registry for Prometheus v1.2.1.
I have created a DistributionSummary in my code and added it to PrometheusRegistry. I am using this Metric to store the time taken by the API. Moreover, I have created bucket as per my SLA for ex: 10ms, 20ms and 60ms.
DistributionSummary summary = DistributionSummary.builder("nb.api.responsetime")
.sla(10, 20, 60).register(registry);
I am using Spring Actuator to publish the metrics to Prometheus.
The metrics which are available in response of "/actuator/prometheus" for DistributionSummary are only Sum, Max & Count of the metrics.
nb_api_responsetime_max 15.0
nb_api_responsetime_bucket{le="10.0",} 2.0
nb_api_responsetime_bucket{le="20.0",} 5.0
nb_api_responsetime_bucket{le="60.0",} 5.0
nb_api_responsetime_bucket{le="+Inf",} 5.0
nb_api_responsetime_count 5.0
nb_api_responsetime_sum 56.0
I want to show the average of time taken by the API calls in selected amount of time. For ex: Average Time taken by API in last 5 mins.