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 environmentNodes #308

Merged
merged 4 commits into from
Feb 29, 2024

Conversation

aali309
Copy link
Contributor

@aali309 aali309 commented Feb 28, 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

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 -O...
  2. $ http --follow -v --auth=user:pass :8080/api/v3/graphql/schema.graphql and ensure new schema contains top-level query and subqueries.
  3. http --follow -v --auth=user:pass :8080/api/v2.2/graphql query='query { environmentNodes(filter: { nodeType: "Realm" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }' change the filter to filter by name i.e http --follow -v --auth=user:pass :8080/api/v2.2/graphql query='query { environmentNodes(filter: { name: "JDP" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }' . If a match is not found you should get empty array for environmentNodes
  • Example of filter by nodeType

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

{
    "query": "query { environmentNodes(filter: { nodeType: \"Real\" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }"
}


HTTP/1.1 308 Permanent Redirect
Content-Encoding: identity
Content-Length: 0
Date: Thu, 29 Feb 2024 02:08:27 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
Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive
Content-Length: 164
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.2

{
    "query": "query { environmentNodes(filter: { nodeType: \"Real\" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }"
}


HTTP/1.1 200 OK
Content-Length: 32
Content-Type: application/json
Date: Thu, 29 Feb 2024 02:08:27 GMT
Gap-Auth: user

{
    "data": {
        "environmentNodes": []
    }
}
❯ http --follow -v --auth=user:pass :8080/api/v2.2/graphql query='query { environmentNodes(filter: { nodeType: "Realm" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }'

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

{
    "query": "query { environmentNodes(filter: { nodeType: \"Realm\" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }"
}


HTTP/1.1 308 Permanent Redirect
Content-Encoding: identity
Content-Length: 0
Date: Thu, 29 Feb 2024 02:08:39 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
Authorization: Basic dXNlcjpwYXNz
Connection: keep-alive
Content-Length: 165
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie/3.2.2

{
    "query": "query { environmentNodes(filter: { nodeType: \"Realm\" }) { id name nodeType labels { key value } children { id name nodeType labels { key value } } } }"
}


HTTP/1.1 200 OK
Content-Length: 6318
Content-Type: application/json
Date: Thu, 29 Feb 2024 02:08:39 GMT
Gap-Auth: user

