Skip to content

Commit 2bf52d3

Browse files
afharoTinaHeiligerselasticmachine
authored
[7.x] [Telemetry] Add documentation about Application Usage (#70624) (#70709)
Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent bfce6e8 commit 2bf52d3

File tree

3 files changed

+41
-11
lines changed

3 files changed

+41
-11
lines changed

src/plugins/kibana_usage_collection/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This plugin registers the basic usage collectors from Kibana:
44

5-
- Application Usage
5+
- [Application Usage](./server/collectors/application_usage/README.md)
66
- UI Metrics
77
- Ops stats
88
- Number of Saved Objects per type
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Application Usage
2+
3+
This collector reports the number of general clicks and minutes on screen for each registered application in Kibana.
4+
5+
The final payload matches the following contract:
6+
7+
```JSON
8+
{
9+
"application_usage": {
10+
"application_ID": {
11+
"clicks_7_days": 10,
12+
"clicks_30_days": 100,
13+
"clicks_90_days": 300,
14+
"clicks_total": 600,
15+
"minutes_on_screen_7_days": 10.40,
16+
"minutes_on_screen_30_days": 20.0,
17+
"minutes_on_screen_90_days": 110.1,
18+
"minutes_on_screen_total": 112.5
19+
}
20+
}
21+
}
22+
```
23+
24+
Where `application_ID` matches the `id` registered when calling the method `core.application.register`.
25+
This collection occurs by default for every application registered via the mentioned method and there is no need to do anything else to enable it or _opt-in_ for your plugin.
26+
27+
**Note to maintainers in the Kibana repo:** At the moment of writing, the `usageCollector.schema` is not updated automatically ([#70622](https://github.com/elastic/kibana/issues/70622)) so, if you are adding a new app to Kibana, you'll need to give the Kibana Telemetry team a heads up to update the mappings in the Telemetry Cluster accordingly.
28+
29+
## Developer notes
30+
31+
In order to keep the count of the events, this collector uses 2 Saved Objects:
32+
33+
1. `application_usage_transactional`: It stores each individually reported event (up to 90 days old). Grouped by `timestamp` and `appId`.
34+
2. `application_usage_totals`: It stores the sum of all the events older than 90 days old per `appId`.
35+
36+
Both of them use the shared fields `appId: 'keyword'`, `numberOfClicks: 'long'` and `minutesOnScreen: 'float'`. `application_usage_transactional` also stores `timestamp: { type: 'date' }`.
37+
but they are currently not added in the mappings because we don't use them for search purposes, and we need to be thoughtful with the number of mapped fields in the SavedObjects index ([#43673](https://github.com/elastic/kibana/issues/43673)).

src/plugins/kibana_usage_collection/server/collectors/application_usage/saved_objects_types.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ export function registerMappings(registerType: SavedObjectsServiceSetup['registe
3535
hidden: false,
3636
namespaceType: 'agnostic',
3737
mappings: {
38+
// Not indexing any of its contents because we use them "as-is" and don't search by these fields
39+
// for more info, see the README.md for application_usage
3840
dynamic: false,
39-
properties: {
40-
// Disabled the mapping of these fields since they are not searched and we need to reduce the amount of indexed fields (#43673)
41-
// appId: { type: 'keyword' },
42-
// numberOfClicks: { type: 'long' },
43-
// minutesOnScreen: { type: 'float' },
44-
},
41+
properties: {},
4542
},
4643
});
4744

@@ -53,10 +50,6 @@ export function registerMappings(registerType: SavedObjectsServiceSetup['registe
5350
dynamic: false,
5451
properties: {
5552
timestamp: { type: 'date' },
56-
// Disabled the mapping of these fields since they are not searched and we need to reduce the amount of indexed fields (#43673)
57-
// appId: { type: 'keyword' },
58-
// numberOfClicks: { type: 'long' },
59-
// minutesOnScreen: { type: 'float' },
6053
},
6154
},
6255
});

0 commit comments

Comments
 (0)