commit 3b4160acedbe1750e7e8d693ee2a45239c8f5fba
parent 3c2aff68f45f11db43cb9d05907a253f5677dfd4
Author: Jan-Erik Rediger <jrediger@mozilla.com>
Date: Tue, 9 Dec 2025 16:01:28 +0000
Bug 2004919 - Remove temp-fog-initial-state ping (and its data) r=chutten
Differential Revision: https://phabricator.services.mozilla.com/D275619
Diffstat:
4 files changed, 2 insertions(+), 272 deletions(-)
diff --git a/toolkit/components/glean/metrics.yaml b/toolkit/components/glean/metrics.yaml
@@ -66,7 +66,6 @@ fog:
- glean-team@mozilla.com
expires: never
send_in_pings:
- - temp-fog-initial-state
- metrics
- health
@@ -86,77 +85,6 @@ fog:
- glean-team@mozilla.com
expires: never
- data_directory_info:
- type: object
- description: |
- 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`.
- - `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.
- notification_emails:
- - glean-team@mozilla.org
- - tlong@mozilla.com
- bugs:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1979075
- data_reviews:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1979075
- data_sensitivity:
- - technical
- expires: 150
- send_in_pings:
- - temp-fog-initial-state
- - metrics
- structure:
- type: array
- items:
- type: object
- properties:
- dir_name:
- type: string
- dir_exists:
- type: boolean
- dir_created:
- type: number
- dir_modified:
- type: number
- file_count:
- type: number
- files:
- type: array
- items:
- type: object
- properties:
- file_name:
- type: string
- file_created:
- type: number
- file_modified:
- type: number
- file_size:
- type: number
-
subdir_err:
type: labeled_boolean
description: |
diff --git a/toolkit/components/glean/pings.yaml b/toolkit/components/glean/pings.yaml
@@ -40,21 +40,3 @@ dau-reporting:
active: |
The ping was submitted when the application became active again,
which includes when the application starts.
-
-temp-fog-initial-state:
- description: |
- Minimal ping sent immediately before Glean SDK initialization to measure
- initial state of FOG storages and other particulars about the FOG setup.
- include_client_id: true
- send_if_empty: true
- bugs:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1979075
- data_reviews:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1979075
- notification_emails:
- - glean-team@mozilla.com
- - tlong@mozilla.com
- reasons:
- startup: |
- The ping was submitted at startup, immediately before `glean::initialize`
- was called to initialize the Glean SDK.
diff --git a/toolkit/components/glean/src/init/mod.rs b/toolkit/components/glean/src/init/mod.rs
@@ -2,11 +2,11 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
+use std::env;
use std::ffi::{c_char, CStr, CString};
use std::ops::DerefMut;
use std::path::PathBuf;
-use std::time::{Duration, UNIX_EPOCH};
-use std::{env, fs};
+use std::time::Duration;
use firefox_on_glean::{metrics, pings};
use nserror::{nsresult, NS_ERROR_FAILURE};
@@ -120,12 +120,6 @@ fn fog_init_internal(
// Register all custom pings before we initialize.
pings::register_pings(Some(&conf.application_id));
- // Collect directory information for debugging purposes. Nightly only for now.
- if mozbuild::config::NIGHTLY_BUILD {
- log::debug!("Collecting FOG data directory information.");
- collect_directory_info(&conf.data_path);
- }
-
glean::initialize(conf, client_info);
metrics::fog::initializations.stop_and_accumulate(timer_id);
@@ -336,110 +330,6 @@ fn get_app_info() -> Result<(String, String, String, String), nsresult> {
))
}
-/// Collects information about the data directories used by FOG.
-fn collect_directory_info(path: &PathBuf) {
- // List of child directories to check
- let subdirs = ["db", "events", "pending_pings"];
- let mut directories_info = metrics::fog::DataDirectoryInfoObject::new();
-
- for subdir in subdirs.iter() {
- let dir_path = path.join(subdir);
-
- // Initialize a DataDirectoryInfoObjectItem for each directory
- let mut directory_info = metrics::fog::DataDirectoryInfoObjectItem {
- dir_name: Some(subdir.to_string()),
- dir_exists: None,
- dir_created: None,
- dir_modified: None,
- file_count: None,
- files: Vec::new(),
- };
-
- // Check if the directory exists
- if dir_path.is_dir() {
- directory_info.dir_exists = Some(true);
-
- // Get directory metadata
- if let Ok(metadata) = fs::metadata(&dir_path) {
- if let Ok(created) = metadata.created() {
- directory_info.dir_created = Some(
- created
- .duration_since(UNIX_EPOCH)
- .unwrap_or(Duration::ZERO)
- .as_secs() as i64,
- );
- }
- if let Ok(modified) = metadata.modified() {
- directory_info.dir_modified = Some(
- modified
- .duration_since(UNIX_EPOCH)
- .unwrap_or(Duration::ZERO)
- .as_secs() as i64,
- );
- }
- }
-
- // Read the directory's contents
- let mut file_count = 0;
- let Ok(entries) = fs::read_dir(&dir_path) else {
- metrics::fog::subdir_err.get(subdir).set(true);
- continue;
- };
- for entry in entries {
- let Ok(entry) = entry else {
- metrics::fog::subdir_entry_err.get(subdir).add(1);
- continue;
- };
- let Ok(metadata) = entry.metadata() else {
- metrics::fog::subdir_entry_metadata_err.get(subdir).add(1);
- continue;
- };
-
- // Check if the entry is a file
- if metadata.is_file() {
- file_count += 1;
-
- // Collect file details
- let file_size = metadata.len() as i64;
- let modified_time = metadata
- .modified()
- .unwrap_or(UNIX_EPOCH)
- .duration_since(UNIX_EPOCH)
- .unwrap_or(Duration::ZERO)
- .as_secs() as i64;
-
- let creation_time = metadata
- .created()
- .unwrap_or(UNIX_EPOCH)
- .duration_since(UNIX_EPOCH)
- .unwrap_or(Duration::ZERO)
- .as_secs() as i64;
- let file_name = entry.file_name().to_string_lossy().to_string();
-
- let file_info = metrics::fog::DataDirectoryInfoObjectItemItemFilesItem {
- file_name: Some(file_name),
- file_created: Some(creation_time),
- file_modified: Some(modified_time),
- file_size: Some(file_size),
- };
-
- directory_info.files.push(file_info);
- }
- }
-
- directory_info.file_count = Some(file_count as i64);
- } else {
- directory_info.dir_exists = Some(false);
- }
-
- // Add the directory info to the final collection
- directories_info.push(directory_info);
- }
-
- metrics::fog::data_directory_info.set(directories_info);
- pings::temp_fog_initial_state.submit(Some("startup"));
-}
-
/// **TEST-ONLY METHOD**
/// Resets FOG and the underlying Glean SDK, clearing stores.
#[no_mangle]
diff --git a/toolkit/components/glean/tests/xpcshell/test_FOGInit.js b/toolkit/components/glean/tests/xpcshell/test_FOGInit.js
@@ -38,73 +38,3 @@ add_task(function test_fog_initialized_with_correct_rate_limit() {
"FOG has been initialized with a ping rate limit of greater than 0."
);
});
-
-add_task(
- {
- skip_if: () => !AppConstants.NIGHTLY_BUILD,
- },
- function test_fog_gathers_dir_info_on_startup() {
- Assert.deepEqual(
- Glean.fog.dataDirectoryInfo.testGetValue(),
- [
- {
- dir_name: "db",
- dir_exists: false,
- },
- {
- dir_name: "events",
- dir_exists: false,
- },
- {
- dir_name: "pending_pings",
- dir_exists: false,
- },
- ],
- "Directory info was collected on first startup."
- );
- const assertNoErrs = () => {
- // TODO: bug 1986046 - Replace with labeled testGetValue() asserts.
- const subdirs = ["db", "events", "pending_pings"];
- for (const subdir of subdirs) {
- Assert.equal(null, Glean.fog.subdirErr[subdir].testGetValue());
- Assert.equal(null, Glean.fog.subdirEntryErr[subdir].testGetValue());
- Assert.equal(
- null,
- Glean.fog.subdirEntryMetadataErr[subdir].testGetValue()
- );
- }
- };
- assertNoErrs();
-
- // Startup again to make sure we collect the directory info when the dirs exist.
- Services.fog.initializeFOG();
-
- // Record an event to ensure that the directory info is updated with the next startup.
- Glean.testOnly.anEvent.record();
-
- let dir_info = Glean.fog.dataDirectoryInfo.testGetValue();
- Assert.equal(dir_info[0].dir_name, "db");
- Assert.equal(dir_info[0].dir_exists, true);
- // There should be at most 2 files in the db directory, data.safe.bin and maybe data.safe.tmp
- Assert.lessOrEqual(dir_info[0].files.length, 2);
- Assert.greater(dir_info[0].files[0].file_size, 0);
- Assert.equal(dir_info[1].dir_name, "events");
- Assert.equal(dir_info[1].dir_exists, true);
- Assert.equal(dir_info[2].dir_name, "pending_pings");
- Assert.equal(dir_info[2].dir_exists, true);
- assertNoErrs();
-
- Services.fog.initializeFOG();
-
- let new_dir_info = Glean.fog.dataDirectoryInfo.testGetValue();
- Assert.equal(new_dir_info[1].dir_name, "events");
- Assert.equal(new_dir_info[1].dir_exists, true);
- Assert.equal(new_dir_info[1].file_count, 1);
- Assert.equal(new_dir_info[1].files[0].file_name, "test-ping");
- // On Windows the file size metadata is not synced until the file is closed.
- // But Glean is never shutdown in this test and so the metadata doesn't update
- // and the file size seen will be 0, even if the file has been written to.
- Assert.greaterOrEqual(new_dir_info[1].files[0].file_size, 0);
- assertNoErrs();
- }
-);