...
I created two, cause that way you can filter them and measure database queries. (There would be a way to use JDBC interceptors, but it's quite complicated with openJPA).
See for example some annotated methods in UserDao: /openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java#L626
Info |
---|
However this method only works if the relevant method is in a Spring Bean. |
Example metrics type database
...
duration over 1 min rate
Info |
---|
rate(org_openmeetings_metrics_sum{type="database"}[1m]) / rate( |
Info |
org_openmeetings_metrics_count{type="database"}[1m]) |
You can obviously use the same way like above to plot those counts into duration and graph it.
Example metrics type application simple count
select different ones via the legend on the bottom.
Example metrics type application durations 1 min rate
Code Block |
---|
rate(org_openmeetings_metrics_sum{type="application"}[1m])
/
rate(org_openmeetings_metrics_count{type="application"}[1m]) |
Application metrics based on manual metric
...
In that case I've added a Util that you can add at the start and end of the Method invocation, to create another metric.
At the start
Code Block |
---|
Histogram.Timer timer = PrometheusUtil.getHistogram() //
.labels("RoomPanel", "onInitialize", "application").startTimer();
try { |
At the end
Code Block |
---|
} finally {
timer.observeDuration();
} |
See : RoomPanel::onInitialize()
Example - narrow down the filter of the metric in order to just plot this method
Code Block |
---|
rate(org_openmeetings_metrics_sum{type="application",class="RoomPanel",method="onInitialize"}[1m])
/
rate(org_openmeetings_metrics_count{type="application",class="RoomPanel",method="onInitialize"}[1m]) |