I'm not aware of any code that performs what you are trying to accomplish. 
Do you actually need access to the List<MetricFamilySamples> returned 
during the collection?

Typically, a Java application would use the Prometheus JMX Exporter (as a 
Java agent) to expose the metrics via HTTP(S). Your application could 
start, pause for a specific period of time, then call the JMX Exporter REST 
API on an interval (or for a specific number of iterations), capturing the 
output, and parsing it.

Here is a link to the Java class used to parse the REST API output used by 
the integration tests:

https://github.com/prometheus/jmx_exporter/blob/main/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/MetricsParser.java

On Monday, July 24, 2023 at 4:53:28 AM UTC-4 MUSTAJIB MOHAMMED KHAN wrote:

> I need to create a Java application which collects JMX metrics from a 
> running java process. For this, I am using the JMXCollector 
> <https://github.com/prometheus/jmx_exporter/blob/main/collector/src/main/java/io/prometheus/jmx/JmxCollector.java>
>  class. 
> I couldn't find the option in this to configure it for multiple iterations.
>
> I have a Java wrapper around this to schedule collection after a specified 
> time and for a specified number of iterations. I would like to understand 
> if there is an already existing class that I can use.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/c75be051-4d2d-4d4b-9e9f-1ab0661bc07an%40googlegroups.com.

Reply via email to