diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b1a43d57..da5a1aeda3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * 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)) * When a missing client ID in the database is detected, Glean now restores the backup client ID ([#3334](https://github.com/mozilla/glean/pull/3334)) + * Disable the `post_init` health ping ([#3343](https://github.com/mozilla/glean/pull/3343)) * iOS * Glean for iOS is now being built with Xcode 26.2 ([#3350](https://github.com/mozilla/glean/pull/3350)) diff --git a/docs/user/user/collected-metrics/metrics.md b/docs/user/user/collected-metrics/metrics.md index 4d1ba38f3d..9880dce71f 100644 --- a/docs/user/user/collected-metrics/metrics.md +++ b/docs/user/user/collected-metrics/metrics.md @@ -4,7 +4,7 @@ > If you are looking for the metrics collected by Glean.js, > refer to the documentation over on the [`@mozilla/glean.js`](https://github.com/mozilla/glean.js/blob/main/docs/reference/metrics.md) repository. - + # Metrics @@ -141,8 +141,7 @@ In addition to those built-in metrics, the following metrics are added to the pi The purpose of the health ping is to transport all of the health metric information. The `health` ping is automatically sent when the application calls Glean initialize before any operations are done on -the data path with a reason of `pre_init`, and once after Glean -initialization with a reason of `post_init`. +the data path with a reason of `pre_init`. This ping includes the [client id](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section). @@ -158,9 +157,6 @@ This ping includes the [client id](https://mozilla.github.io/glean/book/user/pin **Reasons this ping may be sent:** -- `post_init`: The ping was submitted after Glean initialization with the state of - Glean's data directories after rkv opened files on the data path. - - `pre_init`: The ping was submitted before Glean initialization with the state of Glean's data directories prior to rkv opening files on the data path. @@ -171,7 +167,6 @@ 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.database.load_sizes |[object](https://mozilla.github.io/glean/book/user/metrics/object.html) |The size of the db file during specific phases of initialization. |[Review 1](https://bugzilla.mozilla.org/1990627)||2025-12-01 |1 | | glean.database.rkv_load_error |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |If there was an error loading the RKV database, record it. |[Bug 1815253](https://bugzilla.mozilla.org/show_bug.cgi?id=1815253)||never |1 | | glean.database.size |[memory_distribution](https://mozilla.github.io/glean/book/user/metrics/memory_distribution.html) |The size of the database file at startup. |[Bug 1656589](https://bugzilla.mozilla.org/show_bug.cgi?id=1656589#c7)||never |1 | | glean.database.write_time |[timing_distribution](https://mozilla.github.io/glean/book/user/metrics/timing_distribution.html) |The time it takes for a write-commit for the Glean database. |[Bug 1896193](https://bugzilla.mozilla.org/show_bug.cgi?id=1896193#c4)||never |1 | @@ -179,7 +174,7 @@ In addition to those built-in metrics, the following metrics are added to the pi | glean.error.preinit_tasks_overflow |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |The number of tasks that overflowed the pre-initialization buffer. Only sent if the buffer ever overflows. In Version 0 this reported the total number of tasks enqueued. |[Bug 1609482](https://bugzilla.mozilla.org/show_bug.cgi?id=1609482#c3)||never |1 | | glean.health.data_directory_info |[object](https://mozilla.github.io/glean/book/user/metrics/object.html) |Information about the data directories and files used by FOG. Structure is an array of objects, each containing the following properties: - `dir_name`: The name of the directory. This is the subdirectory name relative to the FOG data directory and should only include "db", "events", and "pending_pings". - `dir_exists`: Whether the directory exists. This should only be false on the first run of FOG, or if the directory was deleted. - `dir_created`: The creation time of the directory, in seconds since the unix epoch. If the directory does not exist, this will be `null` and if the time cannot be determined, it will default to `0`. - `dir_modified`: The last modification time of the directory, in seconds since the unix epoch. If the directory does not exist, this will be `null` and if the time cannot be determined, it will default to `0`. - `file_count`: The number of files in the directory. If the directory does not exist, this will be `0`. - `error_message`: If there was an error accessing the directory, this will contain a brief description of the error. If there was no error, this will be null. - `files`: An array of objects, each containing: - `file_name`: The name of the file. Could be `data.safe.bin`, `events.safe.bin`, or A UUID representing the doc-id of a pending ping. - `file_created`: The creation time of the file, in seconds since the epoch. If the file does not exist, this will be `null` and if the time cannot be determined, it will default to `0`. - `file_modified`: The last modification time of the file, in seconds since the epoch. If the file does not exist, this will be `null` and if the time cannot be determined, it will default to `0`. - `file_size`: The size of the file in bytes. This can be just about any size but a `0` value indicates the file is empty. - `error_message`: If there was an error accessing the file, this will contain a brief description of the error. If there was no error, this will be null. |[Bug 1982711](https://bugzilla.mozilla.org/show_bug.cgi?id=1982711#c3)||never |1 | | glean.health.exception_state |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |An exceptional state was detected upon trying to load the database. Valid options are: - `empty-db` - `regen-db` - `c0ffee-in-db` - `client-id-mismatch` |[Bug 1994757](https://bugzilla.mozilla.org/show_bug.cgi?id=1994757#c2)||never |1 | -| glean.health.file_read_error |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Count of different errors that happened when trying to read the `client_id.txt` file from disk. |[Bug 1994757](https://bugzilla.mozilla.org/show_bug.cgi?id=1994757#c2)||never |1 | +| glean.health.file_read_error |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Count of different errors that happened when trying to read the `client_id.txt` file from disk. |[Bug 1994757](https://bugzilla.mozilla.org/show_bug.cgi?id=1994757#c2)||never |1 | | glean.health.file_write_error |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Count of different errors that happened when trying to write the `client_id.txt` file to disk. |[Bug 1994757](https://bugzilla.mozilla.org/show_bug.cgi?id=1994757#c2)||never |1 | | glean.health.init_count |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |A running count of how many times the Glean SDK has been initialized. |[Review 1](https://bugzilla.mozilla.org/1990624)||never |1 | | glean.health.recovered_client_id |[uuid](https://mozilla.github.io/glean/book/user/metrics/uuid.html) |A client_id recovered from a `client_id.txt` file on disk. Only expected to have a value for the exception states `empty-db`, `c0ffee-in-db` and `client-id-mismatch`. See `exception_state` for different exception states when this can happen. |[Bug 1994757](https://bugzilla.mozilla.org/show_bug.cgi?id=1994757#c2)||never |1 | @@ -260,5 +255,5 @@ In addition to those built-in metrics, the following metrics are added to the pi Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection). - + diff --git a/glean-core/pings.yaml b/glean-core/pings.yaml index 841571364e..a82d0282db 100644 --- a/glean-core/pings.yaml +++ b/glean-core/pings.yaml @@ -108,8 +108,10 @@ health: The purpose of the health ping is to transport all of the health metric information. The `health` ping is automatically sent when the application calls Glean initialize before any operations are done on - the data path with a reason of `pre_init`, and once after Glean - initialization with a reason of `post_init`. + the data path with a reason of `pre_init`. + + Previously a second ping with reason `post_init` was sent. + This reason has been removed in Glean v66.2.0. include_client_id: true bugs: - https://bugzilla.mozilla.org/1667815 @@ -122,9 +124,6 @@ health: pre_init: | The ping was submitted before Glean initialization with the state of Glean's data directories prior to rkv opening files on the data path. - post_init: | - The ping was submitted after Glean initialization with the state of - Glean's data directories after rkv opened files on the data path. deletion-request: description: | diff --git a/glean-core/python/tests/test_glean.py b/glean-core/python/tests/test_glean.py index f2fbc43921..65013eab23 100644 --- a/glean-core/python/tests/test_glean.py +++ b/glean-core/python/tests/test_glean.py @@ -1018,7 +1018,7 @@ def test_glean_shutdown(safe_httpserver): Glean.shutdown() wait_for_requests(safe_httpserver, n=10) - assert 12 == len(safe_httpserver.requests) + assert 11 == len(safe_httpserver.requests) @pytest.mark.skipif(sys.platform == "win32", reason="bug 1979301: Windows failures") diff --git a/glean-core/python/tests/test_network.py b/glean-core/python/tests/test_network.py index ec43e8fcb3..89bd5d750c 100644 --- a/glean-core/python/tests/test_network.py +++ b/glean-core/python/tests/test_network.py @@ -108,7 +108,7 @@ def test_recording_upload_errors_doesnt_clobber_database(tmpdir, safe_httpserver time.sleep(0.5) ProcessDispatcher._wait_for_last_process() - assert 3 == len(safe_httpserver.requests) + assert 2 == len(safe_httpserver.requests) # Force a reload of the database from disk Glean._reset() diff --git a/glean-core/rlb/tests/health_ping.rs b/glean-core/rlb/tests/health_ping.rs index e43bb9231f..28a7a48f8c 100644 --- a/glean-core/rlb/tests/health_ping.rs +++ b/glean-core/rlb/tests/health_ping.rs @@ -68,7 +68,7 @@ fn get_pings(pings_dir: &Path) -> Vec<(String, JsonValue, Option)> { /// Some data is recorded (before and after initialization). /// And later the whole process is shutdown. #[test] -fn test_pre_post_init_health_pings_exist() { +fn test_pre_init_health_pings_exist() { common::enable_test_logging(); // Create a custom configuration to use a validating uploader. @@ -85,48 +85,22 @@ fn test_pre_post_init_health_pings_exist() { // Check for the initialization pings. let pings = get_pings(&tmpname.join("pending_pings")); - pings.iter().for_each(|(url, _, _)| { - println!("Ping URL: {}", url); - }); - assert!(!pings.is_empty()); - assert_eq!( - 2, - pings - .iter() - .filter(|(url, _, _)| url.contains("health")) - .count() - ); - let preinits: Vec<_> = pings - .iter() - .filter(|(url, body, _)| { - url.contains("health") && body["ping_info"]["reason"] == "pre_init" - }) - .collect(); - assert_eq!(1, preinits.len()); - let health_pings: Vec<_> = pings .iter() - .filter(|(url, _, _)| url.contains("health")) + .filter(|(url, _body, _)| url.contains("health")) .collect(); - assert_eq!( - 1, - health_pings - .iter() - .filter(|(_, body, _)| body["ping_info"]["reason"] == "post_init") - .count() - ); + assert_eq!(1, health_pings.len()); + + let preinit = &health_pings[0]; // Ensure both "health" pings have the same init count. assert_eq!( - 2, - health_pings - .iter() - .filter(|(_, body, _)| body["metrics"]["counter"]["glean.health.init_count"] == 1) - .count() + 1, + preinit.1["metrics"]["counter"]["glean.health.init_count"] ); - let exception_state = &preinits[0].1["metrics"]["string"]["glean.health_exception_state"]; + let exception_state = &preinit.1["metrics"]["string"]["glean.health_exception_state"]; assert_eq!(&JsonValue::Null, exception_state); - let exception_uuid = &preinits[0].1["metrics"]["uuid"]["glean.health_recovered_client_id"]; + let exception_uuid = &preinit.1["metrics"]["uuid"]["glean.health_recovered_client_id"]; assert_eq!(&JsonValue::Null, exception_uuid); let cfg = ConfigurationBuilder::new(true, tmpname.clone(), "health-ping-test") @@ -140,11 +114,7 @@ fn test_pre_post_init_health_pings_exist() { let pings = get_pings(&tmpname.join("pending_pings")); let second_preinit: Vec<_> = pings .iter() - .filter(|(url, body, _)| { - url.contains("health") - && body["ping_info"]["reason"] == "pre_init" - && body["ping_info"]["seq"] == 2 - }) + .filter(|(url, body, _)| url.contains("health") && body["ping_info"]["seq"] == 1) .collect(); // We should have a second "pre_init"-reason "health" ping now. diff --git a/glean-core/rlb/tests/health_ping_file_overwrite.rs b/glean-core/rlb/tests/health_ping_file_overwrite.rs index 9fbb7d2764..90fbe9a7c5 100644 --- a/glean-core/rlb/tests/health_ping_file_overwrite.rs +++ b/glean-core/rlb/tests/health_ping_file_overwrite.rs @@ -47,7 +47,7 @@ impl net::PingUploader for ReportingUploader { /// Test scenario: Write a client ID to the backup file and check that it's used after initialization. #[test] -fn test_pre_post_init_health_pings_exist() { +fn test_pre_init_health_ping_exist() { common::enable_test_logging(); // Create a custom configuration to use a validating uploader. diff --git a/glean-core/rlb/tests/test-shutdown-blocking.sh b/glean-core/rlb/tests/test-shutdown-blocking.sh index 12dc257889..1e7d7fc810 100755 --- a/glean-core/rlb/tests/test-shutdown-blocking.sh +++ b/glean-core/rlb/tests/test-shutdown-blocking.sh @@ -20,7 +20,7 @@ datapath=$(mktemp -d "${tmp}/glean_long_running.XXXX") cargo run -p glean --example long-running -- "$datapath" count=$(ls -1q "$datapath/pending_pings" | wc -l) -if [[ "$count" -eq 2 ]]; then # Only one ping, the "health" ping is expected but it is sent twice +if [[ "$count" -eq 1 ]]; then # Only one `health` ping echo "test result: ok." exit 0 else diff --git a/glean-core/rlb/tests/test-thread-crashing.sh b/glean-core/rlb/tests/test-thread-crashing.sh index 0b4f9fbbac..0f2026e16b 100755 --- a/glean-core/rlb/tests/test-thread-crashing.sh +++ b/glean-core/rlb/tests/test-thread-crashing.sh @@ -23,8 +23,8 @@ cargo run -p glean --example crashing-threads -- "$datapath" ret=$? count=$(ls -1q "$datapath/pending_pings" | wc -l) -# 2x "health", 1x "prototype" -expect_count=3 +# 1x "health", 1x "prototype" +expect_count=2 # We expect 1 `prototype` ping: if [[ $ret -eq 0 ]] && [[ "$count" -eq $expect_count ]]; then diff --git a/glean-core/src/internal_pings.rs b/glean-core/src/internal_pings.rs index 2b225f25be..2218891478 100644 --- a/glean-core/src/internal_pings.rs +++ b/glean-core/src/internal_pings.rs @@ -82,7 +82,7 @@ impl InternalPings { true, enabled, vec![], - vec!["pre_init".to_string(), "post_init".to_string()], + vec!["pre_init".to_string()], true, vec![], ), diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 83c45590d9..0f0b85745a 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -588,10 +588,6 @@ fn initialize_inner( // a health ping with reason "pre_init". record_dir_info_and_submit_health_ping(dir_info, "pre_init"); - // Now capture a post_init snapshot of the state of Glean's data directories after initialization to send - // in a health ping with reason "post_init". - record_dir_info_and_submit_health_ping(collect_directory_info(data_path), "post_init"); - let state = global_state().lock().unwrap(); if let Err(e) = state.callbacks.trigger_upload() { log::error!("Triggering upload failed. Error: {}", e);