Skip to content

Commit

Permalink
Backporting changes from main to 2.x (#445)
Browse files Browse the repository at this point in the history
* Update RestController constructor for tests. (#440)

Signed-off-by: Filip Drobnjakovic <[email protected]>

* Fixing ShardStateCollector; impacted by core refactoring

Signed-off-by: Khushboo Rajput <[email protected]>

* [Collector] Adding Latency and Error service metrics (#442)

* [Collector] Adding Latency and Error service metrics

Signed-off-by: Khushboo Rajput <[email protected]>

* Removing fastdoubleparser-LICENSE.txt and fastdoubleparser-NOTICE.txt

Signed-off-by: Khushboo Rajput <[email protected]>

---------

Signed-off-by: Khushboo Rajput <[email protected]>

* License changes

Signed-off-by: Khushboo Rajput <[email protected]>

---------

Signed-off-by: Filip Drobnjakovic <[email protected]>
Signed-off-by: Khushboo Rajput <[email protected]>
Co-authored-by: Filip Drobnjaković <[email protected]>
  • Loading branch information
khushbr and Tjofil authored May 17, 2023
1 parent b159f65 commit 483c52a
Show file tree
Hide file tree
Showing 33 changed files with 154 additions and 94 deletions.
21 changes: 0 additions & 21 deletions licenses/fastdoubleparser-LICENSE.txt

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion licenses/jackson-annotations-2.14.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions licenses/jackson-annotations-2.15.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
092a90d3739e970e03b5971839e4fe51f13c1fa3
1 change: 0 additions & 1 deletion licenses/jackson-databind-2.14.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions licenses/jackson-databind-2.15.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ac9ba74d208faf356e4719a49e59c6ea9237c01d
1 change: 0 additions & 1 deletion licenses/jackson-module-paranamer-2.14.2.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions licenses/jackson-module-paranamer-2.15.1.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1eee39f6a814b12d92a936cd198657ff26970215
1 change: 0 additions & 1 deletion licenses/performanceanalyzer-rca-2.7.0.0-SNAPSHOT.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions licenses/performanceanalyzer-rca-2.8.0.0-SNAPSHOT.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
66be71c6f8a1defa1206b6389c43634c9a452e86
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void collectMetrics(long startTime) {
return;
}

long startTimeMillis = System.currentTimeMillis();
long mCurrT = System.currentTimeMillis();
try {

Method getAdmissionController =
Expand Down Expand Up @@ -110,17 +110,15 @@ public void collectMetrics(long startTime) {
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.ADMISSION_CONTROL_COLLECTOR_EXECUTION_TIME,
"",
System.currentTimeMillis() - startTimeMillis);
System.currentTimeMillis() - mCurrT);

} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.ADMISSION_CONTROL_COLLECTOR_ERROR,
getCollectorName(),
System.currentTimeMillis() - startTimeMillis);
LOG.debug(
"Exception in collecting AdmissionControl Metrics: {} for startTime {}",
ex::toString,
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.ADMISSION_CONTROL_COLLECTOR_ERROR, "", 1);
}
}

Expand Down Expand Up @@ -183,6 +181,8 @@ private boolean canLoadAdmissionControllerClasses() {
Class.forName(ADMISSION_CONTROL_SERVICE, false, admissionControlClassLoader);
} catch (Exception e) {
LOG.debug("Failed to load AdmissionControllerService classes : {}", e::toString);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.ADMISSION_CONTROL_COLLECTOR_ERROR, "", 1);
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
import org.opensearch.common.cache.Cache;
import org.opensearch.indices.IndicesService;
import org.opensearch.performanceanalyzer.OpenSearchResources;
import org.opensearch.performanceanalyzer.PerformanceAnalyzerApp;
import org.opensearch.performanceanalyzer.metrics.AllMetrics.CacheConfigDimension;
import org.opensearch.performanceanalyzer.metrics.AllMetrics.CacheConfigValue;
import org.opensearch.performanceanalyzer.metrics.MetricsConfiguration;
import org.opensearch.performanceanalyzer.metrics.MetricsProcessor;
import org.opensearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import org.opensearch.performanceanalyzer.rca.framework.metrics.WriterMetrics;

