Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GraphQL MBeanMetrics query always returns heapMemoryUsagePercent of min value #649

Open
andrewazores opened this issue Sep 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@andrewazores
Copy link
Member

andrewazores commented Sep 16, 2024

Current Behavior

$ https --auth=user:pass :8443/api/v3/graphql query=" query MBeanMXMetricsForTarget { targetNodes(filter: { targetIds: [2] }) { target { mbeanMetrics { os { processCpuLoad systemLoadAverage systemCpuLoad freePhysicalMemorySize totalPhysicalMemorySize } memory { heapMemoryUsagePercent heapMemoryUsage{ used } nonHeapMemoryUsage{ used } } thread { daemonThreadCount threadCount } } } } }"
HTTP/1.1 200 OK
Content-Length: 372
Content-Type: application/json
Date: Mon, 16 Sep 2024 15:30:36 GMT
Gap-Auth: user

{
    "data": {
        "targetNodes": [
            {
                "target": {
                    "mbeanMetrics": {
                        "memory": {
                            "heapMemoryUsage": {
                                "used": 61191560
                            },
                            "heapMemoryUsagePercent": 5e-324,
                            "nonHeapMemoryUsage": {
                                "used": 191325384
                            }
                        },
                        "os": {
                            "freePhysicalMemorySize": 61353984,
                            "processCpuLoad": 0.01,
                            "systemCpuLoad": 0.0,
                            "systemLoadAverage": 0.73,
                            "totalPhysicalMemorySize": 536870912
                        },
                        "thread": {
                            "daemonThreadCount": 67,
                            "threadCount": 98
                        }
                    }
                }
            }
        ]
    }
}

This is the query and response from the Cryostat Web "MBean Metrics" dashboard layout template.

Other queries are seemingly working as intended, but the heapMemoryUsagePercent always returns this almost-0 value: "heapMemoryUsagePercent": 5e-324,.

Expected Behavior

This query should either return a sensible value, or else it should be removed from the API if the value can no longer be sourced or calculated.

I guess that this behaviour likely changed in cryostatio/cryostat-core#362 . Maybe there are some leads there to figure out if or how the behaviour changed on the JMC side.

Steps To Reproduce

No response

Environment

No response

Anything else?

The other keys in the memory query, ex. heapMemoryUsage or nonHeapMemoryUsage, correspond to MemoryMXBean attributes. heapMemoryUsagePercent does not.

I believe this pseudo-attribute was previously injected by JMC code:

https://stackoverflow.com/questions/68813986/how-heapmemoryusagepercent-is-calculated-in-jdk-mission-control-jmc

In Cryostat Core, if this attribute is not present, we default it to the Double.MIN_VALUE:

$ jshell
|  Welcome to JShell -- Version 17.0.12
|  For an introduction type: /help intro

jshell> Double.MIN_VALUE
$1 ==> 4.9E-324
@andrewazores andrewazores added the bug Something isn't working label Sep 16, 2024
@Josh-Matsuoka Josh-Matsuoka self-assigned this Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

2 participants