su.nlq.prometheus.jmx.scraper.Scraper 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.scraper;
import org.jetbrains.annotations.NotNull;
import javax.management.MBeanServerConnection;
import javax.management.ObjectInstance;
public final class Scraper {
private final @NotNull MBeanServerConnection connection;
@SuppressWarnings("StaticMethodNamingConvention")
public static @NotNull Scraper of(@NotNull MBeanServerConnection connection) {
return new Scraper(connection);
}
private Scraper(@NotNull MBeanServerConnection connection) {
this.connection = connection;
}
public @NotNull Receiver.Consumer scrape(@NotNull Iterable beans) {
return receiver -> {
final BeanScraper scraper = new BeanScraper(connection, receiver);
beans.forEach(bean -> scraper.scrape(bean.getObjectName()));
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy