org.opendaylight.odlparent.bundles.diag.Diag Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of odlparent-docs Show documentation
Show all versions of odlparent-docs Show documentation
ODL Root Parent documentation
The newest version!
/*
* Copyright (c) 2024 PANTHEON.tech, s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.odlparent.bundles.diag;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
/**
* A snapshot of bundle diagnostics.
*/
public interface Diag {
List bundles();
// Iteration order guaranteed to be ordered by ContainerState.ordinal()
default Map containerStateFrequencies() {
final var frequencies = new EnumMap(ContainerState.class);
for (var bundleState : ContainerState.values()) {
frequencies.put(bundleState, 0);
}
for (var bundle : bundles()) {
frequencies.compute(bundle.serviceState().containerState(), (key, counter) -> counter + 1);
}
return frequencies;
}
// log a delta from some previous bundles
void logDelta(Logger logger, Diag prevDiag);
// log services
void logServices(Logger logger);
// log bundle state details for troubleshooting
void logState(Logger logger);
}