-
Notifications
You must be signed in to change notification settings - Fork 34
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
Include stats api to provide upload metrics #64
Conversation
1131224
to
078d59a
Compare
Use short copyright header. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
@@ -7,6 +7,7 @@ | |||
|
|||
import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; | |||
import static org.opensearch.geospatial.GeospatialTestHelper.buildFieldNameValuePair; | |||
import static org.opensearch.geospatial.GeospatialTestHelper.removeStartAndEndObject; |
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.
I think this is an unused import. Did we add checkstyle to the repo?
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.
This method used to be part of this test, i moved it to Helper class, hence, you see change in import
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.
@VijayanB I think using filter_path to filter breaks pattern for a lot of other stats APIs, including node stats. Typically, its .../stats/{metric}
|
||
@Override | ||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient nodeClient) { | ||
return channel -> nodeClient.execute(StatsAction.INSTANCE, new StatsRequest(), new RestToXContentListener<>(channel)); |
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 option to limit nodes request gets routed to?
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.
Sorry i couldn't understand. Do you mean to add support to include node_id parameter?
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.
Yes, assuming that the response contains node specific stats? Say I have a 100 node cluster and only want info for 1 node.
src/main/java/org/opensearch/geospatial/stats/StatsNodeResponse.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/stats/StatsNodeResponse.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/stats/StatsResponse.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/geospatial/stats/StatsTransportAction.java
Outdated
Show resolved
Hide resolved
I see. It looks like anti-pattern based on REST spec. Nevertheless, let me create an issue to see whether we need to support that format since node stats api follow this format. |
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Added Request,NodeRequest,ResponseNodeResponse,Action classes with boilerplate code and method. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Added stats api "_plugins/geospatial/stats", to retrieve statistics for uploads in cluster. By default all stats are returned, user can filter the response using filter query parameter similar to other cluster response. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
private StatsRequest request; | ||
|
||
public StatsNodeRequest() { | ||
super(); |
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.
This would make request null. Is there a reason for this constructor? I remember somewhere there may have been a required no-arg constructor but I cant remember if it was here.
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.
Good catch. I removed the default constructor. The one that needs default constructor is TransportAction
src/test/java/org/opensearch/geospatial/stats/RestStatsActionIT.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Codecov Report
@@ Coverage Diff @@
## main #64 +/- ##
============================================
- Coverage 90.69% 86.20% -4.49%
- Complexity 146 159 +13
============================================
Files 21 28 +7
Lines 548 609 +61
Branches 39 41 +2
============================================
+ Hits 497 525 +28
- Misses 47 78 +31
- Partials 4 6 +2
Continue to review full report at Codecov.
|
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
216f301
to
e9f466f
Compare
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
Description
Added stats api "_plugins/geospatial/_upload/stats", to retrieve statistics for uploads
in cluster. By default all stats are returned, user can filter the response using
filter query parameter similar to other cluster response.
Scenario 1: No upload is processed
Scenario 2: After 1 successful upload is processed
Scenario 3: After 1 partial upload is processed
Issues Resolved
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.