Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fault detection stats #291

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.amazon.opendistro.elasticsearch.performanceanalyzer;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.discovery.Discovery;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.common.settings.Settings;
Expand All @@ -34,6 +35,7 @@ public final class ESResources {
private java.nio.file.Path configPath;
private String pluginFileLocation;
private Client client;
private Discovery discovery;

private ESResources() {
threadPool = null;
Expand All @@ -44,6 +46,7 @@ private ESResources() {
environment = null;
configPath = null;
pluginFileLocation = null;
discovery = null;
}

public void setPluginFileLocation(String pluginFileLocation) {
Expand Down Expand Up @@ -117,4 +120,12 @@ public void setClient(final Client client) {
public Client getClient() {
return client;
}

public void setDiscovery(Discovery discovery) {
this.discovery = discovery;
}

public Discovery getDiscovery() {
return discovery;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.CacheConfigMetricsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.CircuitBreakerCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.DisksCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.FaultDetectionMetricsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.FaultDetectionStatsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.GCInfoCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.HeapMetricsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.ShardIndexingPressureMetricsCollector;
Expand Down Expand Up @@ -197,8 +197,6 @@ public PerformanceAnalyzerPlugin(final Settings settings, final java.nio.file.Pa
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new NetworkInterfaceCollector());
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new GCInfoCollector());
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(StatsCollector.instance());
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new FaultDetectionMetricsCollector(
performanceAnalyzerController, configOverridesWrapper));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new ShardStateCollector(
performanceAnalyzerController,configOverridesWrapper));
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new MasterThrottlingMetricsCollector(
Expand All @@ -210,6 +208,13 @@ public PerformanceAnalyzerPlugin(final Settings settings, final java.nio.file.Pa
} catch (ClassNotFoundException e) {
LOG.info("Shard IndexingPressure not present in this ES version. Skipping ShardIndexingPressureMetricsCollector");
}
try {
Class.forName(FaultDetectionStatsCollector.FAULT_DETECTION_STATS_CLASS_NAME);
scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new FaultDetectionStatsCollector(
performanceAnalyzerController,configOverridesWrapper));
} catch (ClassNotFoundException e) {
LOG.info("Fault Detection Stats not present in this ES version. Skipping FaultDetectionStatsCollector");
}
scheduledMetricCollectorsExecutor.start();

EventLog eventLog = new EventLog();
Expand Down Expand Up @@ -243,18 +248,7 @@ public void onIndexModule(IndexModule indexModule) {

//follower check, leader check
public void onDiscovery(Discovery discovery) {
try {
Class<?> listenerInjector = Class.forName(LISTENER_INJECTOR_CLASS_PATH);
Object listenerInjectorInstance = listenerInjector.getDeclaredConstructor().newInstance();
Method addListenerMethod = listenerInjectorInstance.getClass().getMethod(ADD_FAULT_DETECTION_METHOD,
Discovery.class);
addListenerMethod.invoke(listenerInjectorInstance, discovery);
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException e) {
LOG.debug("Exception while calling addFaultDetectionListener in Discovery");
} catch (ClassNotFoundException e) {
LOG.debug("No Class for ListenerInjector detected");
}
ESResources.INSTANCE.setDiscovery(discovery);
}

//- shardbulk
Expand Down

This file was deleted.