Skip to content

Commit

Permalink
Merge pull request #8 from kenfinnigan/add-debug
Browse files Browse the repository at this point in the history
Provide some additional debug statements
  • Loading branch information
kenfinnigan authored Oct 8, 2021
2 parents d2ecfc5 + f4d5820 commit 2e5e045
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/redhat/PodWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void eventReceived(Action action, Pod resource) {
// If we're not watching all namespaces or the event is from a namespace we're not watching, do nothing
return;
}
LOG.info("WATCHING NAMESPACE");

if (resource.getMetadata().getLabels().containsKey(config.pod().identifier())) {
// Get/Create metric
Expand All @@ -74,6 +75,7 @@ public void eventReceived(Action action, Pod resource) {
switch (action) {
case ADDED:
if (includePod(config, resource.getMetadata().getLabels(), spec)) {
LOG.info("CREATING METRIC, POD INCLUDED");
if (podGroup == null) {
podGroup = new PodGroup();
podGroup.addPod(resource.getMetadata().getName(), resource.getMetadata().getNamespace());
Expand All @@ -91,6 +93,7 @@ public void eventReceived(Action action, Pod resource) {
break;
case DELETED:
if (podGroup != null) {
LOG.info("POD DELETE EVENT. REMOVING");
podGroup.removePod(resource.getMetadata().getName());

if (podGroup.list().size() == 0) {
Expand Down Expand Up @@ -252,6 +255,7 @@ public double applyAsDouble(PodGroup value) {
}
} catch (KubernetesClientException kce) {
// Ignore, as it likely means a pod is "ready", but no metrics available yet
LOG.info("EXCEPTION RETRIEVING METRICS", kce);
}
} else {
// Ignore, as the pod is not "ready"
Expand Down

0 comments on commit 2e5e045

Please sign in to comment.