Monitoring DB queries invocation performance

193 Views Asked by At

I have integrated micrometer in my spring-boot project. I have scrapping this data in the Prometheus server to draw graphs. I am new to Grafana and I want how know how to query gauge and summary types and how to draw graphs (time-series, gauge), I should you to monitor my application's performance. What this numeric value represent which is showing after '}'.

# HELP spring_data_repository_invocations_seconds_max Duration of repository invocations
# TYPE spring_data_repository_invocations_seconds_max gauge
spring_data_repository_invocations_seconds_max{application="customer",exception="None",method="save",repository="InfoRepository",state="SUCCESS",} 0.004128917

# HELP spring_data_repository_invocations_seconds Duration of repository invocations
# TYPE spring_data_repository_invocations_seconds summary
spring_data_repository_invocations_seconds_count{application="customer",exception="None",method="save",repository="InfoRepository",state="SUCCESS",} 42998.0
spring_data_repository_invocations_seconds_sum{application="customer",exception="None",method="save",repository="InfoRepository",state="SUCCESS",} 53.740906851
1

There are 1 best solutions below

0
On BEST ANSWER

Numeric value after metric is metric's value.

For metrics of type gauge it's current value as is. For metrics of type counter it's value of counter, and it's usually not interesting by itself, but we are more interested in it's increase or rate over time:

increase(http_requests_total [1h])
rate(node_cpu_second_total [5m])

Metrics of type summary consist of three time series:

  • streaming φ-quantiles (0 ≤ φ ≤ 1) of observed events, exposed as <basename>{quantile="<φ>"} (missing in your example)
  • the total sum of all observed values, exposed as <basename>_sum
  • the count of events that have been observed, exposed as <basename>_count.

<basename>_count always behaves as counter internally, while <basename>_sum might not if observations might have negative values. Official documentation on matter.

To visualize your summary you can use query like mentioned in the linked documentation:

  rate(spring_data_repository_invocations_seconds_sum[5m])
/
  rate(spring_data_repository_invocations_seconds_count[5m])