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

feat(graphql): add top-level query for targetNodes #307

Merged
merged 22 commits into from
Feb 29, 2024

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Feb 27, 2024

Welcome to Cryostat3! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Based on #294
Depends on cryostatio/cryostat-core#357
Depends on cryostatio/cryostat-core#358
Depends on #310

Description of the change:

This change allows an environment variable to be configured so that...

Motivation for the change:

This change is helpful because users may want to...

How to manually test:

  1. Run CRYOSTAT_IMAGE=quay.io... bash smoketest.bash...
  2. $ http --follow -v --auth=user:pass :8080/api/v3/graphql/schema.graphql and ensure new schema contains top-level query and subqueries
  3. Open web UI, select localhost:0 target, archive both recordings. Wait a short while, then archive both again.
  4. $ http --follow -v --auth=user:pass :8080/api/v2.2/graphql query='query { targetNodes { target { connectUrl jvmId recordings { active { aggregate { count } data { name } } archived { aggregate { count size } data { name } } } } } }'
$ http --follow -v --auth=user:pass :8080/api/v2.2/graphql query='query { targetNodes { target { connectUrl jvmId recordings { active { aggregate { count } data { name } } archived { aggregate { count size } data { name size } } } } } }'
POST /api/v2.2/graphql HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, br
Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive
Content-Length: 183
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.2

{
    "query": "query { targetNodes { target { connectUrl jvmId recordings { active { aggregate { count } data { name } } archived { aggregate { count size } data { name size } } } } } }"
}


HTTP/1.1 308 Permanent Redirect
Content-Encoding: identity
Content-Length: 0
Date: Tue, 27 Feb 2024 19:53:00 GMT
Gap-Auth: user
Location: http://localhost:8080/api/v3/graphql



POST /api/v3/graphql HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, br
Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive
Content-Length: 183
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.2

{
    "query": "query { targetNodes { target { connectUrl jvmId recordings { active { aggregate { count } data { name } } archived { aggregate { count size } data { name size } } } } } }"
}


HTTP/1.1 200 OK
Content-Length: 870
Content-Type: application/json
Date: Tue, 27 Feb 2024 19:53:00 GMT
Gap-Auth: user

{
    "data": {
        "targetNodes": [
            {
                "target": {
                    "connectUrl": "service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi",
                    "jvmId": "l7nbjOnSzkgpICnAWAsJ3T4nnNUHL1fLkEwFImQW1OQ=",
                    "recordings": {
                        "active": {
                            "aggregate": {
                                "count": 2
                            },
                            "data": [
                                {
                                    "name": "onstart"
                                },
                                {
                                    "name": "startup"
                                }
                            ]
                        },
                        "archived": {
                            "aggregate": {
                                "count": 4,
                                "size": 15707814
                            },
                            "data": [
                                {
                                    "name": "compose-cryostat-1_onstart_20240227T195230Z.jfr",
                                    "size": 3841100
                                },
                                {
                                    "name": "compose-cryostat-1_onstart_20240227T195239Z.jfr",
                                    "size": 4791696
                                },
                                {
                                    "name": "compose-cryostat-1_startup_20240227T195230Z.jfr",
                                    "size": 3537509
                                },
                                {
                                    "name": "compose-cryostat-1_startup_20240227T195239Z.jfr",
                                    "size": 3537509
                                }
                            ]
                        }
                    }
                }
            },
            {
                "target": {
                    "connectUrl": "service:jmx:rmi:///jndi/rmi://jfr-datasource:11223/jmxrmi",
                    "jvmId": "AJUhBprW6p1h8oaU2hGToT0ejRahSC_jplYUzIxCsa0=",
                    "recordings": {
                        "active": {
                            "aggregate": {
                                "count": 0
                            },
                            "data": []
                        },
                        "archived": {
                            "aggregate": {
                                "count": 0,
                                "size": 0
                            },
                            "data": []
                        }
                    }
                }
            }
        ]
    }
}

$ http --follow -v --auth=user:pass :8080/api/v2.2/graphql query='query { targetNodes { target { connectUrl jvmId recordings { active(filter: { names: ["onstart"] }) { aggregate { count } data { name startTime id remoteId metadata { labels { key value } } } } archived { aggregate { count size } data { name size } } } } } }'
POST /api/v2.2/graphql HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, br
Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive
Content-Length: 273
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.2

