Trying to get metrics from JMX for Spring Boot microservice which is deployed in Kubernetes. Enabled Spring actuator where I can see the metrics using "/actuator" endpoint.
Included the following configuration in elasticapm.properties file
I am expecting Hikari connection pool metrics in Elasticsearch, but not seeing anything. By default APM Javagent reporting other metrics like JVM, GC, transaction performance metrics.
Am I missing something, or do I need to configure anything to capture Hikari Pool connections metrics.
Could you send a screenshot of a JMX console or similar which shows the metric? Admittedly, we could do a better job in terms of logging if a JMX value could not be found. Have you tried debugging JmxMetricTracker?
Another reason which comes to mind is that maybe we are trying to discover the JMX metrics before they are registered.
To check if that's the case start your application without the capture_jmx_metrics option. Then add the value at runtime and wait for half a minute. Note that this does not work if the elasticapm.properties are in src/main/resources but only if they are in the same folder as the agent jar. Another option is to call System.setProperty("co.elastic.apm.capture_jmx_metrics", "object_name[com.zaxxer.hikari:type=Pool,name=*] attribute[TotalConnections] attribute[ActiveConnections]") at runtime (for example by evaluating an expression while debugging).
Running the application in a Kubernetes Pod, I am not able to replace the elasticapm.properties file at runtime, getting "resource busy" error.
But Tried by disabling capture_jmx_metrics option, then calling System.setProperty("co.elastic.apm.capture_jmx_metrics", "object_name[com.zaxxer.hikari:type=Pool,name=*] attribute[TotalConnections] attribute[ActiveConnections]") at runtime. No luck, not getting any additional metrics.
Providing the screenshots of Spring boot actuator metrics call
Calling ...../api/v1/chandratestservice/actuator/metrics/ endpoint gets me
Now in order to get individual metrics I will request ...../api/v1/chandratestservice/actuator/metrics/hikaricp.connections.active endpoint, which gets me
Not sure how to debug JmxMetricTracker for an application deployed in Kubernetes Pod.
I have a feeling that elasticapm configuration needs to be tweaked or I will get not these kind of metrics from APM agent.
Tested with the changes with log_level=debug but no luck. And I am not seeing anything in the logs also. What kind of log statements can I expect?
I tried Micrometer Elasticsearch implementation to report metrics directly from Micrometer to Elasticsearch. It's working, getting all the metrics. But it won't report the contextual information like from which service, host, etc.. It would have been great if APM agent able to report the metrics.
Not sure what I am missing.
To confirm if APM agent reports the JMX metrics, it will be indexed in Elasticsearch with processor.event : "metric" right, and will all new metrics be stored as new fields?
Thank you @felixbarny. I tried with the config you tested with, it's working. But when I tried the following config to get HikariCP pool metrics, not getting any metrics.
Sorry for the late reply, I was on PTO last week. We plan to release soon, best to subscribe the GitHub repository for releases in order to get notified.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.