# Resolve JVM GC Collection Time and Count Discrepancies Using DQL

**URL:** <https://community.dynatrace.com/t/resolve-jvm-gc-collection-time-and-count-discrepancies-using-dql/50205>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed\
**Created:** [February 11, 2025, 1:40pm UTC](https://community.dynatrace.com/t/resolve-jvm-gc-collection-time-and-count-discrepancies-using-dql/50205 "2025-02-11T13:40:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![koushickpatel](https://avatars.discourse-cdn.com/v4/letter/k/df705f/32.png) [@koushickpatel](https://community.dynatrace.com/u/koushickpatel)\
**Post date:** [February 11, 2025, 1:40pm UTC](https://community.dynatrace.com/t/resolve-jvm-gc-collection-time-and-count-discrepancies-using-dql/50205/1 "2025-02-11T13:40:42Z")

</div>

Hi,

I am trying set up a query for&nbsp;jvm gc.collection\_time &&nbsp;gc.collection\_count.

timeseries avg(dt.runtime.jvm.gc.collection\_time), by: { host.name }, filter: { (host.name == xxxx)}

timeseries avg(dt.runtime.jvm.gc.collection\_count), by: { host.name }, filter: { (host.name == xxxx)}

My value are not matching when&nbsp; check from comand line using&nbsp;jstat

garbage collection count&nbsp;70164  
garbage collection time&nbsp;1182.307

 ![koushickpatel_0-1739281134872.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/6/b6d30d4606d7cfc2a3e758db787abcb44783a39a.png)

where as in dyntrace the value are not even close

 ![koushickpatel_1-1739281223281.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/f/bfd6346427fd4c88ce7b6db64f6f960760350d74.png)

---

<div class="post-metadata">

**Author:** ![AravindhanV](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@AravindhanV](https://community.dynatrace.com/u/AravindhanV)\
**Post date:** [February 17, 2025, 8:58am UTC](https://community.dynatrace.com/t/resolve-jvm-gc-collection-time-and-count-discrepancies-using-dql/50205/2 "2025-02-17T08:58:16Z")

</div>

hiya,

Looking with your timeseries metric configuration, its understood that you are using the average to calculate the GC count and time. whereas with the jstat command it will be more of sum or the sum of samples. So, would recommend to change the aggregation&nbsp; to sum and validate once.

**timeseries sum** instead of&nbsp; **timeseries avg**

Thanks

---

<div class="post-metadata">

**Author:** ![koushickpatel](https://avatars.discourse-cdn.com/v4/letter/k/df705f/32.png) [@koushickpatel](https://community.dynatrace.com/u/koushickpatel)\
**Post date:** [February 17, 2025, 3:57pm UTC](https://community.dynatrace.com/t/resolve-jvm-gc-collection-time-and-count-discrepancies-using-dql/50205/3 "2025-02-17T15:57:03Z")

</div>

We tried sum but the value is still not matching

---

<div class="post-metadata">

**Author:** ![izabelarokita](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/izabelarokita/32/41812_2.png) [@izabelarokita](https://community.dynatrace.com/u/izabelarokita)\
**Post date:** [December 18, 2025, 12:36pm UTC](https://community.dynatrace.com/t/resolve-jvm-gc-collection-time-and-count-discrepancies-using-dql/50205/4 "2025-12-18T12:36:23Z")

</div>

Hey&nbsp;[@koushickpatel](https://community.dynatrace.com/user/84483)&nbsp;,  
I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you!&nbsp;:blush:  
Please let me know what works best for you.
