Skip to content

Commit

Permalink
disable JVM ID node filtering, populate archived recordings query wit…
Browse files Browse the repository at this point in the history
…h data
  • Loading branch information
andrewazores committed Mar 1, 2024
1 parent 4679303 commit 4140f74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 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,7 @@ public class ArchivedRecordings {
@Query("archivedRecordings")
public TargetNodes.ArchivedRecordings listArchivedRecordings(ArchivedRecordingsFilter filter) {
var r = new TargetNodes.ArchivedRecordings();
r.data = List.of();
r.data = recordingHelper.listArchivedRecordings();
r.aggregate = new AggregateInfo();
r.aggregate.size = 0;
r.aggregate.count = r.data.size();
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/io/cryostat/graphql/TargetNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;

import org.openjdk.jmc.common.unit.QuantityConversionException;
Expand Down Expand Up @@ -101,16 +98,19 @@ public List<DiscoveryNode> getTargetNodes(DiscoveryNodeFilter filter) {
// load the entire discovery tree out of the database, then perform the filtering at the
// application level.
return Target.<Target>findAll().stream()
.filter(distinctWith(t -> t.jvmId))
// FIXME filtering by distinct JVM ID breaks clients that expect to be able to use a
// different connection URL (in the node filter or for client-side filtering) than
// the one we end up selecting for here.
// .filter(distinctWith(t -> t.jvmId))
.map(t -> t.discoveryNode)
.filter(n -> filter == null ? true : filter.test(n))
.toList();
}

private static <T> Predicate<T> distinctWith(Function<? super T, ?> fn) {
Set<Object> observed = ConcurrentHashMap.newKeySet();
return t -> observed.add(fn.apply(t));
}
// private static <T> Predicate<T> distinctWith(Function<? super T, ?> fn) {
// Set<Object> observed = ConcurrentHashMap.newKeySet();
// return t -> observed.add(fn.apply(t));
// }

@Blocking
@Description("Get the active and archived recordings belonging to this target")
Expand Down

0 comments on commit 4140f74

Please sign in to comment.