Skip to content

Commit

Permalink
fix metadata tagging and querying for uploaded archived recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Mar 8, 2024
1 parent 4d37279 commit e376c84
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/main/java/io/cryostat/graphql/ArchivedRecordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public class ArchivedRecordings {
@Query("archivedRecordings")
public TargetNodes.ArchivedRecordings listArchivedRecordings(ArchivedRecordingsFilter filter) {
var r = new TargetNodes.ArchivedRecordings();
r.data = recordingHelper.listArchivedRecordings();
r.data =
recordingHelper
.listArchivedRecordings(filter == null ? null : filter.sourceTarget)
.stream()
.filter(filter)
.toList();
r.aggregate = AggregateInfo.fromArchived(r.data);
return r;
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/io/cryostat/recordings/RecordingHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,12 @@ public List<S3Object> listArchivedRecordingObjects(String jvmId) {
}

@Blocking
public List<ArchivedRecording> listArchivedRecordings(Target target) {
return listArchivedRecordingObjects(target.jvmId).stream()
public List<ArchivedRecording> listArchivedRecordings(String jvmId) {
return listArchivedRecordingObjects(jvmId).stream()
.map(
item -> {
String path = item.key().strip();
String[] parts = path.split("/");
String jvmId = parts[0];
String filename = parts[1];
Metadata metadata =
getArchivedRecordingMetadata(jvmId, filename)
Expand All @@ -606,6 +605,11 @@ public List<ArchivedRecording> listArchivedRecordings(Target target) {
.toList();
}

@Blocking
public List<ArchivedRecording> listArchivedRecordings(Target target) {
return listArchivedRecordings(target.jvmId);
}

public ArchivedRecording archiveRecording(
ActiveRecording activeRecording, String savename, Instant expiry) throws Exception {
// AWS object key name guidelines advise characters to avoid (% so we should not pass url
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/cryostat/recordings/Recordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ public Map<String, Object> upload(
if (rawLabels != null) {
rawLabels.getMap().forEach((k, v) -> labels.put(k, v.toString()));
}
labels.put("jvmId", "uploads");
labels.put("connectUrl", "uploads");
Metadata metadata = new Metadata(labels);
return doUpload(recording, metadata, "uploads");
}
Expand Down

0 comments on commit e376c84

Please sign in to comment.