Skip to content

Commit

Permalink
NMS-15776: Added some debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
christianpape committed Jul 12, 2023
1 parent bf7a890 commit aec3bf4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,26 @@ public Response perform(Context context) {
if ((b.adapt(BundleRevision.class).getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) {
break;
}
health.add(this, new Response(Failure, "Bundle " + b.getBundleId() + " is resolved, but not active"));
health.add(this, new Response(Failure, "Bundle " + b.getBundleId() + " (" + b.getSymbolicName() + ") is resolved, but not active"));
break;
// Waiting for dependencies
case Waiting:
case GracePeriod:
health.add(this, new Response(Starting, "Bundle " + b.getBundleId() + " is waiting for dependencies"));
health.add(this, new Response(Starting, "Bundle " + b.getBundleId() + " (" + b.getSymbolicName() + ") is waiting for dependencies"));
break;
// Installed, but not yet started
case Installed:
health.add(this, new Response(Starting, "Bundle " + b.getBundleId() + " is not yet started"));
health.add(this, new Response(Starting, "Bundle " + b.getBundleId() + " (" + b.getSymbolicName() + ") is not yet started"));
break;
// Starting
case Starting:
health.add(this, new Response(Starting, "Bundle " + b.getBundleId() + " is starting"));
health.add(this, new Response(Starting, "Bundle " + b.getBundleId() + " (" + b.getSymbolicName() + ") is starting"));
break;
// Stopping, Failed ur Unknown are considered Failures
case Stopping:
case Failure:
case Unknown:
health.add(this, new Response(Failure, "Bundle " + b.getBundleId() + " is not started"));
health.add(this, new Response(Failure, "Bundle " + b.getBundleId() + " (" + b.getSymbolicName() + ") is not started"));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ private CompletionStage<Pair<HealthCheck, Response>> completionStage(HealthCheck
private CompletionStage<Health> runChecks(Context context, List<HealthCheck> checks, ProgressListener listener) {
return FutureUtils.traverse(checks, check -> completionStage(check, context, listener)).thenApply(list -> {
var health = new Health(list);
for(var pair : list) {
LOG.warn("BMRHGA: " + pair.getLeft().getDescription() + ": " + pair.getRight().getMessage());
}

if (listener != null) {
listener.onAllHealthChecksCompleted(health);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
import org.opennms.core.health.api.Health;
import org.opennms.core.health.api.HealthCheckService;
import org.opennms.core.health.rest.HealthCheckRestService;

import io.vavr.control.Either;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.vavr.control.Either;

public class HealthCheckRestServiceImpl implements HealthCheckRestService {

private static final Logger LOG = LoggerFactory.getLogger(HealthCheckRestServiceImpl.class);
Expand Down

0 comments on commit aec3bf4

Please sign in to comment.