-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add stats API for maps and layers in maps plugin #362
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #362 +/- ##
=======================================
Coverage ? 73.33%
=======================================
Files ? 26
Lines ? 675
Branches ? 103
=======================================
Hits ? 495
Misses ? 152
Partials ? 28 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it 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.
lgtm
0249a44
to
7c74a3d
Compare
CHANGELOG.md
Outdated
@@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
|
|||
### Infrastructure | |||
* Add CHANGELOG ([#342](https://github.com/opensearch-project/dashboards-maps/pull/342)) | |||
* Add maps metrics api from saved object ([#362](https://github.com/opensearch-project/dashboards-maps/pull/362)) |
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 should better frame this feature.
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.
Some of options, WDYT?
- Add stats API for maps and layers in maps plugin (applied in PR)
- Add endpoint to retrieve maps and layers statistics in maps plugin
- Get maps and layers stats in maps plugin
Also feel free to give other suggestions, thanks!
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.
- Add stats API for maps and layers in maps plugin
This should work.
Lets make sure when we merge the commits we use this same commit message
Signed-off-by: Junqiu Lei <junqiu@amazon.com>
Signed-off-by: Junqiu Lei <junqiu@amazon.com>
server/routes/stats_router.ts
Outdated
try { | ||
const savedObjectsClient = context.core.savedObjects.client; | ||
const mapsSavedObjects: SavedObjectsFindResponse<MapSavedObjectAttributes> = | ||
await savedObjectsClient?.find({ type: MAP_SAVED_OBJECT_TYPE, perPage: 1000, page: 1 }); |
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.
does this mean get only 1000 Maps ?
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, we have define a number here, the default is 20 in 1 page to response, which is obviously not enough.
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.
What if there are 1001 Maps? Are we iterating page?
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.
Updated here to have iteration request, per request will have 50 maps
Signed-off-by: Junqiu Lei <junqiu@amazon.com>
* Add stats API for maps and layers in maps plugin Signed-off-by: Junqiu Lei <junqiu@amazon.com> (cherry picked from commit ef5be8e)
* Add stats API for maps and layers in maps plugin Signed-off-by: Junqiu Lei <junqiu@amazon.com> (cherry picked from commit ef5be8e)
Description
Add maps metrics api to get stats from maps saved object.
It has several metrics related to map layers and maps, including the total number of maps, the number of layers of different types, and information about each map.
GET
/api/maps-dashboards/stats
Response content example:
Issues Resolved
#363
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.