This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Added Election Term Metric #557
Open
meetshah777
wants to merge
4
commits into
opendistro-for-elasticsearch:main
Choose a base branch
from
meetshah777:election
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ public enum MetricName { | |
THREAD_POOL, | ||
SHARD_STATS, | ||
MASTER_PENDING, | ||
ELECTION_TERM, | ||
MOUNTED_PARTITION_METRICS, | ||
CLUSTER_APPLIER_SERVICE, | ||
ADMISSION_CONTROL_METRICS, | ||
|
@@ -836,14 +837,33 @@ public enum ClusterApplierServiceStatsValue implements MetricValue { | |
|
||
@Override | ||
public String toString() { | ||
return value; | ||
return this.value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't change code that you don't intend to. It changes the git blame. |
||
} | ||
|
||
public static class Constants { | ||
public static final String CLUSTER_APPLIER_SERVICE_LATENCY = "ClusterApplierService_Latency"; | ||
public static final String CLUSTER_APPLIER_SERVICE_FAILURE = "ClusterApplierService_Failure"; | ||
} | ||
} | ||
|
||
public enum ElectionTermValue implements MetricValue { | ||
ELECTION_TERM(Constants.ELECTION_TERM_VALUE); | ||
|
||
private final String value; | ||
|
||
ElectionTermValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value; | ||
} | ||
|
||
public static class Constants { | ||
public static final String ELECTION_TERM_VALUE = "Election_Term"; | ||
} | ||
} | ||
|
||
public enum MasterThrottlingValue implements MetricValue { | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../opendistro/elasticsearch/performanceanalyzer/rca/framework/api/metrics/ElectionTerm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright <2021> Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.metrics; | ||
|
||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.AllMetrics; | ||
import com.amazon.opendistro.elasticsearch.performanceanalyzer.rca.framework.api.Metric; | ||
|
||
public class ElectionTerm extends Metric { | ||
public ElectionTerm(long evaluationIntervalSeconds) { | ||
super( | ||
AllMetrics.ElectionTermValue.ELECTION_TERM.name(), evaluationIntervalSeconds); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,8 @@ public enum ExceptionsAndErrors implements MeasurementSet { | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error for all the collectors to maintain consistency |
||
FAULT_DETECTION_COLLECTOR_ERROR("FaultDetectionMetricsCollector"), | ||
|
||
ELECTION_TERM_COLLECTOR_ERROR("ElectionTermCollectorError"), | ||
|
||
CLUSTER_APPLIER_SERVICE_STATS_COLLECTOR_ERROR("ClusterApplierServiceStatsCollector"), | ||
|
||
SHARD_INDEXING_PRESSURE_COLLECTOR_ERROR("ShardIndexingPressureMetricsCollector"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can rename
MASTER_PENDING
asMASTER_METRICS
and then election term can also beMASTER_METRICS
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In metricPathmap we are making map of Metric name Metric path. So, it is not possible to make same metric name for 2 different paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we group
MASTER_PENDING
andELECTION_TERM
into one metricMASTER_METRICS
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As from my understanding we want to publish two different metrics. so it is not possible to use same Metric name for two different metrics. If it is a way to use same metric name then can you give some context