Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/user/user/collected-metrics/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ In addition to those built-in metrics, the following metrics are added to the pi

| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) |
| --- | --- | --- | --- | --- | --- | --- |
| glean.flow_end |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Recorded when a flow instance ends. Every instance records exactly one. Recorded in the session that owns the instance, after the instance's last tagged event, but never carries a `flows` entry itself. Its timestamp is when Glean noticed the instance had ended, which is when it actually ended only for `reason: exit`. |[Review 1](TODO data review), [Bug 2077138](https://bugzilla.mozilla.org/show_bug.cgi?id=2077138)|<ul><li>flow_name: The name of the flow, as declared in `flows.yaml`.</li><li>flow_seq: The instance's sequence number within its session. Matches `seq` in the `flows` entries of the instance's tagged events. </li><li>reason: Why the instance ended: - "exit": an event in the flow's `ends_on` was recorded - "timeout": the flow's `auto_close_timeout` elapsed - "session_end": the session ended while the instance was active - "abnormal": the app ended abnormally while the instance was active </li><li>session_id: The session that owned the instance. Only present when `reason` is "abnormal", since that `flow_end` is recorded outside any session. </li><li>terminating_event: The event that closed the instance (`category.name`). Only present when `reason` is "exit". </li></ul>|never |1 |
| glean.session_end |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Recorded when a session ends. Always emitted regardless of session sampling. The `reason` extra key describes why the session ended. |[Review 1](TODO data review), [Bug 2020962](https://bugzilla.mozilla.org/show_bug.cgi?id=2020962)|<ul><li>reason: Why the session ended. When in MANUAL mode, the reason can optionally be set by the application. Possible values set by Glean in AUTO or LIFECYCLE session management modes include: - "inactive": client went to background (LIFECYCLE mode) - "replaced": a new session was started while one was already active - "timeout": AUTO mode inactivity timeout expired - "abnormal": session ended due to app crash/force-close - "abnormal_inactive": session was inactive at time of crash </li><li>session_id: The unique UUID of the ended session.</li><li>session_seq: The session sequence number (monotonically increasing across restarts).</li></ul>|never |1 |
| glean.session_start |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Recorded when a new session starts. Always emitted regardless of session sampling so analysts can observe all session boundaries and validate sampling rates. |[Review 1](TODO data review), [Bug 2020962](https://bugzilla.mozilla.org/show_bug.cgi?id=2020962)|<ul><li>sampled_in: Whether this session is sampled in (true) or sampled out (false). Events from sampled-out sessions are suppressed; this field lets analysts validate that the observed sampling rate matches the configured rate. </li><li>session_id: The unique UUID of the started session.</li><li>session_seq: The session sequence number (monotonically increasing across restarts).</li><li>session_start_time: Wall-clock timestamp at session start (RFC 3339). Auxiliary only; per-event timestamps remain authoritative for time-based analysis. </li></ul>|never |1 |

Expand Down
49 changes: 49 additions & 0 deletions glean-core/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,55 @@ glean:
- "abnormal_inactive": session was inactive at time of crash
type: string

flow_end:
type: event
description: |
Recorded when a flow instance ends. Every instance records exactly one.

Recorded in the session that owns the instance, after the instance's last
tagged event, but never carries a `flows` entry itself. Its timestamp is
when Glean noticed the instance had ended, which is when it actually ended
only for `reason: exit`.
send_in_pings:
- events
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=2077138
data_reviews:
- "TODO data review"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahem

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, I'll take care of this before the stack lands.

- https://bugzilla.mozilla.org/show_bug.cgi?id=2077138
data_sensitivity:
- technical
notification_emails:
- glean-team@mozilla.com
expires: never
extra_keys:
flow_name:
description: The name of the flow, as declared in `flows.yaml`.
type: string
flow_seq:
description: |
The instance's sequence number within its session. Matches `seq` in
the `flows` entries of the instance's tagged events.
type: quantity
reason:
description: |
Why the instance ended:
- "exit": an event in the flow's `ends_on` was recorded
- "timeout": the flow's `auto_close_timeout` elapsed
- "session_end": the session ended while the instance was active
- "abnormal": the app ended abnormally while the instance was active
type: string
terminating_event:
description: |
The event that closed the instance (`category.name`). Only present
when `reason` is "exit".
type: string
session_id:
description: |
The session that owned the instance. Only present when `reason` is
"abnormal", since that `flow_end` is recorded outside any session.
type: string

sessions_seen:
type: counter
description: |
Expand Down
5 changes: 4 additions & 1 deletion glean-core/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,10 @@ impl Glean {
///
/// Uses the wall clock, matching `EventMetric::record`. The event's main
/// `timestamp` stays on the monotonic clock.
fn maybe_inject_glean_timestamp(&self, extra: &mut std::collections::HashMap<String, String>) {
pub(crate) fn maybe_inject_glean_timestamp(
&self,
extra: &mut std::collections::HashMap<String, String>,
) {
if self.with_timestamps {
let precise_timestamp = Utc::now().timestamp_millis() as u64;
extra.insert("glean_timestamp".to_string(), precise_timestamp.to_string());
Expand Down
Loading
Loading