cryostatio / cryostat-web

Web front-end for Cryostat: Secure JDK Flight Recorder management for containerized JVMs
https://cryostat.io/
Other
10 stars 20 forks source link

[Bug] Topology and Match Expressions cannot use target `agent` field #1320

Closed andrewazores closed 2 months ago

andrewazores commented 2 months ago

Current Behavior

Target objects from the API have the following form:

                    "target": {
                        "agent": true,
                        "alias": "agent-test",
                        "annotations": {
                            "cryostat": [
                                {
                                    "key": "PID",
                                    "value": "1"
                                },
                                {
                                    "key": "HOST",
                                    "value": "quarkus-cryostat-agent-848c95489d-98kq4"
                                },
                                {
                                    "key": "PORT",
                                    "value": "9977"
                                },
                                {
                                    "key": "REALM",
                                    "value": "agent-test"
                                },
                                {
                                    "key": "JAVA_MAIN",
                                    "value": "/deployments/quarkus-run.jar"
                                },
                                {
                                    "key": "START_TIME",
                                    "value": "1723211328"
                                }
                            ],
                            "platform": [
                                {
                                    "key": "INSTANCE_ID",
                                    "value": "d57e346c-4624-4394-86e7-ef13233810de"
                                }
                            ]
                        },
                        "connectUrl": "http://10.217.1.165:9977",
                        "id": 14,
                        "jvmId": "b7r2b0iahFQrwV7HSSgPtw-Iyufb5bVQOuaJ9bnSO1E=",
                        "labels": []
                    }

The Match Expression evaluator provides a view of this object to the expression script engine:

https://github.com/cryostatio/cryostat/blob/67a09a50011f3079bf2f6e1382bf055a4cae84b6/src/main/java/io/cryostat/expressions/MatchExpressionEvaluator.java#L225

The isAgent()/agent accessor/field should be available here as well, so that the UI can use this for determining how to render the Topology node icons.

The server should also accept Match Expressions using this field.

Expected Behavior

No response

Steps To Reproduce

No response

Environment

No response

Anything else?

No response