Bug 1889404 - Add basic telemetry for content relevancy r=bdk
[gecko.git] / toolkit / components / contentrelevancy / docs / telemetry.md
blob90baa28caef21e7a8b34f27fbbb128d25552d7e5
1 # Telemetry
3 This document serves as a complementary doc for all the telemetry we collect for `contentrelevancy`.
4 Note that we use FoG ([Firefox on Glean][FoG]) to record telemetry,
5 all the metrics described below follow the standard Glean metric types.
6 You can reference `metrics.yaml` or [Glean Dictionary][glean-dictionary] for more details for each metric.
8 ## Classification Metrics - `relevancyClassify`
10 When the `contentrelevancy` feature is enabled, it will periodically perform classifications in the background.
11 The following metrics will be recorded for each classification.
13 ### Events
15 #### `succeed`
17 This is recorded when a classification is successfully performed.
18 Various counters are recorded in the `extra_keys` to measure the classification results.
20 Example:
22 ```
23 "extra_keys": {
24     "input_size": 100,             // The input size was 100 items
25     "input_classified_size": 50,   // 50 items (out of 100) were classified with at least one conclusive interest
26     "input_inconclusive_size": 10, // 10 items were classified with the inconclusive interest
27     "output_interest_size": 4      // The total number of unique interests classified
28     "interest_top_1_hits": 20,     // 20 items were classified with the interest with the most hits
29     "interest_top_2_hits": 15,     // 15 items were classified with the interest with the 2nd most hits
30     "interest_top_3_hits": 10,     // 10 items were classified with the interest with the 3rd most hits
32 ```
34 #### `fail`
36 This is recorded when a classification is failed or aborted.
37 The `reason` of the failure is recorded in the `extra_keys`.
39 ```
40 "extra_keys": {
41     "reason": "insufficient-input"  // The classification was aborted due to insufficient input.
42                                     // `store-not-ready` indicates the store is null.
43                                     // `component-errors` indicates an error in the Rust component.
45 ```
47 ### Timing Distribution
49 #### `duration`
51 This records the time duration (in milliseconds) of a successful classification.
52 The durations of unsuccessful classifications are not measured.
54 ## Changelog
56 ### 2024-04
58 * [Bug 1889404][bug-1889404]: Added basic metrics for relevancy manager
60 [FoG]: https://firefox-source-docs.mozilla.org/toolkit/components/glean/index.html
61 [glean-dictionary]: https://dictionary.telemetry.mozilla.org/
62 [bug-1889404]: https://bugzilla.mozilla.org/show_bug.cgi?id=1889404