-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds the listener for resource utilization metrics #687
Adds the listener for resource utilization metrics #687
Conversation
Signed-off-by: Gagan Juneja <[email protected]>
src/main/java/org/opensearch/performanceanalyzer/PerformanceAnalyzerPlugin.java
Show resolved
Hide resolved
...main/java/org/opensearch/performanceanalyzer/listener/PerformanceAnalyzerSearchListener.java
Show resolved
Hide resolved
Signed-off-by: Gagan Juneja <[email protected]>
Signed-off-by: Gagan Juneja <[email protected]>
Signed-off-by: Gagan Juneja <[email protected]>
Signed-off-by: Gagan Juneja <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #687 +/- ##
============================================
+ Coverage 70.88% 70.95% +0.07%
- Complexity 421 478 +57
============================================
Files 49 53 +4
Lines 3125 3377 +252
Branches 194 217 +23
============================================
+ Hits 2215 2396 +181
- Misses 785 844 +59
- Partials 125 137 +12 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Gagan Juneja <[email protected]>
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.
There are some code coverage annotations, can we see if those can be addressed.
src/main/java/org/opensearch/performanceanalyzer/config/PerformanceAnalyzerController.java
Outdated
Show resolved
Hide resolved
...n/java/org/opensearch/performanceanalyzer/listener/RTFPerformanceAnalyzerSearchListener.java
Outdated
Show resolved
Hide resolved
return isSearchListenerEnabled() ? this : NO_OP_SEARCH_LISTENER; | ||
} | ||
|
||
private boolean isSearchListenerEnabled() { |
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.
isSearchListenerEnabled
seems to be a mandatory method for any SearchListeners implementation. Should we add it to the super class and all the subclasses needs to write the logic of this method.
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.
We can do that. Didn't want to change a lot the existing stuff as anyways the plan is to bring this into core at some point in time.
...n/java/org/opensearch/performanceanalyzer/listener/RTFPerformanceAnalyzerSearchListener.java
Outdated
Show resolved
Hide resolved
|
||
private Histogram createCPUUtilizationHistogram() { | ||
MetricsRegistry metricsRegistry = OpenSearchResources.INSTANCE.getMetricsRegistry(); | ||
if (metricsRegistry != null) { |
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.
If the registry is null it does not make sense to create this listener, Do we need to throw exception instead of returning null?
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.
No. We just want to stay silent.
.../opensearch/performanceanalyzer/transport/RTFPerformanceAnalyzerTransportRequestHandler.java
Outdated
Show resolved
Hide resolved
.../opensearch/performanceanalyzer/transport/RTFPerformanceAnalyzerTransportRequestHandler.java
Outdated
Show resolved
Hide resolved
@@ -108,4 +111,19 @@ public static HashMap<ShardId, IndexShard> getShards() { | |||
IndexShardState.RECOVERING, | |||
IndexShardState.POST_RECOVERY, | |||
IndexShardState.STARTED); | |||
|
|||
public static double calculateCPUUtilization( |
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 add java doc explaining how we are calculating CPU Utilization
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 the cpuShareFactor be calculated here itself?
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.
No. It's used from 2 places so should be generic.
src/main/java/org/opensearch/performanceanalyzer/util/Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/performanceanalyzer/util/Utils.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gagan Juneja <[email protected]>
String operation, | ||
boolean isFailed) { | ||
long overallStartTime = fetchStartTime; | ||
long queryTaskId = threadLocal.get().getOrDefault(QUERY_TASK_ID, 0l); |
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.
We can use -1 instead of 0.
long overallStartTime, | ||
long operationTime, |
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 these are being used in the context of search we can change operations to phase and change variable names.
overallStartTime -> startTime
operationTime -> phaseTookTime
operation -> phase
...ava/org/opensearch/performanceanalyzer/transport/RTFPerformanceAnalyzerTransportChannel.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gagan Juneja <[email protected]>
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.
LGTM!
Do we know the build failure reason and if that needs to be fixed?
If there is no open issue, can we create one and tag it to this PR.
* Adds the listener for resource utilization metrics Signed-off-by: Gagan Juneja <[email protected]> Co-authored-by: Gagan Juneja <[email protected]> (cherry picked from commit c95feb6)
* Adds the listener for resource utilization metrics Signed-off-by: Gagan Juneja <[email protected]> Co-authored-by: Gagan Juneja <[email protected]> (cherry picked from commit c95feb6) Co-authored-by: Gagan Juneja <[email protected]>
* [Feature] adds index_uuid as a tag in node stats all shard metrics (#680) (#689) * Adds index_uuid as a dimension for node stats col Signed-off-by: Atharva Sharma <[email protected]> * updates gauge usage and added index_uuid as tag Signed-off-by: Atharva Sharma <[email protected]> * removed incomplete collector Signed-off-by: Atharva Sharma <[email protected]> * fixed UTs after gauge changes Signed-off-by: Atharva Sharma <[email protected]> * addressed comments Signed-off-by: Atharva Sharma <[email protected]> * reverted gauge related changes Signed-off-by: Atharva Sharma <[email protected]> --------- Signed-off-by: Atharva Sharma <[email protected]> (cherry picked from commit 948b54a) Co-authored-by: Atharva Sharma <[email protected]> * Adds the listener for resource utilization metrics (#687) (#688) * Adds the listener for resource utilization metrics Signed-off-by: Gagan Juneja <[email protected]> Co-authored-by: Gagan Juneja <[email protected]> (cherry picked from commit c95feb6) Co-authored-by: Gagan Juneja <[email protected]> --------- Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: Atharva Sharma <[email protected]>
* [Feature] adds index_uuid as a tag in node stats all shard metrics (#680) (#689) * Adds index_uuid as a dimension for node stats col Signed-off-by: Atharva Sharma <[email protected]> * updates gauge usage and added index_uuid as tag Signed-off-by: Atharva Sharma <[email protected]> * removed incomplete collector Signed-off-by: Atharva Sharma <[email protected]> * fixed UTs after gauge changes Signed-off-by: Atharva Sharma <[email protected]> * addressed comments Signed-off-by: Atharva Sharma <[email protected]> * reverted gauge related changes Signed-off-by: Atharva Sharma <[email protected]> --------- Signed-off-by: Atharva Sharma <[email protected]> (cherry picked from commit 948b54a) Co-authored-by: Atharva Sharma <[email protected]> * Adds the listener for resource utilization metrics (#687) (#688) * Adds the listener for resource utilization metrics Signed-off-by: Gagan Juneja <[email protected]> Co-authored-by: Gagan Juneja <[email protected]> (cherry picked from commit c95feb6) Co-authored-by: Gagan Juneja <[email protected]> --------- Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: Atharva Sharma <[email protected]>
Adds the listener for resource utilization metrics.
Is your feature request related to a problem? Please provide an existing Issue # , or describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you are proposing
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.