# Java APM1.41.0 JVM used is Zero

**URL:** <https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218>\
**Category:** APM\
**Tags:** java\
**Created:** [August 7, 2023, 3:50am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218 "2023-08-07T03:50:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zt9788](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zt9788/32/113887_2.png) [@zt9788](https://discuss.elastic.co/u/zt9788)\
**Post date:** [August 7, 2023, 3:50am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/1 "2023-08-07T03:50:25Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/1/1/111fabddc8a98579df613fceab9887d8ca5c1fe9.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/1/811898bedd8d41ac5da10f2e911845e00c4db901.png)

1.38.0 can catch the jvm used  
Programs typically use around 200-300M of heap memory  
Non-Heap memory is 260~320M in 1.38.0 befor

**JDK** :  
JDK17.0.8

**Kibana version** :  
7.13.2  
**Elasticsearch version** :  
7.13.2  
**APM Server version** :  
7.13.2

**APM Agent language and version** :  
1.41.0

---

<div class="post-metadata">

**Author:** ![zt9788](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zt9788/32/113887_2.png) [@zt9788](https://discuss.elastic.co/u/zt9788)\
**Post date:** [August 8, 2023, 2:35am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/2 "2023-08-08T02:35:41Z")

</div>

Hi, i try the new **1.41.1** but the displayed data is still incorrect  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb9b8e71fa668170566139468e0e16d633be06e5.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/9/d9f3881c4b6d50171a409342b4b948d8d8e6703a.png)  
It seems that the data is exactly 10 times different

---

<div class="post-metadata">

**Author:** ![zt9788](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zt9788/32/113887_2.png) [@zt9788](https://discuss.elastic.co/u/zt9788)\
**Post date:** [August 8, 2023, 6:28am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/3 "2023-08-08T06:28:37Z")

</div>

the bug is the same with [Bug: APM Java - Springboot, v1.39.0+ - No JVM Metrics Found - #12 by Jonas\_Kunz](https://discuss.elastic.co/t/bug-apm-java-springboot-v1-39-0-no-jvm-metrics-found/339104/12)

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [August 8, 2023, 8:03am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/4 "2023-08-08T08:03:17Z")

</div>

Hi,

I've tried to reproduce with the same stack version and Java agent version and it seems that metrics are properly captured, however, the rounding in the UI could definitely cause some confusion here as overlay is shown with the biggest unit (here GB).

- you likely have set a limit to 1.3gb with `-Xmx`, thus the overlay uses gigabyte as units.
- the application currently have a very small usage of heap (less than 100mb), thus it gets rounded to `0.0 GB` in the overlay.

Could you try to let the application run for a while with some activity so we can see how does the metrics look like when the heap usage goes over 100mb ?  
Alternatively, could you try to remove the `-Xmx` argument from your JVM ? with that the heap usage should be shown in megabytes instead of gigabytes, hence there shouldn't be any rounding here.

---

<div class="post-metadata">

**Author:** ![zt9788](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zt9788/32/113887_2.png) [@zt9788](https://discuss.elastic.co/u/zt9788)\
**Post date:** [August 8, 2023, 10:21am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/5 "2023-08-08T10:21:27Z")

</div>

I try another program.

This does not use the `disable_metrics` parameter, XMX3250  
And the Programe is running more then one hour(used about 700M memory+-)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/5/554f7f62a7863f28bf0b01a6c458b98352914018.png)

* * *

this is use the `-Delastic.apm.disable_metrics=jvm.fd.*,jvm.memory.non_heap.pool.* `  
XMX=3086, used 500M~2G

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/c/cc49215453a6f4f1b0d2066e5611b8a84dee113f.png)  
JVM

```auto
-Xms1024m -Xmx3086m
-XX:+UseContainerSupport 
-XX:MinRAMPercentage=50.0 -XX:MaxRAMPercentage=80.0 
-Delastic.apm.log_level=ERROR 
-Delastic.apm.disable_metrics=jvm.fd.*,jvm.memory.non_heap.pool.* 
-Delastic.apm.service_node_name=xxx
-Delastic.apm.service_name=xxxxx
-Delastic.apm.transaction_sample_rate=0.8

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/e/dedd091a02a9485c01ea50cdb8c7a9376a36c134.png)

I deploy it in a container, and in order to prevent memory overflow, XMX is calculated. In the production environment, I am currently afraid to delete XMX

## There also can not display jvm used

this is apm 1.38.0

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/5/9528668f3921b8f7b49e2c3a96677c9ad7902846.png)  
the data is same with the jmap

* * *

I will run it for a day first to see if there will be any changes when the usage exceeds 1G

---

<div class="post-metadata">

**Author:** ![zt9788](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zt9788/32/113887_2.png) [@zt9788](https://discuss.elastic.co/u/zt9788)\
**Post date:** [August 9, 2023, 5:37am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/6 "2023-08-09T05:37:35Z")

</div>

I search the apm-metric index  
when apm is 1.38.0  
the promram real used about 1.9G

```auto
"non_heap" : {
      "committed" : 3.74669312E8,
      "max" : 9.77272832E8,
      "used" : 3.663926E8
    },
    "heap" : {
      "committed" : 2.76824064E9,
      "max" : 3.235905536E9,
      "used" : 1.956814336E9
    }

```

when apm is 1.41.x  
the program real used 1.2G ` used = 1078312208 (1028.358657836914MB)`  
but data is `3.45344E7` used

```auto
    "non_heap" : {
      "committed" : 3.4930688E7,
      "max" : 9.89855744E8,
      "used" : 3.1833088E7
    },
    "heap" : {
      "committed" : 1.077936128E9,
      "max" : 3.235905536E9,
      "used" : 3.45344E7
    }

```

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [August 9, 2023, 1:02pm UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/7 "2023-08-09T13:02:07Z")

</div>

Hi,

I've managed to reproduce it, and that's due to a regression introduced in 1.39.0 which hasn't been reported yet, so congrats for catching this !

I've opened [Fix JVM memory metrics regression by SylvainJuge · Pull Request #3279 · elastic/apm-agent-java · GitHub](https://github.com/elastic/apm-agent-java/pull/3279) to fix it and it's already merged thus will be included in the next release.

So in your case you should either:

- keep using 1.38.0 until next release is available
- use the snapshot that includes the bugfix: [GitHub - elastic/apm-agent-java: Elastic APM Java Agent](https://github.com/elastic/apm-agent-java#snapshots)

---

<div class="post-metadata">

**Author:** ![zt9788](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zt9788/32/113887_2.png) [@zt9788](https://discuss.elastic.co/u/zt9788)\
**Post date:** [August 10, 2023, 2:00am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/8 "2023-08-10T02:00:08Z")

</div>

Thank you very much. Using the snapshot version, the issue has been corrected

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 7, 2023, 2:00am UTC](https://discuss.elastic.co/t/java-apm1-41-0-jvm-used-is-zero/340218/9 "2023-09-07T02:00:26Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
