Skip to content

Commit

Permalink
chore(logs): fix broken logs format
Browse files Browse the repository at this point in the history
  • Loading branch information
tthvo committed Mar 27, 2024
1 parent 36ec3e8 commit d339c5a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/main/java/io/cryostat/discovery/KubeApiDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected HashMap<String, SharedIndexInformer<Endpoints>> initialize()
ENDPOINTS_INFORMER_RESYNC_PERIOD));
logger.infov(
"Started Endpoints SharedInformer for"
+ " namespace \"{}\"",
+ " namespace \"{0}\"",
ns);
});
return result;
Expand Down Expand Up @@ -133,7 +133,7 @@ void onStart(@Observes StartupEvent evt) {
universe.persist();
}

logger.infov("Starting %s client", REALM);
logger.infov("Starting {0} client", REALM);

safeGetInformers(); // trigger lazy init
}
Expand All @@ -143,7 +143,7 @@ void onStop(@Observes ShutdownEvent evt) {
return;
}

logger.infov("Shutting down %s client", REALM);
logger.infov("Shutting down {0} client", REALM);
}

boolean enabled() {
Expand Down Expand Up @@ -223,7 +223,7 @@ private void pruneOwnerChain(DiscoveryNode nsNode, TargetTuple targetTuple) {
ObjectReference TargetTuple = targetTuple.addr.getTargetRef();
if (TargetTuple == null) {
logger.errorv(
"Address {} for Endpoint {} had null target reference",
"Address {0} for Endpoint {1} had null target reference",
targetTuple.addr.getIp() != null
? targetTuple.addr.getIp()
: targetTuple.addr.getHostname(),
Expand All @@ -235,7 +235,6 @@ private void pruneOwnerChain(DiscoveryNode nsNode, TargetTuple targetTuple) {
KubeDiscoveryNodeType targetType = KubeDiscoveryNodeType.fromKubernetesKind(targetKind);

Target target = Target.getTargetByConnectUrl(targetTuple.toTarget().connectUrl);
target.delete();

DiscoveryNode targetNode = target.discoveryNode;

Expand Down Expand Up @@ -265,15 +264,15 @@ private void pruneOwnerChain(DiscoveryNode nsNode, TargetTuple targetTuple) {
} else {
nsNode.children.remove(targetNode);
}

target.delete();
nsNode.persist();
}

private void buildOwnerChain(DiscoveryNode nsNode, TargetTuple targetTuple) {
ObjectReference targetRef = targetTuple.addr.getTargetRef();
if (targetRef == null) {
logger.errorv(
"Address {} for Endpoint {} had null target reference",
"Address {0} for Endpoint {1} had null target reference",
targetTuple.addr.getIp() != null
? targetTuple.addr.getIp()
: targetTuple.addr.getHostname(),
Expand Down Expand Up @@ -327,9 +326,8 @@ private Pair<HasMetadata, DiscoveryNode> getOwnerNode(Pair<HasMetadata, Discover
HasMetadata childRef = child.getLeft();
if (childRef == null) {
logger.errorv(
"Could not locate node named {} of kind {} while traversing environment",
child.getRight().name,
child.getRight().nodeType);
"Could not locate node named {0} of kind {1} while traversing environment",
child.getRight().name, child.getRight().nodeType);
return null;
}
List<OwnerReference> owners = childRef.getMetadata().getOwnerReferences();
Expand Down Expand Up @@ -456,7 +454,7 @@ public void onUpdate(Endpoints oldEndpoints, Endpoints newEndpoints) {
@Override
public void onDelete(Endpoints endpoints, boolean deletedFinalStateUnknown) {
if (deletedFinalStateUnknown) {
logger.warnv("Deleted final state unknown: {}", endpoints);
logger.warnv("Deleted final state unknown: {0}", endpoints);
return;
}
getTargetTuplesFrom(endpoints)
Expand Down Expand Up @@ -500,7 +498,7 @@ public Target toTarget() {
String ip = addr.getIp().replaceAll("\\.", "-");
String namespace = obj.getMetadata().getNamespace();

boolean isPod = obj.getKind() == KubeDiscoveryNodeType.POD.getKind();
boolean isPod = obj.getKind().equals(KubeDiscoveryNodeType.POD.getKind());

String host = String.format("%s.%s", ip, namespace);
if (isPod) {
Expand Down

0 comments on commit d339c5a

Please sign in to comment.