-
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
SearchBackPressure Service Collector added #483
SearchBackPressure Service Collector added #483
Conversation
…[email protected]) Signed-off-by: CoderJeffrey <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #483 +/- ##
============================================
+ Coverage 73.67% 73.85% +0.18%
- Complexity 375 381 +6
============================================
Files 44 45 +1
Lines 2477 2693 +216
Branches 172 172
============================================
+ Hits 1825 1989 +164
- Misses 544 596 +52
Partials 108 108
|
…y: Jeffrey Liu [email protected]) Signed-off-by: CoderJeffrey <[email protected]>
In order to access the Constants field in this collector, another pull & request for performance-analyzer-commons package has been made. Example: Parallel Pull & Request link: opensearch-project/performance-analyzer-commons#33 |
Can we cleanup the bunch of jars which got along with the commit making the file changes as 37? |
private SearchShardTaskStats searchShardTaskStats; | ||
private SearchTaskStats searchTaskStats; | ||
|
||
// private double searchBackPressureStatsTest; |
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.
Is this searchBackPressureStatsTest
for testing?
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.
// private double searchBackPressureStatsTest;
is not needed for the collector.
thank you so much for pointing out, just removed this piece of code (comment).
this.searchbp_task_stats_cancellationCount = searchTaskStats.getCancellationCount(); | ||
this.searchbp_task_stats_limitReachedCount = searchTaskStats.getLimitReachedCount(); | ||
this.searchbp_task_stats_resource_heap_usage_cancellationCount = | ||
searchTaskStats |
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 probably rewrite this part of code to make it more readable, for example, using some temp variables to replace
searchTaskStats
.getResourceUsageTrackerStats()
.get(HEAP_USAGE_TRACKER_FIELD_NAME)
searchTaskStats
.getResourceUsageTrackerStats()
.get(CPU_USAGE_TRACKER_FIELD_NAME)
searchTaskStats
.getResourceUsageTrackerStats()
.get(ELAPSED_TIME_USAGE_TRACKER_FIELD_NAME)
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.
searchTaskStats
.getResourceUsageTrackerStats()
.get(HEAP_USAGE_TRACKER_FIELD_NAME)
Has now been simplified to
task_heap_stats
Similar simplification applies to other variables.
import org.powermock.modules.junit4.PowerMockRunner; | ||
|
||
@RunWith(PowerMockRunner.class) | ||
public class SearchBackPressureStatsCollectorTests { |
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.
Besides the valid cases, we can add more tests for some invalid scenarios. For example, to test if an exception is correctly thrown under certain conditions.
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 order to check for the exception for collectMetrics(), it is required to control the behavior of ObjectMapper, but since it is a private static field, and all exceptions are caught inside the collectMetrics() itself. Is it acceptable to only test for valid fields for now? i also check with other collect tests like ClusterManagerServiceEventMetricsTests.java, the additional exception testings are also omitted.
…com) Signed-off-by: CoderJeffrey <[email protected]>
…[email protected]) Signed-off-by: CoderJeffrey <[email protected]>
Just cleaned up all jars. |
…d-off-by: Jeffrey Liu [email protected]) Signed-off-by: CoderJeffrey <[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!
import org.opensearch.search.backpressure.SearchBackpressureService; | ||
import org.opensearch.search.backpressure.stats.SearchShardTaskStats; | ||
import org.opensearch.search.backpressure.stats.SearchTaskStats; | ||
|
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.
nit: java doc
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.
More Java doc has been added for SearchBackPressureStatsCollector and SearchBackPressureStatsCollectorTests
…y: Jeffrey Liu [email protected]) Signed-off-by: CoderJeffrey <[email protected]>
* SearchBackPressure Collector added Signed-off-by: CoderJeffrey <[email protected]> (cherry picked from commit e0ea1da)
* SearchBackPressure Collector added Signed-off-by: CoderJeffrey <[email protected]> (cherry picked from commit e0ea1da) Co-authored-by: Jeffrey Liu <[email protected]>
…t#483) (opensearch-project#558)" Signed-off-by: Khushboo Rajput <[email protected]>
Signed-off-by: Khushboo Rajput <[email protected]>
Signed-off-by: Khushboo Rajput <[email protected]> (cherry picked from commit fbef6f9)
Signed-off-by: Jeffrey Liu [email protected]
Is your feature request related to a problem? Please provide an existing Issue # , or describe.
Add the functionality to gather the SearchBackPressure Service.
Describe the solution you are proposing
Add SearchBackPressureStatsCollector.java to collect SearchBackPressure related metrics, and added Unit Testing for SearchBackPressureStatsCollector.java.
Describe alternatives you've considered
N/A
Additional context
Changes in licenses/ are auto-created after running ./build gradlew
In order to access the Constants field in this collector, another pull & request for performance-analyzer-commons package has been made.
Example:
@JsonProperty(SearchBackPressureStatsValue.Constants.SEARCHBP_NODEID) public String getSearchBackPressureStats_NodeId() { return this.nodeId; }
Parallel Pull & Request link: SearchbackpressureStatsCollector Constants Added performance-analyzer-commons#33
Approving this pull & request will be needed in order for the collector to access the Performance-Analyzer-Commons Constants fields. Or else, error would occur.
Can verify the extracted search_back_pressure metrics in /dev/shm/performanceanalyzer directory, open any log file, and search for "search_back_pressure"
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.