su.nlq.prometheus.jmx.connection.local.LocalConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmx-prometheus-collector Show documentation
Show all versions of jmx-prometheus-collector Show documentation
Pipe for JMX MBeans to Prometheus
package su.nlq.prometheus.jmx.connection.local;
import org.jetbrains.annotations.NotNull;
import su.nlq.prometheus.jmx.connection.Connection;
import su.nlq.prometheus.jmx.connection.ConnectionConsumer;
import java.lang.management.ManagementFactory;
import java.util.Optional;
public final class LocalConnection extends Connection {
public LocalConnection(@NotNull Optional name) {
super(name);
}
public LocalConnection() {
super(Optional.empty());
}
@Override
public void accept(@NotNull ConnectionConsumer consumer) {
consumer.accept(name(ManagementFactory.getRuntimeMXBean().getName()), ManagementFactory.getPlatformMBeanServer());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy