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(archives): add size field to archived recordings #1077

Merged

Conversation

lkonno
Copy link
Contributor

@lkonno lkonno commented Sep 21, 2022

Fixes #964

  • Added size attribute to ArchivedRecordingInfo;

$ https :8181/api/v1/recordings

  • Added size to graphql query result

http :8181/api/v2.2/graphql query="query { targetNodes { name nodeType labels recordings { archived { data { name metadata {labels} size } aggregate {count size} } } } }"

http :8181/api/v2.2/graphql query="query { archivedRecordings { name downloadUrl reportUrl metadata { labels } size } }"

  • Added the sizeBytesGreaterThanEqual and sizeBytesLessThanEqual filters to both above;

http :8181/api/v2.2/graphql query="query { targetNodes { name nodeType labels recordings { archived (filter:{sizeBytesGreaterThanEqual:2578134}) { data { name metadata {labels} size } aggregate {count size} } } } }"

http :8181/api/v2.2/graphql query="query { archivedRecordings (filter:{sizeBytesGreaterThanEqual:2578134}) { name downloadUrl reportUrl metadata { labels } size } }"

@lkonno lkonno added the feat New feature or request label Sep 21, 2022
@lkonno lkonno changed the title feat(archives): archived recordings size field feat(archives): add size field to archived recordings Sep 21, 2022
@andrewazores
Copy link
Member

$ http :8181/api/v2.2/graphql Authorization:"Basic $(echo user:pass | base64)" query="{ archivedRecordings { aggregate { size count } } }"
HTTP/1.1 200 OK
content-encoding: gzip
content-length: 83
content-type: application/json
vary: origin

{
    "data": {
        "archivedRecordings": {
            "aggregate": {
                "count": 0,
                "size": 0
            }
        }
    }
}
$ http :8181/api/v2.2/graphql Authorization:"Basic $(echo user:pass | base64)" query="query { targetNodes { name recordings { archived { aggregate { count } } }
 } }"
HTTP/1.1 200 OK
content-encoding: gzip
content-length: 137
content-type: application/json
vary: origin

{
    "data": {
        "targetNodes": [
            {
                "name": "service:jmx:rmi:///jndi/rmi://carbon:9091/jmxrmi",
                "recordings": {
                    "archived": {
                        "aggregate": {
                            "count": 0
                        }
                    }
                }
            }
        ]
    }
}

Looks like both queries on archived recordings are working. I made one tiny change locally:

diff --git a/src/main/resources/queries.graphqls b/src/main/resources/queries.graphqls
index 176e24ad..1a90bc0f 100644
--- a/src/main/resources/queries.graphqls
+++ b/src/main/resources/queries.graphqls
@@ -2,5 +2,5 @@ type Query {
     rootNode: EnvironmentNode!
     environmentNodes(filter: EnvironmentNodeFilterInput): [EnvironmentNode!]!
     targetNodes(filter: TargetNodesFilterInput): [TargetNode!]!
-    archivedRecordings(filter: ArchivedRecordingFilterInput): [Archived!]!
+    archivedRecordings(filter: ArchivedRecordingFilterInput): Archived!
 }

:-)

I briefly reviewed the implementation and it's looking good so far. LMK when you're ready for full review.

@lkonno
Copy link
Contributor Author

lkonno commented Sep 22, 2022

Thank you for finding the issue!
I believe it is ready for review now.

@andrewazores
Copy link
Member

andrewazores commented Sep 22, 2022

Rebase the branch and resolve the merge conflict listed below in the automated checks, please.

Copy link
Member

@andrewazores andrewazores left a comment

Choose a reason for hiding this comment

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

I think some of the other example GraphQL queries in https://github.com/cryostatio/cryostat/tree/main/docs/graphql will also need to be updated to match the new data / aggregate structure

Copy link
Member

@andrewazores andrewazores left a comment

Choose a reason for hiding this comment

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

Looks great other than that one small adjustment to a sample query!

@andrewazores
Copy link
Member

Sorry, one last thing I just thought of. Could you update the GraphQLIT integration test to also verify the new size field?

@lkonno
Copy link
Contributor Author

lkonno commented Sep 23, 2022

I updated the archived classes in GraphQLIT and updated the tests containing archived recording to check the size to not be null. Is it fine or do you think that it could be a new test?

@andrewazores
Copy link
Member

I think it's fine as it is, no need to split it into a separate test.

@lkonno
Copy link
Contributor Author

lkonno commented Sep 23, 2022

I forgot to pass the size to query in the last test. I think it is fine now.

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
None yet
Development

Successfully merging this pull request may close these issues.

[Story] Archived recordings should have a visible size field
2 participants