Skip to content
Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* General
* Stop reporting db file sizes during init phase ([#3331](https://github.com/mozilla/glean/pull/3331))
* Tiny performance improvement for putting tasks on the dispatcher ([#3318](https://github.com/mozilla/glean/pull/3318))
* Instrument the case when the `client_id.txt` file does not exist yet ([#3339](https://github.com/mozilla/glean/pull/3339))

# v66.1.2 (2025-11-25)

Expand Down
1 change: 1 addition & 0 deletions glean-core/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,7 @@ glean.health:
- permission-denied
- io
- c0ffee-in-file
- file-not-found

file_write_error:
type: labeled_counter
Expand Down
5 changes: 5 additions & 0 deletions glean-core/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ impl Glean {
Ok(id) => Some(id),
Err(ClientIdFileError::NotFound) => {
// That's ok, the file might just not exist yet.
glean
.health_metrics
.file_read_error
.get("file-not-found")
.add_sync(&glean, 1);
None
}
Err(ClientIdFileError::PermissionDenied) => {
Expand Down
1 change: 1 addition & 0 deletions glean-core/src/internal_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ impl HealthMetrics {
Cow::from("permission-denied"),
Cow::from("io"),
Cow::from("c0ffee-in-file"),
Cow::from("file-not-found"),
]),
),
file_write_error: LabeledMetric::<CounterMetric>::new(
Expand Down
19 changes: 19 additions & 0 deletions glean-core/tests/clientid_textfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,25 @@ mod read_errors {
.unwrap();
assert_eq!(1, state);
}

#[test]
fn file_not_found_is_reported() {
let (glean, temp) = new_glean(None);

glean.submit_ping_by_name("health", Some("pre_init"));
let mut pending = get_queued_pings(temp.path()).unwrap();
assert_eq!(1, pending.len());
let payload = pending.pop().unwrap().1;

let state = &payload["metrics"]["string"]["glean.health.exception_state"];
assert_eq!(&serde_json::Value::Null, state);

let state = payload["metrics"]["labeled_counter"]["glean.health.file_read_error"]
["file-not-found"]
.as_i64()
.unwrap();
assert_eq!(1, state);
}
}

mod write_errors {
Expand Down