{
    "data": {
        "environmentNodes": [
            {
                "children": [],
                "id": 2,
                "labels": [],
                "name": "Custom Targets",
                "nodeType": "Realm"
            },
            {
                "children": [
                    {
                        "id": 6,
                        "labels": [],
                        "name": "service:jmx:rmi:///jndi/rmi://cryostat3:9091/jmxrmi",
                        "nodeType": "JVM"
                    }
                ],
                "id": 3,
                "labels": [],
                "name": "JDP",
                "nodeType": "Realm"
            },
            {
                "children": [
                    {
                        "id": 5,
                        "labels": [
                            {
                                "key": "org.jboss.product.openjdk.version",
                                "value": "17"
                            },
                            {
                                "key": "usage",
                                "value": "https://jboss-container-images.github.io/openjdk/"
                            },
                            {
                                "key": "release",
                                "value": "2.1705573231"
                            },
                            {
                                "key": "com.docker.compose.oneoff",
                                "value": "False"
                            },
                            {
                                "key": "io.openshift.tags",
                                "value": "java"
                            },
                            {
                                "key": "io.buildah.version",
                                "value": "1.23.1"
                            },
                            {
                                "key": "io.cryostat.jmxHost",
                                "value": "jfr-datasource"
                            },
                            {
                                "key": "com.docker.compose.config-hash",
                                "value": "33a2a2654afef38517379db3c1afa639b914220a233223bd56bea69cf6923e4e"
                            },
                            {
                                "key": "com.docker.compose.project.config_files",
                                "value": "/home/atali/Desktop/workStation/cryostat3/compose/cryostat.yml,/home/atali/Desktop/workStation/cryostat3/compose/db.yml,/home/atali/Desktop/workStation/cryostat3/compose/cryostat-grafana.yml,/home/atali/Desktop/workStation/cryostat3/compose/jfr-datasource.yml,/home/atali/Desktop/workStation/cryostat3/compose/auth_proxy.yml,/home/atali/Desktop/workStation/cryostat3/compose/s3-seaweed.yml"
                            },
                            {
                                "key": "com.redhat.component",
                                "value": "openjdk-17-runtime-ubi8-container"
                            },
                            {
                                "key": "distribution-scope",
                                "value": "public"
                            },
                            {
                                "key": "com.docker.compose.version",
                                "value": "1.29.2"
                            },
                            {
                                "key": "summary",
                                "value": "Image for Red Hat OpenShift providing OpenJDK 17 runtime"
                            },
                            {
                                "key": "io.openshift.expose-services",
                                "value": ""
                            },
                            {
                                "key": "version",
                                "value": "1.18"
                            },
                            {
                                "key": "name",
                                "value": "ubi8/openjdk-17-runtime"
                            },
                            {
                                "key": "com.docker.compose.container-number",
                                "value": "1"
                            },
                            {
                                "key": "maintainer",
                                "value": "Red Hat OpenJDK <openjdk@redhat.com>"
                            },
                            {
                                "key": "org.jboss.product.version",
                                "value": "17"
                            },
                            {
                                "key": "url",
                                "value": "https://access.redhat.com/containers/#/registry.access.redhat.com/ubi8/openjdk-17-runtime/images/1.18-2.1705573231"
                            },
                            {
                                "key": "com.docker.compose.project.working_dir",
                                "value": "/home/atali/Desktop/workStation/cryostat3/compose"
                            },
                            {
                                "key": "vendor",
                                "value": "Red Hat, Inc."
                            },
                            {
                                "key": "architecture",
                                "value": "x86_64"
                            },
                            {
                                "key": "io.k8s.display-name",
                                "value": "Java Applications"
                            },
                            {
                                "key": "org.jboss.product",
                                "value": "openjdk"
                            },
                            {
                                "key": "io.cekit.version",
                                "value": "4.9.1"
                            },
                            {
                                "key": "description",
                                "value": "Image for Red Hat OpenShift providing OpenJDK 17 runtime"
                            },
                            {
                                "key": "io.k8s.description",
                                "value": "Platform for running plain Java applications (fat-jar and flat classpath)"
                            },
                            {
                                "key": "vcs-ref",
                                "value": "12aac04fffa038f171574a2c3f057a2c253f5c27"
                            },
                            {
                                "key": "vcs-type",
                                "value": "git"
                            },
                            {
                                "key": "org.opencontainers.image.documentation",
                                "value": "https://jboss-container-images.github.io/openjdk/"
                            },
                            {
                                "key": "kompose.service.expose",
                                "value": "jfr-datasource"
                            },
                            {
                                "key": "com.redhat.license_terms",
                                "value": "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"
                            },
                            {
                                "key": "com.docker.compose.project",
                                "value": "compose"
                            },
                            {
                                "key": "com.docker.compose.service",
                                "value": "jfr-datasource"
                            },
                            {
                                "key": "build-date",
                                "value": "2024-01-18T10:36:52"
                            },
                            {
                                "key": "io.cryostat.jmxPort",
                                "value": "11223"
                            },
                            {
                                "key": "io.cryostat.discovery",
                                "value": "true"
                            }
                        ],
                        "name": "service:jmx:rmi:///jndi/rmi://jfr-datasource:11223/jmxrmi",
                        "nodeType": "JVM"
                    },
                    {
                        "id": 7,
                        "labels": [
                            {
                                "key": "maintainer",
                                "value": "Red Hat OpenJDK <openjdk@redhat.com>"
                            },
                            {
                                "key": "org.jboss.product.version",
                                "value": "17"
                            },
                            {
                                "key": "distribution-scope",
                                "value": "public"
                            },
                            {
                                "key": "io.cryostat.jmxHost",
                                "value": "localhost"
                            },
                            {
                                "key": "vendor",
                                "value": "Red Hat, Inc."
                            },
                            {
                                "key": "description",
                                "value": "Image for Red Hat OpenShift providing OpenJDK 17 runtime"
                            },
                            {
                                "key": "org.jboss.product",
                                "value": "openjdk"
                            },
                            {
                                "key": "vcs-type",
                                "value": "git"
                            },
                            {
                                "key": "com.docker.compose.oneoff",
                                "value": "False"
                            },
                            {
                                "key": "name",
                                "value": "ubi8/openjdk-17-runtime"
                            },
                            {
                                "key": "io.openshift.expose-services",
                                "value": ""
                            },
                            {
                                "key": "io.cryostat.jmxUrl",
                                "value": "service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi"
                            },
                            {
                                "key": "com.redhat.component",
                                "value": "openjdk-17-runtime-ubi8-container"
                            },
                            {
                                "key": "com.docker.compose.config-hash",
                                "value": "7f5dc61b0d3d865d31e751ba97fee9634472c754802e78484f4ed61c23d6b43b"
                            },
                            {
                                "key": "url",
                                "value": "https://access.redhat.com/containers/#/registry.access.redhat.com/ubi8/openjdk-17-runtime/images/1.18-2.1705573231"
                            },
                            {
                                "key": "com.docker.compose.project",
                                "value": "compose"
                            },
                            {
                                "key": "com.docker.compose.project.working_dir",
                                "value": "/home/atali/Desktop/workStation/cryostat3/compose"
                            },
                            {
                                "key": "summary",
                                "value": "Image for Red Hat OpenShift providing OpenJDK 17 runtime"
                            },
                            {
                                "key": "release",
                                "value": "2.1705573231"
                            },
                            {
                                "key": "io.cryostat.jmxPort",
                                "value": "0"
                            },
                            {
                                "key": "usage",
                                "value": "https://jboss-container-images.github.io/openjdk/"
                            },
                            {
                                "key": "kompose.service.expose",
                                "value": "cryostat3"
                            },
                            {
                                "key": "io.k8s.description",
                                "value": "Platform for running plain Java applications (fat-jar and flat classpath)"
                            },
                            {
                                "key": "io.k8s.display-name",
                                "value": "Java Applications"
                            },
                            {
                                "key": "architecture",
                                "value": "x86_64"
                            },
                            {
                                "key": "version",
                                "value": "1.18"
                            },
                            {
                                "key": "io.openshift.tags",
                                "value": "java"
                            },
                            {
                                "key": "org.jboss.product.openjdk.version",
                                "value": "17"
                            },
                            {
                                "key": "com.docker.compose.container-number",
                                "value": "1"
                            },
                            {
                                "key": "build-date",
                                "value": "2024-01-18T10:36:52"
                            },
                            {
                                "key": "io.cryostat.discovery",
                                "value": "true"
                            },
                            {
                                "key": "com.docker.compose.project.config_files",
                                "value": "/home/atali/Desktop/workStation/cryostat3/compose/cryostat.yml,/home/atali/Desktop/workStation/cryostat3/compose/db.yml,/home/atali/Desktop/workStation/cryostat3/compose/cryostat-grafana.yml,/home/atali/Desktop/workStation/cryostat3/compose/jfr-datasource.yml,/home/atali/Desktop/workStation/cryostat3/compose/auth_proxy.yml,/home/atali/Desktop/workStation/cryostat3/compose/s3-seaweed.yml"
                            },
                            {
                                "key": "com.redhat.license_terms",
                                "value": "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI"
                            },
                            {
                                "key": "com.docker.compose.service",
                                "value": "cryostat"
                            },
                            {
                                "key": "io.buildah.version",
                                "value": "1.33.5"
                            },
                            {
                                "key": "vcs-ref",
                                "value": "12aac04fffa038f171574a2c3f057a2c253f5c27"
                            },
                            {
                                "key": "io.cekit.version",
                                "value": "4.9.1"
                            },
                            {
                                "key": "org.opencontainers.image.documentation",
                                "value": "https://jboss-container-images.github.io/openjdk/"
                            },
                            {
                                "key": "io.cryostat.component",
                                "value": "cryostat3"
                            },
                            {
                                "key": "com.docker.compose.version",
                                "value": "1.29.2"
                            }
                        ],
                        "name": "service:jmx:rmi:///jndi/rmi://localhost:0/jmxrmi",
                        "nodeType": "JVM"
                    }
                ],
                "id": 4,
                "labels": [],
                "name": "Podman",
                "nodeType": "Realm"
            }
        ]
    }
}

@aali309 aali309 added the feat New feature or request label Feb 28, 2024
Copy link

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

@aali309 aali309 changed the title feat(graphql): implement environmentNode query feat(graphql): add top-level query for environmentNodes Feb 28, 2024
@aali309 aali309 marked this pull request as ready for review February 29, 2024 02:21
@aali309 aali309 requested a review from a team as a code owner February 29, 2024 02:21
@aali309 aali309 requested a review from andrewazores February 29, 2024 02:21
@aali309
Copy link
Contributor Author

aali309 commented Feb 29, 2024

/build_test

Copy link

You do not have permission to run the /build_test command. Please ask @cryostatio/reviewers
to resolve the issue.

@andrewazores
Copy link
Member

/build_test

Copy link

Workflow started at 2/29/2024, 12:05:18 AM. View Actions Run.

Copy link

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

Copy link

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

@andrewazores andrewazores merged commit fcc623f into cryostatio:graphql Feb 29, 2024
7 checks passed
@aali309 aali309 deleted the environmentNodes branch March 6, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants