All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.xenit.alfred.telemetry.solr.monitoring.binder.SolrMetrics Maven / Gradle / Ivy

The newest version!
package eu.xenit.alfred.telemetry.solr.monitoring.binder;

import eu.xenit.alfred.telemetry.solr.util.Util;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.MeterBinder;
import javax.management.MBeanServer;
import org.alfresco.solr.AlfrescoCoreAdminHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SolrMetrics implements MeterBinder {

    private AlfrescoCoreAdminHandler coreAdminHandler;
    private MBeanServer mBeanServer;

    private static final Logger logger = LoggerFactory.getLogger(SolrMetrics.class);

    public SolrMetrics(AlfrescoCoreAdminHandler coreAdminHandler, MBeanServer mBeanServer) {
        this.coreAdminHandler = coreAdminHandler;
        this.mBeanServer = mBeanServer;
    }

    @Override
    public void bindTo(MeterRegistry registry) {
        if(Util.isEnabled("METRICS_SOLR_BACKUP_ENABLED")) {
            new SolrSnapshotMetrics(coreAdminHandler).bindTo(registry);
        }
        if(Util.isEnabled("METRICS_SOLR_CORESTATS_ENABLED")) {
            new SolrCoreStatsMetrics(coreAdminHandler).bindTo(registry);
        }
        if(Util.isEnabled("METRICS_SOLR_FTS_ENABLED")) {
            new SolrFTSMetrics(coreAdminHandler).bindTo(registry);
        }
        if(Util.isEnabled("METRICS_SOLR_TRACKER_ENABLED")) {
            new SolrTrackerMetrics(coreAdminHandler).bindTo(registry);
        }
        if(Util.isEnabled("METRICS_SOLR_JMX_ENABLED")) {
            new SolrBeansMetrics(mBeanServer).bindTo(registry);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy