Skip to content

Commit

Permalink
do not perform node query in toString
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Oct 17, 2024
1 parent 8edb214 commit 928af62
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/java/io/cryostat/discovery/KubeApiDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ List<TargetTuple> tuplesFromEndpoints(Endpoints endpoints) {
for (EndpointSubset subset : endpoints.getSubsets()) {
for (EndpointPort port : subset.getPorts()) {
for (EndpointAddress addr : subset.getAddresses()) {
tts.add(new TargetTuple(addr.getTargetRef(), addr, port));
var ref = addr.getTargetRef();
tts.add(
new TargetTuple(
ref,
queryForNode(ref.getNamespace(), ref.getName(), ref.getKind())
.getLeft(),
addr,
port));
}
}
}
Expand Down Expand Up @@ -584,11 +591,14 @@ static EndpointDiscoveryEvent from(

private class TargetTuple {
ObjectReference objRef;
HasMetadata obj;
EndpointAddress addr;
EndpointPort port;

TargetTuple(ObjectReference objRef, EndpointAddress addr, EndpointPort port) {
TargetTuple(
ObjectReference objRef, HasMetadata obj, EndpointAddress addr, EndpointPort port) {
this.objRef = objRef;
this.obj = obj;
this.addr = addr;
this.port = port;
}
Expand All @@ -613,11 +623,6 @@ public Target toTarget() {
"/jndi/rmi://" + host + ':' + port.getPort() + "/jmxrmi");
URI connectUrl = URI.create(jmxUrl.toString());

Pair<HasMetadata, DiscoveryNode> pair =
queryForNode(namespace, objRef.getName(), objRef.getKind());

HasMetadata obj = pair.getLeft();

Target target = new Target();
target.activeRecordings = new ArrayList<>();
target.connectUrl = connectUrl;
Expand Down

0 comments on commit 928af62

Please sign in to comment.