-
Notifications
You must be signed in to change notification settings - Fork 31
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(recordings): Add recording metadata labels #835
Conversation
src/main/java/io/cryostat/recordings/RecordingMetadataManager.java
Outdated
Show resolved
Hide resolved
0591355
to
7311a77
Compare
3afbb7c
to
41cee2c
Compare
src/main/java/io/cryostat/net/web/http/api/v2/HttpApiV2Module.java
Outdated
Show resolved
Hide resolved
src/main/java/io/cryostat/net/web/http/api/v2/RecordingMetadataPatchHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/io/cryostat/net/web/http/api/v2/TargetRecordingMetadataPatchHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/io/cryostat/net/web/http/api/v2/RecordingMetadataPatchHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/io/cryostat/net/web/http/api/v2/RecordingMetadataPatchHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, thanks for all this! Other than the small details I've left comments about, I have one higher-level internal implementation detail concern here. It seems that the API is defined to accept the labels as a string, but that string must be a JSON object/map. But, internally, the labels are passed around as the raw String, and when included in an API response (as a serialized recording descriptor), the labels field is actually again simply a String that has contents that appear to be JSON - but it will be wrapped in double quotes in the response as a String, not an actual JSON object.
I think it would be best to parse the client's request body as JSON right away in the handlers/manager, expecting it to be mappable to a Java Map<String, String>
. If it isn't then that is a 400
response. If it does, then the labels object that is passed around internally should be the Map, and this is also what should be kept as a field reference in the serializable recording descriptor. This can still be serialized to JSON for storage on disk, and when included as an API response as a serialized recording descriptor, it will be nicely embedded as a JSON object/map rather than a String that looks like further encoded JSON.
src/test/java/io/cryostat/net/web/http/api/beta/TargetRecordingMetadataPatchHandlerTest.java
Outdated
Show resolved
Hide resolved
28f8bce
to
f12e311
Compare
src/main/java/io/cryostat/recordings/RecordingMetadataManager.java
Outdated
Show resolved
Hide resolved
src/main/java/io/cryostat/net/web/http/api/beta/RecordingMetadataPatchBodyHandler.java
Outdated
Show resolved
Hide resolved
ca7468a
to
85ba750
Compare
src/main/java/io/cryostat/jmc/serialization/HyperlinkedSerializableRecordingDescriptor.java
Show resolved
Hide resolved
src/main/java/io/cryostat/jmc/serialization/HyperlinkedSerializableRecordingDescriptor.java
Outdated
Show resolved
Hide resolved
src/main/java/io/cryostat/jmc/serialization/HyperlinkedSerializableRecordingDescriptor.java
Show resolved
Hide resolved
Code looks good. Could you update HTTP_API.md? |
rebase please |
9482517
to
3752198
Compare
Latest build failure caused by
|
Related #709
Depends on cryostatio/cryostat-web#383
Adds a patch handler and helper functions to optionally add labels when starting a recording on a target. The patch handler is used for editing labels for existing active or archived recordings.