{
    "query": "query { targetNodes { target { connectUrl jvmId recordings { active(filter: { names: [\"onstart\"] }) { aggregate { count } data { name startTime id remoteId metadata { labels { key value } } } } archived { aggregate { count size } data { name size } } } } } }"
}


HTTP/1.1 308 Permanent Redirect
Content-Encoding: identity
Content-Length: 0
Date: Tue, 27 Feb 2024 20:26:33 GMT
Gap-Auth: user
Location: http://localhost:8080/api/v3/graphql



POST /api/v3/graphql HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, br
Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive
Content-Length: 273
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.2

{
    "query": "query { targetNodes { target { connectUrl jvmId recordings { active(filter: { names: [\"onstart\"] }) { aggregate { count } data { name startTime id remoteId metadata { labels { key value } } } } archived { aggregate { count size } data { name size } } } } } }"
}


HTTP/1.1 200 OK
Content-Length: 620
Content-Type: application/json
Date: Tue, 27 Feb 2024 20:26:33 GMT
Gap-Auth: user

{
    "data": {
        "targetNodes": [
            {
                "target": {
                    "connectUrl": "service:jmx:rmi:///jndi/rmi://jfr-datasource:11223/jmxrmi",
                    "jvmId": "EAN-0a170eS7CZfGI1zeBY3pECQvKF8BXc3_3hzlLl8=",
                    "recordings": {
                        "active": {
                            "aggregate": {
                                "count": 0
                            },
                            "data": []
                        },
                        "archived": {
                            "aggregate": {
                                "count": 0,
                                "size": 0
                            },
                            "data": []
                        }
                    }
                }
            },
            {
                "target": {
                    "connectUrl": "service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi",
                    "jvmId": "RG5KydIvRsZ3lJV57s5TZ5duoXZFWwDt2kS25C9FehU=",
                    "recordings": {
                        "active": {
                            "aggregate": {
                                "count": 1
                            },
                            "data": [
                                {
                                    "id": 1,
                                    "metadata": {
                                        "labels": []
                                    },
                                    "name": "onstart",
                                    "remoteId": 1,
                                    "startTime": 1709065431004
                                }
                            ]
                        },
                        "archived": {
                            "aggregate": {
                                "count": 0,
                                "size": 0
                            },
                            "data": []
                        }
                    }
                }
            }
        ]
    }
}

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@andrewazores andrewazores added feat New feature or request safe-to-test labels Feb 27, 2024
@andrewazores
Copy link
Member Author

/build_test

Copy link

Workflow started at 2/28/2024, 3:05:15 PM. View Actions Run.

Copy link

CI build and push: All tests pass ✅ (JDK21)
https://github.com/cryostatio/cryostat3/actions/runs/8086386692

Copy link

CI build and push: All tests pass ✅ (JDK17)
https://github.com/cryostatio/cryostat3/actions/runs/8086386692

@andrewazores
Copy link
Member Author

/build_test

Copy link

Workflow started at 2/29/2024, 2:28:25 PM. View Actions Run.

Copy link

CI build and push: All tests pass ✅ (JDK21)
https://github.com/cryostatio/cryostat3/actions/runs/8101544669

@andrewazores andrewazores marked this pull request as ready for review February 29, 2024 19:33
Copy link

CI build and push: All tests pass ✅ (JDK17)
https://github.com/cryostatio/cryostat3/actions/runs/8101544669

Copy link
Contributor

@aali309 aali309 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@andrewazores andrewazores merged commit abbc171 into cryostatio:graphql Feb 29, 2024
7 of 8 checks passed
@andrewazores andrewazores deleted the graphql-targetnodes branch February 29, 2024 22:00
andrewazores added a commit that referenced this pull request Mar 4, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit that referenced this pull request Mar 7, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit that referenced this pull request Mar 11, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit to andrewazores/cryostat3 that referenced this pull request Mar 20, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit that referenced this pull request Mar 20, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit to andrewazores/cryostat3 that referenced this pull request Mar 20, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit that referenced this pull request Mar 20, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit that referenced this pull request Mar 22, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
andrewazores added a commit that referenced this pull request Apr 13, 2024
* feat(graphql): add top-level query for targetNodes

* return targets with distinct JVM IDs, implement archived recordings query

* implement active recordings query

* refactor enum registration

* implement subqueries (actually nested mutations) for doStartRecording and doSnapshot

* add mbeanMetrics query

* messaging server uses shared ObjectMapper

* add Jackson serialization customizer so Map<String, String> is encoded the same way GraphQL extension does
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants