Refine UI Metric app README and add guidance on tracking multiple metrics in a single request. (#34572)
This commit is contained in:
parent
e6660de89a
commit
2bf18429cc
|
@ -16,11 +16,15 @@ the name of a dashboard they've viewed, or the timestamp of the interaction.
|
|||
|
||||
## How to use it
|
||||
|
||||
To track a user interaction, simply send a `POST` request to `/api/ui_metric/{APP_NAME}/{ACTION_NAME}`,
|
||||
where `APP_MAME` and `ACTION_NAME` are underscore-delimited strings, e.g. `my_app` and `my_action`.
|
||||
To track a user interaction, simply send a `POST` request to `/api/ui_metric/{APP_NAME}/{METRIC_TYPE}`,
|
||||
where `APP_NAME` and `METRIC_TYPE` are underscore-delimited strings. For example, to track the app
|
||||
`my_app` and the metric `my_metric`, send a request to `/api/ui_metric/my_app/my_metric`.
|
||||
|
||||
That's all you need to do!
|
||||
|
||||
To track multiple metrics within a single request, provide multiple metric types separated by
|
||||
commas, e.g. `/api/ui_metric/my_app/my_metric1,my_metric2,my_metric3`.
|
||||
|
||||
### Tracking timed interactions
|
||||
|
||||
If you want to track how long it takes a user to do something, you'll need to implement the timing
|
||||
|
@ -33,25 +37,25 @@ hit `/api/ui_metric/visualize/create_vis_1m`, `/api/ui_metric/visualize/create_v
|
|||
|
||||
## How it works
|
||||
|
||||
Under the hood, your app and action will be stored in a saved object of type `user-metric` and the
|
||||
ID `my_app:my_action`. This saved object will have a `count` property which will be incremented every
|
||||
time the above URI is hit.
|
||||
Under the hood, your app and metric type will be stored in a saved object of type `user-metric` and the
|
||||
ID `ui-metric:my_app:my_metric`. This saved object will have a `count` property which will be incremented
|
||||
every time the above URI is hit.
|
||||
|
||||
These saved objects are automatically consumed by the stats API and surfaced under the
|
||||
`ui_metric` namespace.
|
||||
|
||||
```json
|
||||
{
|
||||
"ui_metric":{
|
||||
"my_app":[
|
||||
"ui_metric": {
|
||||
"my_app": [
|
||||
{
|
||||
"key":"my_action",
|
||||
"value":3
|
||||
"key": "my_metric",
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
By storing these actions and their counts as key-value pairs, we can add more actions without having
|
||||
By storing these metrics and their counts as key-value pairs, we can add more metrics without having
|
||||
to worry about exceeding the 1000-field soft limit in Elasticsearch.
|
Loading…
Reference in a new issue