Table of Contents |
---|
Info |
---|
The current work is in a branch. is available since v6.0.0 |
Enable Metrics
Metrics are disable by default. The gathering of metrics as well as exposing them via HTTP for analysis needs to be enabled first.
Enable HTTP and WebService calls enable the Servlet Filter
Comment in the following block in the openmeetings/WEB-INF/web.xml
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- Start Prometheus Filter HTTP Servlet metrics
<filter>
<filter-name>prometheusFilter</filter-name>
<filter-class>io.prometheus.client.filter.MetricsFilter</filter-class>
<init-param>
<param-name>metric-name</param-name>
<param-value>webapp_metrics_filter</param-value>
</init-param>
<init-param>
<param-name>help</param-name>
<param-value>This is the help for your metrics filter</param-value>
</init-param>
<init-param>
<param-name>buckets</param-name>
<param-value>0.005,0.01,0.025,0.05,0.075,0.1,0.25,0.5,0.75,1,2.5,5,7.5,10</param-value>
</init-param>
<init-param>
<param-name>path-components</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>prometheusFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
End Prometheus --> |
Enable Exposing the metrics and enable Tomcat generic metrics
To enable the export of the metrics as well as some generic Tomcat export (for example around active threads) you need to comment in the following block in openmeetings/WEB-INF/In order to enable the metrics to be published as endpoint comment in the servlet in the web.xml
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- Start Prometheus export metrics HTTP <servlet> <servlet-name>metrics</servlet-name> <servlet-class>io.prometheus.client.exporter.MetricsServlet<class>org.apache.openmeetings.web.util.logging.OpenMeetingsMetricsServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>metrics</servlet-name> <url-pattern>/services/metrics/</url-pattern> </servlet-mapping> End Prometheus --> |
This will expose the metrics at: http://$HOST:$PORT/openmeetings/services/metrics/ (be aware of the trailing "/" !)See: /openmeetings-web/src/main/webapp/WEB-INF/web.xml#L110
Warning |
---|
If you plan to use this in production you need to secure that endpoint (for example by pointing. For example by:
|
Enable metrics for streaming and other application relevant metrics
In order to get insights on the application specific logic and streaming relevant components you need to additionally enable certain annotations by commenting in openmeetings/WEB-INF/classes/applicationContext.xml
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- Start annotation Prometheus metrics
<aop:aspectj-autoproxy/>
End annotation --> |
View your metrics in Prometheus
...
Initially you may find it's not quite trivial to calculate the duration for individual calls. But it makes sense once you review below. What we are interested is "rate pre per min" and similar statistics. Not an individual call, but rate/average over a certain period of time.
...
Application metrics based on manual metric
Info |
---|
This metric is currently not in use since it can't be disabled |
Unfortunate not all places in the code are spring beans. Also sometimes we have inner classes or similar issues.
...