Add a VisAugmenter stats API#4006
Add a VisAugmenter stats API#4006abbyhu2000 merged 3 commits intoopensearch-project:feature/feature-anywherefrom
VisAugmenter stats API#4006Conversation
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## feature/feature-anywhere #4006 +/- ##
============================================================
+ Coverage 66.50% 66.52% +0.01%
============================================================
Files 3244 3245 +1
Lines 62432 62459 +27
Branches 9637 9640 +3
============================================================
+ Hits 41520 41550 +30
+ Misses 18604 18601 -3
Partials 2308 2308
Flags with carried forward coverage won't be shown. Click here to find out more.
|
| visName?: string; | ||
| visId?: string; | ||
| visReference?: { | ||
| id: string; | ||
| name: string; | ||
| }; |
There was a problem hiding this comment.
Can we make a separate interface for these attributes? The convention for SavedObjectAttributes is to keep this interface identical to that of the saved object itself. If these properties are not going to be stored in the saved object, lets make a separate interface that extends this instead and use that. Also i dont see this being used anywhere, is it used in the AD plugin? if so can we just create the new interface with these properties there?
There was a problem hiding this comment.
These are used in the saved object actually - the visName, is populated to reference the visualization reference in the references array, and the visId and visReference are populated when pulling out the stored vis in references. This follows the same convention as used by visualization saved object extractReferences/injectReferences logic.
The visualization saved object uses the open-ended SavedObjectAttributes, and uses values there that aren't actually indexed in the saved object. I followed the same. From my understanding, the attributes can be values before/after the reference extraction/injection, based on the arguments to those functions themselves.
References:
visualization extract/inject references: link
augment-vis extract/inject references: link
| origin_plugin: originPluginMap, | ||
| plugin_resource_type: pluginResourceTypeMap, | ||
| plugin_resource_id: pluginResourceIdMap, | ||
| visualization_id: visualizationIdMap, |
There was a problem hiding this comment.
This is just for my understanding, but what do each of these properties mean? like whats the difference between origin_plugin, plugin_resource_type and plugin_resource_id?
There was a problem hiding this comment.
It's mentioned in the description and will be added in the docs, but will add examples here too:
origin_plugin: Anomaly Detection, Alerting
plugin_resource_type: Anomaly Detectors, Alerting Monitors
plugin_resource_id: <detector-1-id>, <monitor-1-id>
| * Given the _find response that contains all of the saved objects, iterate through them and | ||
| * increment counters for each unique value we are tracking |
There was a problem hiding this comment.
We should add some description of what the output exactly means. Maybe providing an example output would help clear things more.
There was a problem hiding this comment.
So this is defined within the resp argument type - SavedObjectsFindResponse. Prefer to not add an example here which could become outdated. By looking up the defined type, it will show the fields.
Also, the saved object list is located under saved_objects field as seen on line 67
Description
Adds a server-side API
/api/vis_augmenter/statsto track usage of the feature. It does this by collecting allaugment-vissaved objects, and aggregating values within them. Specifically:This allows us to track what plugins and plugin resource types are being used (e.g., how many anomaly detectors are associated), as well as the individual IDs of the plugin resources and visualizations, to see if there are any unique patterns in how the feature is being used (e.g., many plugin resources to one visualization compared to roughly 1:1 mapping).
To collect these values, this PR also changes the
augment-vissaved object interface to include all of these fields.Additionally, there's some small type optimizations to the saved object loader to process the individual attributes, by introducing
AugmentVisSavedObjectAttributes. Many of the functions are updated to include this interface.Existing tests are updated and new tests are added for the functions used in the API call.
Issues Resolved
closes #3836
Check List