cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export GC executions per minute

jcamps
Advisor

Hi all,

i want to export the GC executions per minute in order to insert these GC executions / minute for all my JVM in one external database. How can I do that?

My first idea was to query Dynatrace with the metrics API every minute and extract the GC executions / minute for every JVM with this API.

Is this the rigth way to do that?

I the response is "yes", can someone tell me the query to the metrics API to do this.

Thanks in advance!

Josep Maria

1 REPLY 1

Radu
Dynatrace Champion
Dynatrace Champion

Hi Josep,

To get this number you would need to export

builtin:tech.jvm.memory.gc.activationCount

This comes out as a Total Count number. With the Metrics V2 API you have fine grained control over the data. Since you want to split this for all your JVMs you will have to play around with the API to see what works best for the amount of JVMs and the amount of API calls that you make.

Let's break down an example call:

https://xxxxxxxxxxxxxxxx/api/v2/metrics/query?pageSize=10&metricSelector=builtin%3Atech.jvm.memory.g...

I've replaced my environment with the "xxxxxxxx" string.

pageSize - how many entities do you want the results to be returned for (in this case, how many JVMs). You will get a token with your response which you can use to make subsequent API calls to get page by page all the JVMs that this metric is collected for.

metricSelector - the exact string I addeded above (builtin....)

resolution=1m - this ensures that no matter how large the timeframe, you get your results at your desired 1 minute granularity

from=now-3m - this translates to "my timeframe is relative. take the results from the last 3 minutes" and will give me 4 timestamps (incl. the current minute) and data points per JVM. You will need to tailor this because the more you increase the timeframe, the larger the JSON payloads get. If you wanted to get the data for the last 1 minute you would use now-1m and that would give you 2 data points (the last minute, and the current minute).

You can, of course, also use absolute timestamps. In that cause use from and to and set these to the desired time in UTC milliseconds.

I hope this helps.

Let me know if you have any other questions.


Best regards,

Radu

Featured Posts