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

Commit

Permalink
Publish Shard State Metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita committed Oct 19, 2020
1 parent 72bcd60 commit 4f460e1
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors;

import com.amazon.opendistro.elasticsearch.performanceanalyzer.ESResources;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.PerformanceAnalyzerApp;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.AllMetrics;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.MetricsConfiguration;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.MetricsProcessor;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.metrics.ExceptionsAndErrors;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.metrics.WriterMetrics;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -33,6 +36,7 @@ public ShardStateCollector() {

@Override
void collectMetrics( long startTime) {
long mCurrT = System.currentTimeMillis();
if (ESResources.INSTANCE.getClusterService() == null) {
return;
}
Expand Down Expand Up @@ -70,8 +74,12 @@ void collectMetrics( long startTime) {
if(inActiveShard) {
saveMetricValues(value.toString(), startTime);
}

PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
WriterMetrics.SHARD_STATE_COLLECTOR_EXECUTION_TIME, "",
System.currentTimeMillis() - mCurrT);
} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.SHARD_STATE_COLLECTOR_ERROR, "", 1);
LOG.debug("Exception in Collecting Shard Metrics: {} for startTime {}", () -> ex.toString(),
() -> startTime);
}
Expand Down

0 comments on commit 4f460e1

Please sign in to comment.