/*
* Unlike Cache Hit, Miss, Eviction Count and Size, which is tracked on a per shard basis,
Expand Down Expand Up @@ -54,6 +56,7 @@ public void collectMetrics(long startTime) {
return;
}

long mCurrT = System.currentTimeMillis();
value.setLength(0);
value.append(PerformanceAnalyzerMetrics.getJsonCurrentMilliSeconds());
// This is for backward compatibility. Core OpenSearch may or may not emit maxWeight metric.
Expand Down Expand Up @@ -117,6 +120,10 @@ public void collectMetrics(long startTime) {
value.append(PerformanceAnalyzerMetrics.sMetricNewLineDelimitor)
.append(shardRequestCacheMaxSizeStatus.serialize());
saveMetricValues(value.toString(), startTime);
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.CACHE_CONFIG_METRICS_COLLECTOR_EXECUTION_TIME,
"",
System.currentTimeMillis() - mCurrT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public class CircuitBreakerCollector extends PerformanceAnalyzerMetricsCollector
public static final int SAMPLING_TIME_INTERVAL =
MetricsConfiguration.CONFIG_MAP.get(CircuitBreakerCollector.class).samplingInterval;

private static final Logger LOG =
LogManager.getLogger(CircuitBreakerCollector.class);
private static final Logger LOG = LogManager.getLogger(CircuitBreakerCollector.class);
private static final int KEYS_PATH_LENGTH = 0;
private StringBuilder value;

Expand Down Expand Up @@ -54,10 +53,10 @@ public void collectMetrics(long startTime) {
value.append(PerformanceAnalyzerMetrics.sMetricNewLineDelimitor)
.append(
new CircuitBreakerStatus(
stats.getName(),
stats.getEstimated(),
stats.getTrippedCount(),
stats.getLimit())
stats.getName(),
stats.getEstimated(),
stats.getTrippedCount(),
stats.getLimit())
.serialize());
}

Expand All @@ -69,14 +68,13 @@ public void collectMetrics(long startTime) {
System.currentTimeMillis() - mCurrT);

} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CIRCUIT_BREAKER_COLLECTOR_ERROR, "", 1);
LOG.debug(
"Exception in Collecting CircuitBreaker Metrics: {} for startTime {}",
() -> ex.toString(),
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CIRCUIT_BREAKER_COLLECTOR_ERROR, "", 1);
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ public void collectMetrics(long startTime) {
"",
System.currentTimeMillis() - mCurrT);
} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_APPLIER_SERVICE_STATS_COLLECTOR_ERROR, "", 1);
LOG.debug(
"Exception in Collecting Cluster Applier Service Metrics: {} for startTime {}",
() -> ex.toString(),
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_APPLIER_SERVICE_STATS_COLLECTOR_ERROR, "", 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.opensearch.performanceanalyzer.metrics.MetricsProcessor;
import org.opensearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import org.opensearch.performanceanalyzer.metrics.ThreadIDUtil;
import org.opensearch.performanceanalyzer.rca.framework.metrics.ExceptionsAndErrors;
import org.opensearch.performanceanalyzer.rca.framework.metrics.WriterMetrics;

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -83,6 +84,8 @@ public void collectMetrics(long startTime) {
return;
}

long mCurrT = System.currentTimeMillis();

value.setLength(0);
Queue<Runnable> current = getClusterManagerServiceCurrentQueue();

Expand Down Expand Up @@ -145,19 +148,24 @@ public void collectMetrics(long startTime) {
PerformanceAnalyzerMetrics.START_FILE_NAME);

value.setLength(0);
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics
.CLUSTER_MANAGER_SERVICE_EVENTS_METRICS_COLLECTOR_EXECUTION_TIME,
"",
System.currentTimeMillis() - mCurrT);
}
} else {
generateFinishMetrics(startTime);
}
LOG.debug(() -> "Successfully collected ClusterManager Event Metrics.");
} catch (Exception ex) {
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.CLUSTER_MANAGER_METRICS_ERROR, "", 1);
LOG.debug(
"Exception in Collecting ClusterManager Metrics: {} for startTime {} with ExceptionCode: {}",
() -> ex.toString(),
() -> startTime,
() -> StatExceptionCode.CLUSTER_MANAGER_METRICS_ERROR.toString());
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_MANAGER_METRICS_ERROR, "", 1);
}
}

Expand Down Expand Up @@ -235,8 +243,8 @@ Queue<Runnable> getClusterManagerServiceCurrentQueue() throws Exception {
getPrioritizedTPExecutorCurrentField()
.get(prioritizedOpenSearchThreadPoolExecutor);
} else {
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.CLUSTER_MANAGER_NODE_NOT_UP, "", 1);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_MANAGER_NODE_NOT_UP, "", 1);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.opensearch.performanceanalyzer.metrics.MetricsConfiguration;
import org.opensearch.performanceanalyzer.metrics.MetricsProcessor;
import org.opensearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import org.opensearch.performanceanalyzer.rca.framework.metrics.ExceptionsAndErrors;
import org.opensearch.performanceanalyzer.rca.framework.metrics.WriterMetrics;

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -57,6 +58,7 @@ public void collectMetrics(long startTime) {
return;
}

long mCurrT = System.currentTimeMillis();
/*
pendingTasks API returns object of PendingClusterTask which contains insertOrder, priority, source, timeInQueue.
Example :
Expand Down Expand Up @@ -98,13 +100,17 @@ public void collectMetrics(long startTime) {
startTime,
PerformanceAnalyzerMetrics.CLUSTER_MANAGER_CURRENT,
PerformanceAnalyzerMetrics.CLUSTER_MANAGER_META_DATA);
} catch (Exception ex) {
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.CLUSTER_MANAGER_METRICS_ERROR, "", 1);
WriterMetrics.CLUSTER_MANAGER_SERVICE_METRICS_COLLECTOR_EXECUTION_TIME,
"",
System.currentTimeMillis() - mCurrT);
} catch (Exception ex) {
LOG.debug(
"Exception in Collecting ClusterManager Metrics: {} for startTime {}",
() -> ex.toString(),
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_MANAGER_METRICS_ERROR, "", 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ public void collectMetrics(long startTime) {
System.currentTimeMillis() - mCurrT);

} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_MANAGER_THROTTLING_COLLECTOR_ERROR, "", 1);
LOG.debug(
"Exception in Collecting ClusterManager Throttling Metrics: {} for startTime {}",
() -> ex.toString(),
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CLUSTER_MANAGER_THROTTLING_COLLECTOR_ERROR, "", 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ public void collectMetrics(long startTime) {
System.currentTimeMillis() - mCurrT);

} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.ELECTION_TERM_COLLECTOR_ERROR,
"",
System.currentTimeMillis() - mCurrT);
LOG.debug(
"Exception in Collecting Election term Metrics: {} for startTime {}",
() -> ex.toString(),
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.ELECTION_TERM_COLLECTOR_ERROR, "", 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ public void collectMetrics(long startTime) {
"",
System.currentTimeMillis() - mCurrT);
} catch (Exception ex) {
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.FAULT_DETECTION_COLLECTOR_ERROR,
"",
System.currentTimeMillis() - mCurrT);
LOG.debug(
"Exception in Collecting FaultDetection Metrics: {} for startTime {}",
() -> ex.toString(),
() -> startTime);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.FAULT_DETECTION_COLLECTOR_ERROR, "", 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.node.DiscoveryNodes;
import org.opensearch.performanceanalyzer.OpenSearchResources;
import org.opensearch.performanceanalyzer.PerformanceAnalyzerApp;
import org.opensearch.performanceanalyzer.config.overrides.ConfigOverridesHelper;
import org.opensearch.performanceanalyzer.config.overrides.ConfigOverridesWrapper;
import org.opensearch.performanceanalyzer.metrics.AllMetrics.NodeDetailColumns;
import org.opensearch.performanceanalyzer.metrics.AllMetrics.NodeRole;
import org.opensearch.performanceanalyzer.metrics.MetricsConfiguration;
import org.opensearch.performanceanalyzer.metrics.MetricsProcessor;
import org.opensearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import org.opensearch.performanceanalyzer.rca.framework.metrics.ExceptionsAndErrors;
import org.opensearch.performanceanalyzer.rca.framework.metrics.WriterMetrics;

public class NodeDetailsCollector extends PerformanceAnalyzerMetricsCollector
implements MetricsProcessor {
Expand All @@ -43,6 +46,8 @@ public void collectMetrics(long startTime) {
return;
}

long mCurrT = System.currentTimeMillis();

StringBuilder value = new StringBuilder();
value.append(PerformanceAnalyzerMetrics.getJsonCurrentMilliSeconds())
.append(PerformanceAnalyzerMetrics.sMetricNewLineDelimitor);
Expand All @@ -62,6 +67,8 @@ public void collectMetrics(long startTime) {
}
} catch (IOException ioe) {
LOG.error("Unable to serialize rca config overrides.", ioe);
PerformanceAnalyzerApp.ERRORS_AND_EXCEPTIONS_AGGREGATOR.updateStat(
ExceptionsAndErrors.CONFIG_OVERRIDES_SER_FAILED, "", 1);
}
value.append(PerformanceAnalyzerMetrics.sMetricNewLineDelimitor);

Expand All @@ -87,6 +94,10 @@ public void collectMetrics(long startTime) {
discoveryNodeIterator.next(), value, localNodeID, clusterManagerNode);
}
saveMetricValues(value.toString(), startTime);
PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.NODE_DETAILS_COLLECTOR_EXECUTION_TIME,
"",
System.currentTimeMillis() - mCurrT);
}

private void addMetricsToStringBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.opensearch.performanceanalyzer.metrics.MetricsProcessor;
import org.opensearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import org.opensearch.performanceanalyzer.rca.framework.metrics.ExceptionsAndErrors;
import org.opensearch.performanceanalyzer.rca.framework.metrics.WriterMetrics;
import org.opensearch.performanceanalyzer.util.Utils;

/**
Expand Down Expand Up @@ -146,6 +147,8 @@ public void collectMetrics(long startTime) {
return;
}

long mCurrT = System.currentTimeMillis();

try {
populateCurrentShards();
populatePerShardStats(indicesService);
Expand Down Expand Up @@ -173,6 +176,11 @@ public void collectMetrics(long startTime) {
new NodeStatsMetricsAllShardsPerCollectionStatus(currentShardStats);
populateDiffMetricValue(
prevValue, currValue, startTime, shardId.getIndexName(), shardId.id());

PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(
WriterMetrics.NODE_STATS_ALL_SHARDS_METRICS_COLLECTOR_EXECUTION_TIME,
"",
System.currentTimeMillis() - mCurrT);
}
} catch (Exception ex) {
LOG.debug(
Expand Down
Loading

0 comments on commit 483c52a

Please sign in to comment.