Skip to content

Commit d0cc265

Browse files
authored
Merge pull request #9 from kenfinnigan/remove-sysouts
Remove System.out usage
2 parents 499c163 + 29ade31 commit d0cc265

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/main/java/com/redhat/MeterController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ PodWatcher getWatcher() {
259259
private MeterStatus constructStatus() {
260260
final String currentlyWatching = podWatcher != null ? "TRUE" : "FALSE";
261261
final String watchedPodCount = podWatcher != null ? podWatcher.watchedPods() : "UNKNOWN";
262-
// TODO remove
263-
System.out.println("WATCHED POD STATUS: " + watchedPodCount);
264262
final Resource<ServiceMonitor> serviceMonitor = serviceMonitor();
265263
final String serviceMonitorInstalled = serviceMonitor != null ? (serviceMonitor.get() != null ? "TRUE" : "FALSE") : "UNKNOWN";
266264
return new MeterStatus(currentlyWatching, watchedPodCount, serviceMonitorInstalled);

src/main/java/com/redhat/PodWatcher.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ static Map<String, String> convertListToMap(List<String> productNameMapAsList) {
6060

6161
@Override
6262
public void eventReceived(Action action, Pod resource) {
63-
LOG.info("EVENT RECEIVED FOR POD: " + resource.getMetadata().getName());
6463
if (!shouldWatch(spec.getWatchNamespaces(), resource.getMetadata().getNamespace())) {
6564
// If we're not watching all namespaces or the event is from a namespace we're not watching, do nothing
6665
return;
6766
}
68-
LOG.info("WATCHING NAMESPACE");
6967

7068
if (resource.getMetadata().getLabels().containsKey(config.pod().identifier())) {
7169
// Get/Create metric
@@ -75,7 +73,7 @@ public void eventReceived(Action action, Pod resource) {
7573
switch (action) {
7674
case ADDED:
7775
if (includePod(config, resource.getMetadata().getLabels(), spec)) {
78-
LOG.info("CREATING METRIC, POD INCLUDED");
76+
LOG.trace("Adding pod to metrics gathering: " + resource.getMetadata().getName() + " in " + resource.getMetadata().getNamespace());
7977
if (podGroup == null) {
8078
podGroup = new PodGroup();
8179
podGroup.addPod(resource.getMetadata().getName(), resource.getMetadata().getNamespace());
@@ -93,7 +91,6 @@ public void eventReceived(Action action, Pod resource) {
9391
break;
9492
case DELETED:
9593
if (podGroup != null) {
96-
LOG.info("POD DELETE EVENT. REMOVING");
9794
podGroup.removePod(resource.getMetadata().getName());
9895

9996
if (podGroup.list().size() == 0) {
@@ -170,6 +167,7 @@ void updateSpec(MeterSpec newSpec) {
170167
PodGroup podGroup = metrics.get(tags);
171168

172169
if (includePod(config, pod.getMetadata().getLabels(), newSpec)) {
170+
LOG.trace("Adding pod to metrics gathering: " + pod.getMetadata().getName() + " in " + pod.getMetadata().getNamespace());
173171
if (podGroup == null) {
174172
podGroup = new PodGroup();
175173
podGroup.addPod(pod.getMetadata().getName(), pod.getMetadata().getNamespace());
@@ -196,8 +194,6 @@ String watchedPods() {
196194
for (PodGroup podGroup : metrics.values()) {
197195
count += podGroup.pods.size();
198196
}
199-
//TODO remove
200-
System.out.println("NUMBER OF WATCHED PODS: " + count);
201197
return Integer.toString(count);
202198
}
203199

@@ -255,7 +251,8 @@ public double applyAsDouble(PodGroup value) {
255251
}
256252
} catch (KubernetesClientException kce) {
257253
// Ignore, as it likely means a pod is "ready", but no metrics available yet
258-
LOG.info("EXCEPTION RETRIEVING METRICS", kce);
254+
// Log a debug message in case it's an error of a different kind
255+
LOG.debug(kce);
259256
}
260257
} else {
261258
// Ignore, as the pod is not "ready"

0 commit comments

Comments
 (0)