Bug 1955429 - Update to Glean SDK v64.1.1 r=TravisLong,supply-chain-reviewers,mach-reviewers,ahal
Differential Revision: https://phabricator.services.mozilla.com/D244801
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -2580,9 +2580,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glean"
|
name = "glean"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"
|
checksum = "95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"glean-core",
|
"glean-core",
|
||||||
@@ -2594,9 +2594,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glean-core"
|
name = "glean-core"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"
|
checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_logger",
|
"android_logger",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ uniffi_bindgen = "0.29.1"
|
|||||||
# Shared across multiple application-services consumers.
|
# Shared across multiple application-services consumers.
|
||||||
rusqlite = "0.33.0"
|
rusqlite = "0.33.0"
|
||||||
# Shared across multiple glean consumers.
|
# Shared across multiple glean consumers.
|
||||||
glean = "=64.0.1"
|
glean = "=64.1.1"
|
||||||
|
|
||||||
# Explicitly specify what our profiles use. The opt-level setting here is
|
# Explicitly specify what our profiles use. The opt-level setting here is
|
||||||
# a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the
|
# a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the
|
||||||
|
|||||||
8
gfx/wr/Cargo.lock
generated
8
gfx/wr/Cargo.lock
generated
@@ -982,9 +982,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glean"
|
name = "glean"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"
|
checksum = "95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"glean-core",
|
"glean-core",
|
||||||
@@ -996,9 +996,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glean-core"
|
name = "glean-core"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"
|
checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_logger",
|
"android_logger",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ members = [
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
glean = "=64.0.1"
|
glean = "=64.1.1"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = true
|
debug = true
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ serialization = "1.8.1"
|
|||||||
|
|
||||||
# Mozilla versions
|
# Mozilla versions
|
||||||
apilint = "0.5.4"
|
apilint = "0.5.4"
|
||||||
mozilla-glean = "64.0.1"
|
mozilla-glean = "64.1.1"
|
||||||
|
|
||||||
# Testing versions
|
# Testing versions
|
||||||
androidx-test = "1.6.1"
|
androidx-test = "1.6.1"
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ vendored:third_party/python/wheel
|
|||||||
vendored:third_party/python/zipp
|
vendored:third_party/python/zipp
|
||||||
# glean-sdk may not be installable if a wheel isn't available
|
# glean-sdk may not be installable if a wheel isn't available
|
||||||
# and it has to be built from source.
|
# and it has to be built from source.
|
||||||
pypi-optional:glean-sdk==64.0.1:telemetry will not be collected
|
pypi-optional:glean-sdk==64.1.1:telemetry will not be collected
|
||||||
# Mach gracefully handles the case where `psutil` is unavailable.
|
# Mach gracefully handles the case where `psutil` is unavailable.
|
||||||
# We aren't (yet) able to pin packages in automation, so we have to
|
# We aren't (yet) able to pin packages in automation, so we have to
|
||||||
# support down to the oldest locally-installed version (5.4.2).
|
# support down to the oldest locally-installed version (5.4.2).
|
||||||
|
|||||||
@@ -3690,16 +3690,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
|||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
delta = "23.1.0 -> 24.0.0"
|
delta = "23.1.0 -> 24.0.0"
|
||||||
|
|
||||||
[[audits.naga]]
|
|
||||||
who = [
|
|
||||||
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
|
|
||||||
"Erich Gubler <erichdongubler@gmail.com>",
|
|
||||||
"Jim Blandy <jimb@red-bean.com>",
|
|
||||||
]
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
|
|
||||||
importable = false
|
|
||||||
|
|
||||||
[[audits.naga]]
|
[[audits.naga]]
|
||||||
who = "Erich Gubler <erichdongubler@gmail.com>"
|
who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
@@ -5966,16 +5956,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
|||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
delta = "23.0.1 -> 24.0.0"
|
delta = "23.0.1 -> 24.0.0"
|
||||||
|
|
||||||
[[audits.wgpu-core]]
|
|
||||||
who = [
|
|
||||||
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
|
|
||||||
"Erich Gubler <erichdongubler@gmail.com>",
|
|
||||||
"Jim Blandy <jimb@red-bean.com>",
|
|
||||||
]
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
|
|
||||||
importable = false
|
|
||||||
|
|
||||||
[[audits.wgpu-core]]
|
[[audits.wgpu-core]]
|
||||||
who = "Erich Gubler <erichdongubler@gmail.com>"
|
who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
@@ -6087,16 +6067,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
|||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
delta = "23.0.1 -> 24.0.0"
|
delta = "23.0.1 -> 24.0.0"
|
||||||
|
|
||||||
[[audits.wgpu-hal]]
|
|
||||||
who = [
|
|
||||||
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
|
|
||||||
"Erich Gubler <erichdongubler@gmail.com>",
|
|
||||||
"Jim Blandy <jimb@red-bean.com>",
|
|
||||||
]
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
|
|
||||||
importable = false
|
|
||||||
|
|
||||||
[[audits.wgpu-hal]]
|
[[audits.wgpu-hal]]
|
||||||
who = "Erich Gubler <erichdongubler@gmail.com>"
|
who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
@@ -6181,16 +6151,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
|
|||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
delta = "23.0.0 -> 24.0.0"
|
delta = "23.0.0 -> 24.0.0"
|
||||||
|
|
||||||
[[audits.wgpu-types]]
|
|
||||||
who = [
|
|
||||||
"Teodor Tanasoaia <ttanasoaia@mozilla.com>",
|
|
||||||
"Erich Gubler <erichdongubler@gmail.com>",
|
|
||||||
"Jim Blandy <jimb@red-bean.com>",
|
|
||||||
]
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109"
|
|
||||||
importable = false
|
|
||||||
|
|
||||||
[[audits.wgpu-types]]
|
[[audits.wgpu-types]]
|
||||||
who = "Erich Gubler <erichdongubler@gmail.com>"
|
who = "Erich Gubler <erichdongubler@gmail.com>"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
|
|||||||
@@ -289,10 +289,6 @@ notes = "Local override of the crates.io crate that uses a non-vendored local co
|
|||||||
[policy.wr_malloc_size_of]
|
[policy.wr_malloc_size_of]
|
||||||
audit-as-crates-io = false
|
audit-as-crates-io = false
|
||||||
|
|
||||||
[[exemptions.ahash]]
|
|
||||||
version = "0.7.6"
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
|
|
||||||
[[exemptions.alsa]]
|
[[exemptions.alsa]]
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
|
|||||||
@@ -258,15 +258,15 @@ user-login = "jrmuizel"
|
|||||||
user-name = "Jeff Muizelaar"
|
user-name = "Jeff Muizelaar"
|
||||||
|
|
||||||
[[publisher.glean]]
|
[[publisher.glean]]
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
when = "2025-04-01"
|
when = "2025-04-10"
|
||||||
user-id = 48
|
user-id = 48
|
||||||
user-login = "badboy"
|
user-login = "badboy"
|
||||||
user-name = "Jan-Erik Rediger"
|
user-name = "Jan-Erik Rediger"
|
||||||
|
|
||||||
[[publisher.glean-core]]
|
[[publisher.glean-core]]
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
when = "2025-04-01"
|
when = "2025-04-10"
|
||||||
user-id = 48
|
user-id = 48
|
||||||
user-login = "badboy"
|
user-login = "badboy"
|
||||||
user-name = "Jan-Erik Rediger"
|
user-name = "Jan-Erik Rediger"
|
||||||
@@ -970,20 +970,6 @@ criteria = "safe-to-deploy"
|
|||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
notes = "This is a small crate which forbids unsafe code and is a straightforward implementation of the adler hashing algorithm."
|
notes = "This is a small crate which forbids unsafe code and is a straightforward implementation of the adler hashing algorithm."
|
||||||
|
|
||||||
[[audits.bytecode-alliance.audits.ahash]]
|
|
||||||
who = "Chris Fallin <chris@cfallin.org>"
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
delta = "0.7.6 -> 0.8.2"
|
|
||||||
|
|
||||||
[[audits.bytecode-alliance.audits.ahash]]
|
|
||||||
who = "Alex Crichton <alex@alexcrichton.com>"
|
|
||||||
criteria = "safe-to-deploy"
|
|
||||||
delta = "0.8.2 -> 0.8.7"
|
|
||||||
notes = """
|
|
||||||
Shuffling of features in this update and while there are updates to `unsafe`
|
|
||||||
code it's no different than before and the usage remains the same.
|
|
||||||
"""
|
|
||||||
|
|
||||||
[[audits.bytecode-alliance.audits.allocator-api2]]
|
[[audits.bytecode-alliance.audits.allocator-api2]]
|
||||||
who = "Chris Fallin <chris@cfallin.org>"
|
who = "Chris Fallin <chris@cfallin.org>"
|
||||||
criteria = "safe-to-deploy"
|
criteria = "safe-to-deploy"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
4
third_party/rust/glean-core/Cargo.toml
vendored
4
third_party/rust/glean-core/Cargo.toml
vendored
@@ -13,7 +13,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.82"
|
rust-version = "1.82"
|
||||||
name = "glean-core"
|
name = "glean-core"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
authors = [
|
authors = [
|
||||||
"Jan-Erik Rediger <jrediger@mozilla.com>",
|
"Jan-Erik Rediger <jrediger@mozilla.com>",
|
||||||
"The Glean Team <glean-team@mozilla.com>",
|
"The Glean Team <glean-team@mozilla.com>",
|
||||||
@@ -40,7 +40,7 @@ license = "MPL-2.0"
|
|||||||
repository = "https://github.com/mozilla/glean"
|
repository = "https://github.com/mozilla/glean"
|
||||||
|
|
||||||
[package.metadata.glean]
|
[package.metadata.glean]
|
||||||
glean-parser = "17.0.1"
|
glean-parser = "17.1.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "glean_core"
|
name = "glean_core"
|
||||||
|
|||||||
77
third_party/rust/glean-core/src/core/mod.rs
vendored
77
third_party/rust/glean-core/src/core/mod.rs
vendored
@@ -24,8 +24,9 @@ use crate::storage::{StorageManager, INTERNAL_STORAGE};
|
|||||||
use crate::upload::{PingUploadManager, PingUploadTask, UploadResult, UploadTaskAction};
|
use crate::upload::{PingUploadManager, PingUploadTask, UploadResult, UploadTaskAction};
|
||||||
use crate::util::{local_now_with_offset, sanitize_application_id};
|
use crate::util::{local_now_with_offset, sanitize_application_id};
|
||||||
use crate::{
|
use crate::{
|
||||||
scheduler, system, CommonMetricData, ErrorKind, InternalConfiguration, Lifetime, PingRateLimit,
|
scheduler, system, AttributionMetrics, CommonMetricData, DistributionMetrics, ErrorKind,
|
||||||
Result, DEFAULT_MAX_EVENTS, GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID,
|
InternalConfiguration, Lifetime, PingRateLimit, Result, DEFAULT_MAX_EVENTS,
|
||||||
|
GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLEAN: OnceCell<Mutex<Glean>> = OnceCell::new();
|
static GLEAN: OnceCell<Mutex<Glean>> = OnceCell::new();
|
||||||
@@ -1084,4 +1085,76 @@ impl Glean {
|
|||||||
scheduler::schedule(self);
|
scheduler::schedule(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates attribution fields with new values.
|
||||||
|
/// AttributionMetrics fields with `None` values will not overwrite older values.
|
||||||
|
pub fn update_attribution(&self, attribution: AttributionMetrics) {
|
||||||
|
if let Some(source) = attribution.source {
|
||||||
|
self.core_metrics.attribution_source.set_sync(self, source);
|
||||||
|
}
|
||||||
|
if let Some(medium) = attribution.medium {
|
||||||
|
self.core_metrics.attribution_medium.set_sync(self, medium);
|
||||||
|
}
|
||||||
|
if let Some(campaign) = attribution.campaign {
|
||||||
|
self.core_metrics
|
||||||
|
.attribution_campaign
|
||||||
|
.set_sync(self, campaign);
|
||||||
|
}
|
||||||
|
if let Some(term) = attribution.term {
|
||||||
|
self.core_metrics.attribution_term.set_sync(self, term);
|
||||||
|
}
|
||||||
|
if let Some(content) = attribution.content {
|
||||||
|
self.core_metrics
|
||||||
|
.attribution_content
|
||||||
|
.set_sync(self, content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// **TEST-ONLY Method**
|
||||||
|
///
|
||||||
|
/// Returns the current attribution metrics.
|
||||||
|
pub fn test_get_attribution(&self) -> AttributionMetrics {
|
||||||
|
AttributionMetrics {
|
||||||
|
source: self
|
||||||
|
.core_metrics
|
||||||
|
.attribution_source
|
||||||
|
.get_value(self, Some("glean_client_info")),
|
||||||
|
medium: self
|
||||||
|
.core_metrics
|
||||||
|
.attribution_medium
|
||||||
|
.get_value(self, Some("glean_client_info")),
|
||||||
|
campaign: self
|
||||||
|
.core_metrics
|
||||||
|
.attribution_campaign
|
||||||
|
.get_value(self, Some("glean_client_info")),
|
||||||
|
term: self
|
||||||
|
.core_metrics
|
||||||
|
.attribution_term
|
||||||
|
.get_value(self, Some("glean_client_info")),
|
||||||
|
content: self
|
||||||
|
.core_metrics
|
||||||
|
.attribution_content
|
||||||
|
.get_value(self, Some("glean_client_info")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates distribution fields with new values.
|
||||||
|
/// DistributionMetrics fields with `None` values will not overwrite older values.
|
||||||
|
pub fn update_distribution(&self, distribution: DistributionMetrics) {
|
||||||
|
if let Some(name) = distribution.name {
|
||||||
|
self.core_metrics.distribution_name.set_sync(self, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// **TEST-ONLY Method**
|
||||||
|
///
|
||||||
|
/// Returns the current distribution metrics.
|
||||||
|
pub fn test_get_distribution(&self) -> DistributionMetrics {
|
||||||
|
DistributionMetrics {
|
||||||
|
name: self
|
||||||
|
.core_metrics
|
||||||
|
.distribution_name
|
||||||
|
.get_value(self, Some("glean_client_info")),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
111
third_party/rust/glean-core/src/core_metrics.rs
vendored
111
third_party/rust/glean-core/src/core_metrics.rs
vendored
@@ -42,6 +42,58 @@ pub struct ClientInfoMetrics {
|
|||||||
pub locale: Option<String>,
|
pub locale: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Optional product attribution metrics carried in `client_info.attribution`.
|
||||||
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
|
pub struct AttributionMetrics {
|
||||||
|
/// The attribution source (e.g. "google-play").
|
||||||
|
pub source: Option<String>,
|
||||||
|
/// The attribution medium (e.g. "organic" for a search engine).
|
||||||
|
pub medium: Option<String>,
|
||||||
|
/// The attribution campaign (e.g. "mozilla-org").
|
||||||
|
pub campaign: Option<String>,
|
||||||
|
/// The attribution term (e.g. "browser with developer tools for android").
|
||||||
|
pub term: Option<String>,
|
||||||
|
/// The attribution content (e.g. "firefoxview").
|
||||||
|
pub content: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AttributionMetrics {
|
||||||
|
/// Update self with any non-`None` fields from `other`.
|
||||||
|
pub fn update(&mut self, other: AttributionMetrics) {
|
||||||
|
if let Some(source) = other.source {
|
||||||
|
self.source = Some(source);
|
||||||
|
}
|
||||||
|
if let Some(medium) = other.medium {
|
||||||
|
self.medium = Some(medium);
|
||||||
|
}
|
||||||
|
if let Some(campaign) = other.campaign {
|
||||||
|
self.campaign = Some(campaign);
|
||||||
|
}
|
||||||
|
if let Some(term) = other.term {
|
||||||
|
self.term = Some(term);
|
||||||
|
}
|
||||||
|
if let Some(content) = other.content {
|
||||||
|
self.content = Some(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Optional product distribution metrics carried in `client_info.distribution`.
|
||||||
|
#[derive(Clone, Debug, Default, PartialEq)]
|
||||||
|
pub struct DistributionMetrics {
|
||||||
|
/// The distribution name (e.g. "MozillaOnline").
|
||||||
|
pub name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DistributionMetrics {
|
||||||
|
/// Update self with any non-`None` fields from `other`.
|
||||||
|
pub fn update(&mut self, other: DistributionMetrics) {
|
||||||
|
if let Some(name) = other.name {
|
||||||
|
self.name = Some(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Metrics included in every ping as `client_info`.
|
/// Metrics included in every ping as `client_info`.
|
||||||
impl ClientInfoMetrics {
|
impl ClientInfoMetrics {
|
||||||
/// Creates the client info with dummy values for all.
|
/// Creates the client info with dummy values for all.
|
||||||
@@ -204,3 +256,62 @@ pub mod internal_metrics {
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn update_attribution() {
|
||||||
|
let mut attr: AttributionMetrics = Default::default();
|
||||||
|
let empty: AttributionMetrics = Default::default();
|
||||||
|
|
||||||
|
// Ensure the identity operation works.
|
||||||
|
attr.update(empty.clone());
|
||||||
|
assert_eq!(None, attr.source);
|
||||||
|
|
||||||
|
// Ensure simple updates work.
|
||||||
|
attr.update(AttributionMetrics {
|
||||||
|
source: Some("a source".into()),
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
assert_eq!(Some("a source".into()), attr.source);
|
||||||
|
|
||||||
|
// Ensure None doesn't overwrite.
|
||||||
|
attr.update(empty);
|
||||||
|
assert_eq!(Some("a source".into()), attr.source);
|
||||||
|
|
||||||
|
// Ensure updates of Some work.
|
||||||
|
attr.update(AttributionMetrics {
|
||||||
|
source: Some("another source".into()),
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
assert_eq!(Some("another source".into()), attr.source);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn update_distribution() {
|
||||||
|
let mut dist: DistributionMetrics = Default::default();
|
||||||
|
let empty: DistributionMetrics = Default::default();
|
||||||
|
|
||||||
|
// Ensure the identity operation works.
|
||||||
|
dist.update(empty.clone());
|
||||||
|
assert_eq!(None, dist.name);
|
||||||
|
|
||||||
|
// Ensure simple updates work.
|
||||||
|
dist.update(DistributionMetrics {
|
||||||
|
name: Some("a name".into()),
|
||||||
|
});
|
||||||
|
assert_eq!(Some("a name".into()), dist.name);
|
||||||
|
|
||||||
|
// Ensure None doesn't overwrite.
|
||||||
|
dist.update(empty);
|
||||||
|
assert_eq!(Some("a name".into()), dist.name);
|
||||||
|
|
||||||
|
// Ensure updates of Some work.
|
||||||
|
dist.update(DistributionMetrics {
|
||||||
|
name: Some("another name".into()),
|
||||||
|
});
|
||||||
|
assert_eq!(Some("another name".into()), dist.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
24
third_party/rust/glean-core/src/glean.udl
vendored
24
third_party/rust/glean-core/src/glean.udl
vendored
@@ -71,6 +71,18 @@ namespace glean {
|
|||||||
|
|
||||||
PingUploadTask glean_get_upload_task();
|
PingUploadTask glean_get_upload_task();
|
||||||
UploadTaskAction glean_process_ping_upload_response(string uuid, UploadResult result);
|
UploadTaskAction glean_process_ping_upload_response(string uuid, UploadResult result);
|
||||||
|
|
||||||
|
// Updates attribution fields with new values.
|
||||||
|
// AttributionMetrics fields with no values will not overwrite older values.
|
||||||
|
void glean_update_attribution(AttributionMetrics attribution);
|
||||||
|
// Returns the current attribution metrics, if any.
|
||||||
|
AttributionMetrics glean_test_get_attribution();
|
||||||
|
|
||||||
|
// Updates distribution fields with new values.
|
||||||
|
// DistributionMetrics fields with no values will not overwrite older values.
|
||||||
|
void glean_update_distribution(DistributionMetrics distribution);
|
||||||
|
// Returns the current distribution metrics, if any.
|
||||||
|
DistributionMetrics glean_test_get_distribution();
|
||||||
};
|
};
|
||||||
|
|
||||||
// A `Cow<'static, str>`, but really it's always the owned part.
|
// A `Cow<'static, str>`, but really it's always the owned part.
|
||||||
@@ -138,6 +150,18 @@ dictionary ClientInfoMetrics {
|
|||||||
i64? windows_build_number = null;
|
i64? windows_build_number = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dictionary AttributionMetrics {
|
||||||
|
string? source = null;
|
||||||
|
string? medium = null;
|
||||||
|
string? campaign = null;
|
||||||
|
string? term = null;
|
||||||
|
string? content = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
dictionary DistributionMetrics {
|
||||||
|
string? name = null;
|
||||||
|
};
|
||||||
|
|
||||||
[Error]
|
[Error]
|
||||||
enum CallbackError {
|
enum CallbackError {
|
||||||
"UnexpectedError",
|
"UnexpectedError",
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ pub struct CoreMetrics {
|
|||||||
pub client_id: UuidMetric,
|
pub client_id: UuidMetric,
|
||||||
pub first_run_date: DatetimeMetric,
|
pub first_run_date: DatetimeMetric,
|
||||||
pub os: StringMetric,
|
pub os: StringMetric,
|
||||||
|
pub attribution_source: StringMetric,
|
||||||
|
pub attribution_medium: StringMetric,
|
||||||
|
pub attribution_campaign: StringMetric,
|
||||||
|
pub attribution_term: StringMetric,
|
||||||
|
pub attribution_content: StringMetric,
|
||||||
|
pub distribution_name: StringMetric,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -65,6 +71,60 @@ impl CoreMetrics {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
dynamic_label: None,
|
dynamic_label: None,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
attribution_source: StringMetric::new(CommonMetricData {
|
||||||
|
name: "source".into(),
|
||||||
|
category: "attribution".into(),
|
||||||
|
send_in_pings: vec!["glean_client_info".into()],
|
||||||
|
lifetime: Lifetime::User,
|
||||||
|
disabled: false,
|
||||||
|
dynamic_label: None,
|
||||||
|
}),
|
||||||
|
|
||||||
|
attribution_medium: StringMetric::new(CommonMetricData {
|
||||||
|
name: "medium".into(),
|
||||||
|
category: "attribution".into(),
|
||||||
|
send_in_pings: vec!["glean_client_info".into()],
|
||||||
|
lifetime: Lifetime::User,
|
||||||
|
disabled: false,
|
||||||
|
dynamic_label: None,
|
||||||
|
}),
|
||||||
|
|
||||||
|
attribution_campaign: StringMetric::new(CommonMetricData {
|
||||||
|
name: "campaign".into(),
|
||||||
|
category: "attribution".into(),
|
||||||
|
send_in_pings: vec!["glean_client_info".into()],
|
||||||
|
lifetime: Lifetime::User,
|
||||||
|
disabled: false,
|
||||||
|
dynamic_label: None,
|
||||||
|
}),
|
||||||
|
|
||||||
|
attribution_term: StringMetric::new(CommonMetricData {
|
||||||
|
name: "term".into(),
|
||||||
|
category: "attribution".into(),
|
||||||
|
send_in_pings: vec!["glean_client_info".into()],
|
||||||
|
lifetime: Lifetime::User,
|
||||||
|
disabled: false,
|
||||||
|
dynamic_label: None,
|
||||||
|
}),
|
||||||
|
|
||||||
|
attribution_content: StringMetric::new(CommonMetricData {
|
||||||
|
name: "content".into(),
|
||||||
|
category: "attribution".into(),
|
||||||
|
send_in_pings: vec!["glean_client_info".into()],
|
||||||
|
lifetime: Lifetime::User,
|
||||||
|
disabled: false,
|
||||||
|
dynamic_label: None,
|
||||||
|
}),
|
||||||
|
|
||||||
|
distribution_name: StringMetric::new(CommonMetricData {
|
||||||
|
name: "name".into(),
|
||||||
|
category: "distribution".into(),
|
||||||
|
send_in_pings: vec!["glean_client_info".into()],
|
||||||
|
lifetime: Lifetime::User,
|
||||||
|
disabled: false,
|
||||||
|
dynamic_label: None,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
74
third_party/rust/glean-core/src/lib.rs
vendored
74
third_party/rust/glean-core/src/lib.rs
vendored
@@ -59,7 +59,7 @@ mod fd_logger;
|
|||||||
|
|
||||||
pub use crate::common_metric_data::{CommonMetricData, Lifetime};
|
pub use crate::common_metric_data::{CommonMetricData, Lifetime};
|
||||||
pub use crate::core::Glean;
|
pub use crate::core::Glean;
|
||||||
pub use crate::core_metrics::ClientInfoMetrics;
|
pub use crate::core_metrics::{AttributionMetrics, ClientInfoMetrics, DistributionMetrics};
|
||||||
pub use crate::error::{Error, ErrorKind, Result};
|
pub use crate::error::{Error, ErrorKind, Result};
|
||||||
pub use crate::error_recording::{test_get_num_recorded_errors, ErrorType};
|
pub use crate::error_recording::{test_get_num_recorded_errors, ErrorType};
|
||||||
pub use crate::histogram::HistogramType;
|
pub use crate::histogram::HistogramType;
|
||||||
@@ -102,6 +102,10 @@ static PRE_INIT_SOURCE_TAGS: Mutex<Vec<String>> = Mutex::new(Vec::new());
|
|||||||
static PRE_INIT_PING_REGISTRATION: Mutex<Vec<metrics::PingType>> = Mutex::new(Vec::new());
|
static PRE_INIT_PING_REGISTRATION: Mutex<Vec<metrics::PingType>> = Mutex::new(Vec::new());
|
||||||
static PRE_INIT_PING_ENABLED: Mutex<Vec<(metrics::PingType, bool)>> = Mutex::new(Vec::new());
|
static PRE_INIT_PING_ENABLED: Mutex<Vec<(metrics::PingType, bool)>> = Mutex::new(Vec::new());
|
||||||
|
|
||||||
|
/// Keep track of attribution and distribution supplied before Glean is initialized.
|
||||||
|
static PRE_INIT_ATTRIBUTION: Mutex<Option<AttributionMetrics>> = Mutex::new(None);
|
||||||
|
static PRE_INIT_DISTRIBUTION: Mutex<Option<DistributionMetrics>> = Mutex::new(None);
|
||||||
|
|
||||||
/// Global singleton of the handles of the glean.init threads.
|
/// Global singleton of the handles of the glean.init threads.
|
||||||
/// For joining. For tests.
|
/// For joining. For tests.
|
||||||
/// (Why a Vec? There might be more than one concurrent call to initialize.)
|
/// (Why a Vec? There might be more than one concurrent call to initialize.)
|
||||||
@@ -448,6 +452,15 @@ fn initialize_inner(
|
|||||||
glean.set_ping_enabled(ping, *enabled);
|
glean.set_ping_enabled(ping, *enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The attribution and distribution might have been set before initialize,
|
||||||
|
// take the cached values and set them.
|
||||||
|
if let Some(attribution) = PRE_INIT_ATTRIBUTION.lock().unwrap().take() {
|
||||||
|
glean.update_attribution(attribution);
|
||||||
|
}
|
||||||
|
if let Some(distribution) = PRE_INIT_DISTRIBUTION.lock().unwrap().take() {
|
||||||
|
glean.update_distribution(distribution);
|
||||||
|
}
|
||||||
|
|
||||||
// If this is the first time ever the Glean SDK runs, make sure to set
|
// If this is the first time ever the Glean SDK runs, make sure to set
|
||||||
// some initial core metrics in case we need to generate early pings.
|
// some initial core metrics in case we need to generate early pings.
|
||||||
// The next times we start, we would have them around already.
|
// The next times we start, we would have them around already.
|
||||||
@@ -874,7 +887,7 @@ pub fn glean_set_collection_enabled(enabled: bool) {
|
|||||||
/// and all pending pings of that type to be deleted.
|
/// and all pending pings of that type to be deleted.
|
||||||
pub fn set_ping_enabled(ping: &PingType, enabled: bool) {
|
pub fn set_ping_enabled(ping: &PingType, enabled: bool) {
|
||||||
let ping = ping.clone();
|
let ping = ping.clone();
|
||||||
if was_initialize_called() {
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
crate::launch_with_glean_mut(move |glean| glean.set_ping_enabled(&ping, enabled));
|
crate::launch_with_glean_mut(move |glean| glean.set_ping_enabled(&ping, enabled));
|
||||||
} else {
|
} else {
|
||||||
let m = &PRE_INIT_PING_ENABLED;
|
let m = &PRE_INIT_PING_ENABLED;
|
||||||
@@ -889,7 +902,7 @@ pub(crate) fn register_ping_type(ping: &PingType) {
|
|||||||
// we dispatch ping registration on the thread pool.
|
// we dispatch ping registration on the thread pool.
|
||||||
// Registering a ping should not block the application.
|
// Registering a ping should not block the application.
|
||||||
// Submission itself is also dispatched, so it will always come after the registration.
|
// Submission itself is also dispatched, so it will always come after the registration.
|
||||||
if was_initialize_called() {
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
let ping = ping.clone();
|
let ping = ping.clone();
|
||||||
crate::launch_with_glean_mut(move |glean| {
|
crate::launch_with_glean_mut(move |glean| {
|
||||||
glean.register_ping_type(&ping);
|
glean.register_ping_type(&ping);
|
||||||
@@ -1003,7 +1016,7 @@ pub fn glean_apply_server_knobs_config(json: String) {
|
|||||||
/// This will return `false` in case `tag` is not a valid tag and `true` otherwise.
|
/// This will return `false` in case `tag` is not a valid tag and `true` otherwise.
|
||||||
/// If called before Glean is initialized it will always return `true`.
|
/// If called before Glean is initialized it will always return `true`.
|
||||||
pub fn glean_set_debug_view_tag(tag: String) -> bool {
|
pub fn glean_set_debug_view_tag(tag: String) -> bool {
|
||||||
if was_initialize_called() {
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
crate::launch_with_glean_mut(move |glean| {
|
crate::launch_with_glean_mut(move |glean| {
|
||||||
glean.set_debug_view_tag(&tag);
|
glean.set_debug_view_tag(&tag);
|
||||||
});
|
});
|
||||||
@@ -1041,7 +1054,7 @@ pub fn glean_get_debug_view_tag() -> Option<String> {
|
|||||||
/// * `tags` - A vector of at most 5 valid HTTP header values. Individual
|
/// * `tags` - A vector of at most 5 valid HTTP header values. Individual
|
||||||
/// tags must match the regex: "[a-zA-Z0-9-]{1,20}".
|
/// tags must match the regex: "[a-zA-Z0-9-]{1,20}".
|
||||||
pub fn glean_set_source_tags(tags: Vec<String>) -> bool {
|
pub fn glean_set_source_tags(tags: Vec<String>) -> bool {
|
||||||
if was_initialize_called() {
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
crate::launch_with_glean_mut(|glean| {
|
crate::launch_with_glean_mut(|glean| {
|
||||||
glean.set_source_tags(tags);
|
glean.set_source_tags(tags);
|
||||||
});
|
});
|
||||||
@@ -1066,7 +1079,7 @@ pub fn glean_set_source_tags(tags: Vec<String>) -> bool {
|
|||||||
///
|
///
|
||||||
/// * `value` - The value of the log pings option
|
/// * `value` - The value of the log pings option
|
||||||
pub fn glean_set_log_pings(value: bool) {
|
pub fn glean_set_log_pings(value: bool) {
|
||||||
if was_initialize_called() {
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
crate::launch_with_glean_mut(move |glean| {
|
crate::launch_with_glean_mut(move |glean| {
|
||||||
glean.set_log_pings(value);
|
glean.set_log_pings(value);
|
||||||
});
|
});
|
||||||
@@ -1163,7 +1176,8 @@ pub fn glean_submit_ping_by_name_sync(ping_name: String, reason: Option<String>)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
core::with_glean(|glean| glean.submit_ping_by_name(&ping_name, reason.as_deref()))
|
core::with_opt_glean(|glean| glean.submit_ping_by_name(&ping_name, reason.as_deref()))
|
||||||
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EXPERIMENTAL: Register a listener object to recieve notifications of event recordings.
|
/// EXPERIMENTAL: Register a listener object to recieve notifications of event recordings.
|
||||||
@@ -1255,6 +1269,52 @@ pub fn glean_set_dirty_flag(new_value: bool) {
|
|||||||
core::with_glean(|glean| glean.set_dirty_flag(new_value))
|
core::with_glean(|glean| glean.set_dirty_flag(new_value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates attribution fields with new values.
|
||||||
|
/// AttributionMetrics fields with `None` values will not overwrite older values.
|
||||||
|
pub fn glean_update_attribution(attribution: AttributionMetrics) {
|
||||||
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
|
core::with_glean(|glean| glean.update_attribution(attribution));
|
||||||
|
} else {
|
||||||
|
PRE_INIT_ATTRIBUTION
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.get_or_insert(Default::default())
|
||||||
|
.update(attribution);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// **TEST-ONLY Method**
|
||||||
|
///
|
||||||
|
/// Returns the current attribution metrics.
|
||||||
|
/// Panics if called before init.
|
||||||
|
pub fn glean_test_get_attribution() -> AttributionMetrics {
|
||||||
|
join_init();
|
||||||
|
core::with_glean(|glean| glean.test_get_attribution())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates distribution fields with new values.
|
||||||
|
/// DistributionMetrics fields with `None` values will not overwrite older values.
|
||||||
|
pub fn glean_update_distribution(distribution: DistributionMetrics) {
|
||||||
|
if was_initialize_called() && core::global_glean().is_some() {
|
||||||
|
core::with_glean(|glean| glean.update_distribution(distribution));
|
||||||
|
} else {
|
||||||
|
PRE_INIT_DISTRIBUTION
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.get_or_insert(Default::default())
|
||||||
|
.update(distribution);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// **TEST-ONLY Method**
|
||||||
|
///
|
||||||
|
/// Returns the current distribution metrics.
|
||||||
|
/// Panics if called before init.
|
||||||
|
pub fn glean_test_get_distribution() -> DistributionMetrics {
|
||||||
|
join_init();
|
||||||
|
core::with_glean(|glean| glean.test_get_distribution())
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
|
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
|
||||||
static FD_LOGGER: OnceCell<fd_logger::FdLogger> = OnceCell::new();
|
static FD_LOGGER: OnceCell<fd_logger::FdLogger> = OnceCell::new();
|
||||||
|
|
||||||
|
|||||||
@@ -396,6 +396,58 @@ fn client_id_is_set_to_random_value_when_uploading_enabled_at_start() {
|
|||||||
assert_ne!(*KNOWN_CLIENT_ID, current_client_id.unwrap());
|
assert_ne!(*KNOWN_CLIENT_ID, current_client_id.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn attribution_and_distribution_are_correctly_stored() {
|
||||||
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
let tmpname = dir.path().display().to_string();
|
||||||
|
let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true);
|
||||||
|
|
||||||
|
// On a fresh Glean, no attribution or distribution information is set.
|
||||||
|
assert_eq!(
|
||||||
|
<AttributionMetrics as Default>::default(),
|
||||||
|
glean.test_get_attribution()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
<DistributionMetrics as Default>::default(),
|
||||||
|
glean.test_get_distribution()
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut attribution = AttributionMetrics {
|
||||||
|
source: Some("source".into()),
|
||||||
|
medium: Some("medium".into()),
|
||||||
|
campaign: Some("campaign".into()),
|
||||||
|
term: Some("term".into()),
|
||||||
|
content: Some("content".into()),
|
||||||
|
};
|
||||||
|
let distribution = DistributionMetrics {
|
||||||
|
name: Some("name".into()),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set them all at once.
|
||||||
|
glean.update_attribution(attribution.clone());
|
||||||
|
glean.update_distribution(distribution.clone());
|
||||||
|
|
||||||
|
assert_eq!(attribution, glean.test_get_attribution());
|
||||||
|
assert_eq!(distribution, glean.test_get_distribution());
|
||||||
|
|
||||||
|
let attribution_update = AttributionMetrics {
|
||||||
|
campaign: Some("new campaign".into()),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let distribution_update = DistributionMetrics {
|
||||||
|
name: Some("new name".into()),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Perform updates.
|
||||||
|
glean.update_attribution(attribution_update);
|
||||||
|
glean.update_distribution(distribution_update.clone());
|
||||||
|
|
||||||
|
// Ensure only the updated fields took over
|
||||||
|
attribution.campaign = Some("new campaign".into());
|
||||||
|
assert_eq!(attribution, glean.test_get_attribution());
|
||||||
|
assert_eq!(distribution_update, glean.test_get_distribution());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn enabling_when_already_enabled_is_a_noop() {
|
fn enabling_when_already_enabled_is_a_noop() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use crate::Glean;
|
|||||||
|
|
||||||
const MAX_LABELS: usize = 16;
|
const MAX_LABELS: usize = 16;
|
||||||
const OTHER_LABEL: &str = "__other__";
|
const OTHER_LABEL: &str = "__other__";
|
||||||
const MAX_LABEL_LENGTH: usize = 71;
|
const MAX_LABEL_LENGTH: usize = 111;
|
||||||
|
|
||||||
/// A labeled counter.
|
/// A labeled counter.
|
||||||
pub type LabeledCounter = LabeledMetric<CounterMetric>;
|
pub type LabeledCounter = LabeledMetric<CounterMetric>;
|
||||||
@@ -265,7 +265,7 @@ where
|
|||||||
/// only the first 16 unique labels will be used.
|
/// only the first 16 unique labels will be used.
|
||||||
/// After that, any additional labels will be recorded under the special `OTHER_LABEL` label.
|
/// After that, any additional labels will be recorded under the special `OTHER_LABEL` label.
|
||||||
///
|
///
|
||||||
/// Labels must be `snake_case` and less than 30 characters.
|
/// Labels must have a maximum of 111 characters, and may comprise any printable ASCII characters.
|
||||||
/// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label.
|
/// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label.
|
||||||
pub fn get<S: AsRef<str>>(&self, label: S) -> Arc<T> {
|
pub fn get<S: AsRef<str>>(&self, label: S) -> Arc<T> {
|
||||||
let label = label.as_ref();
|
let label = label.as_ref();
|
||||||
|
|||||||
32
third_party/rust/glean-core/src/ping/mod.rs
vendored
32
third_party/rust/glean-core/src/ping/mod.rs
vendored
@@ -176,8 +176,36 @@ impl PingMaker {
|
|||||||
StorageManager.snapshot_as_json(glean.storage(), "glean_client_info", true)
|
StorageManager.snapshot_as_json(glean.storage(), "glean_client_info", true)
|
||||||
{
|
{
|
||||||
let client_info_obj = client_info.as_object().unwrap(); // safe unwrap, snapshot always returns an object.
|
let client_info_obj = client_info.as_object().unwrap(); // safe unwrap, snapshot always returns an object.
|
||||||
for (_key, value) in client_info_obj {
|
for (_metric_type, metrics) in client_info_obj {
|
||||||
merge(&mut map, value);
|
merge(&mut map, metrics);
|
||||||
|
}
|
||||||
|
let map = map.as_object_mut().unwrap(); // safe unwrap, we created the object above.
|
||||||
|
let mut attribution = serde_json::Map::new();
|
||||||
|
let mut distribution = serde_json::Map::new();
|
||||||
|
map.retain(|name, value| {
|
||||||
|
// Only works because we ensure no client_info metric categories contain '.'.
|
||||||
|
let mut split = name.split('.');
|
||||||
|
let category = split.next();
|
||||||
|
let name = split.next();
|
||||||
|
if let (Some(category), Some(name)) = (category, name) {
|
||||||
|
if category == "attribution" {
|
||||||
|
attribution.insert(name.into(), value.take());
|
||||||
|
false
|
||||||
|
} else if category == "distribution" {
|
||||||
|
distribution.insert(name.into(), value.take());
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if !attribution.is_empty() {
|
||||||
|
map.insert("attribution".into(), serde_json::Value::from(attribution));
|
||||||
|
}
|
||||||
|
if !distribution.is_empty() {
|
||||||
|
map.insert("distribution".into(), serde_json::Value::from(distribution));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log::warn!("Empty client info data.");
|
log::warn!("Empty client info data.");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ where
|
|||||||
/// only the first 16 unique labels will be used.
|
/// only the first 16 unique labels will be used.
|
||||||
/// After that, any additional labels will be recorded under the special `OTHER_LABEL` label.
|
/// After that, any additional labels will be recorded under the special `OTHER_LABEL` label.
|
||||||
///
|
///
|
||||||
/// Labels must be `snake_case` and less than 30 characters.
|
/// Labels must have a maximum of 111 characters, and may comprise any printable ASCII characters.
|
||||||
/// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label.
|
/// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label.
|
||||||
fn get(&self, label: &str) -> T;
|
fn get(&self, label: &str) -> T;
|
||||||
|
|
||||||
|
|||||||
2
third_party/rust/glean-core/tests/labeled.rs
vendored
2
third_party/rust/glean-core/tests/labeled.rs
vendored
@@ -387,7 +387,7 @@ fn dynamic_labels_too_long() {
|
|||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
let metric = labeled.get("1".repeat(72));
|
let metric = labeled.get("1".repeat(112));
|
||||||
metric.add_sync(&glean, 1);
|
metric.add_sync(&glean, 1);
|
||||||
|
|
||||||
let snapshot = StorageManager
|
let snapshot = StorageManager
|
||||||
|
|||||||
68
third_party/rust/glean-core/tests/ping_maker.rs
vendored
68
third_party/rust/glean-core/tests/ping_maker.rs
vendored
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
use glean_core::{AttributionMetrics, DistributionMetrics};
|
||||||
|
use serde_json::json;
|
||||||
|
|
||||||
use glean_core::metrics::*;
|
use glean_core::metrics::*;
|
||||||
use glean_core::ping::PingMaker;
|
use glean_core::ping::PingMaker;
|
||||||
@@ -306,3 +308,69 @@ fn metadata_is_correctly_added_when_necessary() {
|
|||||||
let headers = metadata.as_ref().unwrap().get("headers").unwrap();
|
let headers = metadata.as_ref().unwrap().get("headers").unwrap();
|
||||||
assert_eq!(headers.get("X-Debug-ID").unwrap(), "valid-tag");
|
assert_eq!(headers.get("X-Debug-ID").unwrap(), "valid-tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn attribution_and_distribution_appear_in_client_info() {
|
||||||
|
let (glean, ping_maker, ping_type, _t) = set_up_basic_ping();
|
||||||
|
|
||||||
|
let attribution = AttributionMetrics {
|
||||||
|
source: Some("source".into()),
|
||||||
|
medium: Some("medium".into()),
|
||||||
|
campaign: Some("campaign".into()),
|
||||||
|
term: Some("term".into()),
|
||||||
|
content: Some("content".into()),
|
||||||
|
};
|
||||||
|
let distribution = DistributionMetrics {
|
||||||
|
name: Some("name".into()),
|
||||||
|
};
|
||||||
|
glean.update_attribution(attribution);
|
||||||
|
glean.update_distribution(distribution);
|
||||||
|
|
||||||
|
let ping = ping_maker
|
||||||
|
.collect(&glean, &ping_type, None, "", "")
|
||||||
|
.unwrap();
|
||||||
|
let client_info = ping.content["client_info"].as_object().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(json!({"name": "name"}), client_info["distribution"]);
|
||||||
|
assert_eq!(
|
||||||
|
json!({
|
||||||
|
"source": "source",
|
||||||
|
"medium": "medium",
|
||||||
|
"campaign": "campaign",
|
||||||
|
"term": "term",
|
||||||
|
"content": "content",
|
||||||
|
}),
|
||||||
|
client_info["attribution"]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Now let's test updated values.
|
||||||
|
let attribution_update = AttributionMetrics {
|
||||||
|
content: Some("what a boring word".into()),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let distribution_update = DistributionMetrics {
|
||||||
|
name: Some("what's in a name".into()),
|
||||||
|
};
|
||||||
|
glean.update_attribution(attribution_update);
|
||||||
|
glean.update_distribution(distribution_update);
|
||||||
|
|
||||||
|
let ping = ping_maker
|
||||||
|
.collect(&glean, &ping_type, None, "", "")
|
||||||
|
.unwrap();
|
||||||
|
let client_info = ping.content["client_info"].as_object().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
json!({"name": "what's in a name"}),
|
||||||
|
client_info["distribution"]
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
json!({
|
||||||
|
"source": "source",
|
||||||
|
"medium": "medium",
|
||||||
|
"campaign": "campaign",
|
||||||
|
"term": "term",
|
||||||
|
"content": "what a boring word",
|
||||||
|
}),
|
||||||
|
client_info["attribution"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
2
third_party/rust/glean/.cargo-checksum.json
vendored
2
third_party/rust/glean/.cargo-checksum.json
vendored
@@ -1 +1 @@
|
|||||||
{"files":{"Cargo.lock":"61c7d6620026e84a7bb067305d92ffb8c51a59261c339d3ef6a8406d03bbfd92","Cargo.toml":"bec966c61ac0670d367556c54f9156aad7b2cd72dce2d09c783fdf421f49c563","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"61b56a35c2bc6cd60bba2225b399881512d4b9a7d8cadca7fbed37ee6959d74c","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"09ba010b03d045fd8a2ccbe4f205c5275bb622bceb34cb81a0aa8f7d33804e2e","src/private/event.rs":"f299c79e4e2acb657f06004f3038bd8909e287719458566bc7f96262d8665e62","src/private/mod.rs":"66e90c41de74d1e80c5d3f49b8f1a86b8396be0b8c4a80f1a28903fe6d105ecf","src/private/object.rs":"7f17a7a658e8f7aa19a6bedf70f60f3f42713316d5d60298d682bb045caaafb7","src/private/ping.rs":"d2fb45e9e178ff6b17aa9c1b5258dfcd2ed91a2b43b44dec826de256ef5e8520","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"bfbea9416dfdc96ebc1f9af5005b5b23f2285b74ef82c74cdab11635322ea3e3","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"47c13d1f39adf3881e10caa19e0c08235f08958809e234bf37a79d37d7322cd5","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"3d954bbe47d4f5fd103c51a4ff99f151662143c25c826da9734a00cd215909b9","tests/memory_distribution_buffered.rs":"db487475a5cf17a0864ccf150984ebdd28bf616573772cf678246cc1bdbcbc0f","tests/metric_metadata.rs":"05c947d3decf0a3281378dbb108080a05319ad8f130af5b07f9b049b80e5f04f","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"985e140460a100986fd051ce901b787a3a7a9747a856cd06066b740ac7d2381c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"15c76a1b5a336fd6abfbdebafc971f5c6a9b75107ddbca65f0031cde3e2886da","tests/test-delayed-ping-data.sh":"4a6db98b4df6b77898ace6a8b4e8b4c60d3e5c44873bbf38c62e83583e27a3ff","tests/test-enabled-pings.sh":"06656e38f63e65475006b107dd6bd179b0cbaa1fad1470de38e679e91a9315a3","tests/test-pending-gets-removed.sh":"e335f2f00fa97a61b6d94e0005fb3b9de8c8db8076111a67ca47d85392039ea9","tests/test-ping-lifetime-flush.sh":"e8f118ea2f6fd973809e38d5e828a03cfccfe0b0f497ccde5ec92d6d1380c071","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"f3cd0cc8a7b4fe82bef0fe6fbfbbe45fbad6da3afe0f82578bc5cfb2d6527ac6","tests/timing_distribution_buffered.rs":"501f7289c0c28f0ab83838c88b058999b19436d0f2b693be0787513d7b67e06d","tests/timing_distribution_single_sample.rs":"4f9498b6ef29913da0356027efe5f572c81d2f426e8538c068b54a1cfa33c1b8","tests/upload_timing.rs":"b3b9db197bc2ec41556388969a6bf289e7ef19e05b9019bc2bd98c823fcf6ea3","tests/uploader_capabilities.rs":"347f19e534a50a211ea179d6818631270d1b4ec468098e6b6abcde1e4a6a9bca"},"package":"251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"}
|
{"files":{"Cargo.lock":"add20d32d164cac0a56ddac41468eaf0b23b9616f32e94a8434f5841d14b3a97","Cargo.toml":"99107d6ac4ef4ff33e2d206e8498875df879001e4621ba94e9d4ccf14267f39c","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"998359d04ba0f71aaa360b8999c716f22c9efaf1ff4e1fdce80f1d3af5e584b0","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"09ba010b03d045fd8a2ccbe4f205c5275bb622bceb34cb81a0aa8f7d33804e2e","src/private/event.rs":"f299c79e4e2acb657f06004f3038bd8909e287719458566bc7f96262d8665e62","src/private/mod.rs":"66e90c41de74d1e80c5d3f49b8f1a86b8396be0b8c4a80f1a28903fe6d105ecf","src/private/object.rs":"7f17a7a658e8f7aa19a6bedf70f60f3f42713316d5d60298d682bb045caaafb7","src/private/ping.rs":"d2fb45e9e178ff6b17aa9c1b5258dfcd2ed91a2b43b44dec826de256ef5e8520","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"8ff4d5072d23d9fbf5444e474d21b41a31e86a37e2a25fc2f2a92976e7642cbb","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"47c13d1f39adf3881e10caa19e0c08235f08958809e234bf37a79d37d7322cd5","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"3d954bbe47d4f5fd103c51a4ff99f151662143c25c826da9734a00cd215909b9","tests/memory_distribution_buffered.rs":"db487475a5cf17a0864ccf150984ebdd28bf616573772cf678246cc1bdbcbc0f","tests/metric_metadata.rs":"05c947d3decf0a3281378dbb108080a05319ad8f130af5b07f9b049b80e5f04f","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"985e140460a100986fd051ce901b787a3a7a9747a856cd06066b740ac7d2381c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"15c76a1b5a336fd6abfbdebafc971f5c6a9b75107ddbca65f0031cde3e2886da","tests/test-delayed-ping-data.sh":"4a6db98b4df6b77898ace6a8b4e8b4c60d3e5c44873bbf38c62e83583e27a3ff","tests/test-enabled-pings.sh":"06656e38f63e65475006b107dd6bd179b0cbaa1fad1470de38e679e91a9315a3","tests/test-pending-gets-removed.sh":"e335f2f00fa97a61b6d94e0005fb3b9de8c8db8076111a67ca47d85392039ea9","tests/test-ping-lifetime-flush.sh":"e8f118ea2f6fd973809e38d5e828a03cfccfe0b0f497ccde5ec92d6d1380c071","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"f3cd0cc8a7b4fe82bef0fe6fbfbbe45fbad6da3afe0f82578bc5cfb2d6527ac6","tests/timing_distribution_buffered.rs":"501f7289c0c28f0ab83838c88b058999b19436d0f2b693be0787513d7b67e06d","tests/timing_distribution_single_sample.rs":"4f9498b6ef29913da0356027efe5f572c81d2f426e8538c068b54a1cfa33c1b8","tests/upload_timing.rs":"b3b9db197bc2ec41556388969a6bf289e7ef19e05b9019bc2bd98c823fcf6ea3","tests/uploader_capabilities.rs":"347f19e534a50a211ea179d6818631270d1b4ec468098e6b6abcde1e4a6a9bca"},"package":"95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"}
|
||||||
10
third_party/rust/glean/Cargo.lock
generated
vendored
10
third_party/rust/glean/Cargo.lock
generated
vendored
@@ -135,9 +135,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-channel"
|
||||||
version = "0.5.14"
|
version = "0.5.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471"
|
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
]
|
]
|
||||||
@@ -242,7 +242,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glean"
|
name = "glean"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
@@ -260,9 +260,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glean-core"
|
name = "glean-core"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"
|
checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_logger",
|
"android_logger",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
|||||||
4
third_party/rust/glean/Cargo.toml
vendored
4
third_party/rust/glean/Cargo.toml
vendored
@@ -13,7 +13,7 @@
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.82"
|
rust-version = "1.82"
|
||||||
name = "glean"
|
name = "glean"
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
authors = [
|
authors = [
|
||||||
"Jan-Erik Rediger <jrediger@mozilla.com>",
|
"Jan-Erik Rediger <jrediger@mozilla.com>",
|
||||||
"The Glean Team <glean-team@mozilla.com>",
|
"The Glean Team <glean-team@mozilla.com>",
|
||||||
@@ -115,7 +115,7 @@ path = "tests/uploader_capabilities.rs"
|
|||||||
version = "0.5"
|
version = "0.5"
|
||||||
|
|
||||||
[dependencies.glean-core]
|
[dependencies.glean-core]
|
||||||
version = "64.0.1"
|
version = "64.1.1"
|
||||||
|
|
||||||
[dependencies.inherent]
|
[dependencies.inherent]
|
||||||
version = "1"
|
version = "1"
|
||||||
|
|||||||
30
third_party/rust/glean/src/lib.rs
vendored
30
third_party/rust/glean/src/lib.rs
vendored
@@ -39,8 +39,8 @@ pub use glean_core::{
|
|||||||
Datetime, DistributionData, MemoryUnit, MetricIdentifier, Rate, RecordedEvent, TimeUnit,
|
Datetime, DistributionData, MemoryUnit, MetricIdentifier, Rate, RecordedEvent, TimeUnit,
|
||||||
TimerId,
|
TimerId,
|
||||||
},
|
},
|
||||||
traits, CommonMetricData, Error, ErrorType, Glean, HistogramType, LabeledMetricData, Lifetime,
|
traits, AttributionMetrics, CommonMetricData, DistributionMetrics, Error, ErrorType, Glean,
|
||||||
PingRateLimit, RecordedExperiment, Result,
|
HistogramType, LabeledMetricData, Lifetime, PingRateLimit, RecordedExperiment, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod configuration;
|
mod configuration;
|
||||||
@@ -356,5 +356,31 @@ pub fn get_registered_ping_names() -> Vec<String> {
|
|||||||
glean_core::glean_get_registered_ping_names()
|
glean_core::glean_get_registered_ping_names()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates attribution fields with new values.
|
||||||
|
/// AttributionMetrics fields with `None` values will not overwrite older values.
|
||||||
|
pub fn update_attribution(attribution: AttributionMetrics) {
|
||||||
|
glean_core::glean_update_attribution(attribution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// **TEST-ONLY Method**
|
||||||
|
///
|
||||||
|
/// Returns the current attribution metrics.
|
||||||
|
pub fn test_get_attribution() -> AttributionMetrics {
|
||||||
|
glean_core::glean_test_get_attribution()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates distribution fields with new values.
|
||||||
|
/// DistributionMetrics fields with `None` values will not overwrite older values.
|
||||||
|
pub fn update_distribution(distribution: DistributionMetrics) {
|
||||||
|
glean_core::glean_update_distribution(distribution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// **TEST-ONLY Method**
|
||||||
|
///
|
||||||
|
/// Returns the current distribution metrics.
|
||||||
|
pub fn test_get_distribution() -> DistributionMetrics {
|
||||||
|
glean_core::glean_test_get_distribution()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test;
|
mod test;
|
||||||
|
|||||||
46
third_party/rust/glean/src/test.rs
vendored
46
third_party/rust/glean/src/test.rs
vendored
@@ -1501,3 +1501,49 @@ fn pings_ride_along_builtin_pings() {
|
|||||||
let url = r.recv().unwrap();
|
let url = r.recv().unwrap();
|
||||||
assert!(url.contains("ride-along"));
|
assert!(url.contains("ride-along"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_attribution_and_distribution_updates_before_glean_inits() {
|
||||||
|
let _lock = lock_test();
|
||||||
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
let tmpname = dir.path().to_path_buf();
|
||||||
|
|
||||||
|
destroy_glean(true, &tmpname);
|
||||||
|
|
||||||
|
// No Glean, let's set and update some attribution + distribution.
|
||||||
|
let mut attribution = AttributionMetrics {
|
||||||
|
source: Some("source".into()),
|
||||||
|
medium: Some("medium".into()),
|
||||||
|
campaign: Some("campaign".into()),
|
||||||
|
term: Some("term".into()),
|
||||||
|
content: Some("content".into()),
|
||||||
|
};
|
||||||
|
let distribution = DistributionMetrics {
|
||||||
|
name: Some("name".into()),
|
||||||
|
};
|
||||||
|
update_attribution(attribution.clone());
|
||||||
|
update_distribution(distribution);
|
||||||
|
|
||||||
|
let attribution_update = AttributionMetrics {
|
||||||
|
term: Some("new term".into()),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let distribution_update = DistributionMetrics {
|
||||||
|
name: Some("different name".into()),
|
||||||
|
};
|
||||||
|
update_attribution(attribution_update);
|
||||||
|
update_distribution(distribution_update.clone());
|
||||||
|
|
||||||
|
test_reset_glean(
|
||||||
|
ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID)
|
||||||
|
.with_server_endpoint("invalid-test-host")
|
||||||
|
.build(),
|
||||||
|
ClientInfoMetrics::unknown(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Ensure the updated attribution + distribution are correctly stored.
|
||||||
|
attribution.term = Some("new term".into());
|
||||||
|
assert_eq!(attribution, test_get_attribution());
|
||||||
|
assert_eq!(distribution_update, test_get_distribution());
|
||||||
|
}
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ mod test {
|
|||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
metric.get(&"1".repeat(72)).set(true);
|
metric.get(&"1".repeat(112)).set(true);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
1,
|
1,
|
||||||
|
|||||||
@@ -407,11 +407,11 @@ class Labeled<TimingDistributionMetric, DynamicLabel> {
|
|||||||
|
|
||||||
TimingDistributionMetric MaybeTruncateAndGet(const nsACString& aLabel) const {
|
TimingDistributionMetric MaybeTruncateAndGet(const nsACString& aLabel) const {
|
||||||
// bug 1959765 is for incorporating this behaviour into the SDK.
|
// bug 1959765 is for incorporating this behaviour into the SDK.
|
||||||
if (aLabel.Length() < 72) { // bug 1959696 will up this to 112.
|
if (aLabel.Length() < 112) {
|
||||||
return Get(aLabel);
|
return Get(aLabel);
|
||||||
}
|
}
|
||||||
nsAutoCStringN<71> truncated; // bug 1959696 will up this to 111.
|
nsAutoCStringN<111> truncated;
|
||||||
truncated.Append(aLabel.BeginReading(), 68);
|
truncated.Append(aLabel.BeginReading(), 108);
|
||||||
truncated += "...";
|
truncated += "...";
|
||||||
return Get(truncated);
|
return Get(truncated);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ add_task(async () => {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue()
|
Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnlyIpc.aLabeledCounter["1".repeat(72)].add(3);
|
Glean.testOnlyIpc.aLabeledCounter["1".repeat(112)].add(3);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(),
|
() => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -44,7 +44,6 @@ add_task(async () => {
|
|||||||
{
|
{
|
||||||
a_label: 1,
|
a_label: 1,
|
||||||
another_label: 2,
|
another_label: 2,
|
||||||
["1".repeat(72)]: 3,
|
|
||||||
},
|
},
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -609,9 +609,8 @@ TEST_F(FOGFixture, TestLabeledTimingDistWorks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FOGFixture, TestLabeledTimingDistTruncateGet) {
|
TEST_F(FOGFixture, TestLabeledTimingDistTruncateGet) {
|
||||||
// Note that bug 1959696 will up this limit to 111.
|
|
||||||
auto longKey =
|
auto longKey =
|
||||||
"this is a key that is longer than the present limit of 71 characters ok?"_ns;
|
"this is a label that is longer than the new label limit of 111 characters introduced in bug 1959696 in April of 2025."_ns;
|
||||||
|
|
||||||
auto sec = TimeDuration::FromMilliseconds(1);
|
auto sec = TimeDuration::FromMilliseconds(1);
|
||||||
test_only::where_has_the_time_gone.MaybeTruncateAndGet(longKey)
|
test_only::where_has_the_time_gone.MaybeTruncateAndGet(longKey)
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ add_task(function test_gifft_labeled_counter() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue()
|
Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnlyIpc.aLabeledCounter["1".repeat(72)].add(3);
|
Glean.testOnlyIpc.aLabeledCounter["1".repeat(112)].add(3);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(),
|
() => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -332,7 +332,6 @@ add_task(function test_gifft_labeled_counter() {
|
|||||||
{
|
{
|
||||||
a_label: 4,
|
a_label: 4,
|
||||||
another_label: 2,
|
another_label: 2,
|
||||||
["1".repeat(72)]: 3,
|
|
||||||
},
|
},
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
@@ -497,7 +496,7 @@ add_task(async function test_gifft_labeled_boolean() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue()
|
Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnly.mirrorsForLabeledBools["1".repeat(72)].set(true);
|
Glean.testOnly.mirrorsForLabeledBools["1".repeat(112)].set(true);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue(),
|
() => Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -510,7 +509,6 @@ add_task(async function test_gifft_labeled_boolean() {
|
|||||||
{
|
{
|
||||||
a_label: true,
|
a_label: true,
|
||||||
another_label: false,
|
another_label: false,
|
||||||
["1".repeat(72)]: true,
|
|
||||||
},
|
},
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
@@ -809,7 +807,7 @@ add_task(async function test_gifft_labeled_quantity() {
|
|||||||
Assert.equal(1, Glean.testOnly.buttonJars.whoseGot.testGetValue());
|
Assert.equal(1, Glean.testOnly.buttonJars.whoseGot.testGetValue());
|
||||||
// What about invalid/__other__?
|
// What about invalid/__other__?
|
||||||
Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue());
|
Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue());
|
||||||
Glean.testOnly.buttonJars["1".repeat(72)].set(9000);
|
Glean.testOnly.buttonJars["1".repeat(112)].set(9000);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.buttonJars.__other__.testGetValue(),
|
() => Glean.testOnly.buttonJars.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -823,7 +821,6 @@ add_task(async function test_gifft_labeled_quantity() {
|
|||||||
{
|
{
|
||||||
pants: 42,
|
pants: 42,
|
||||||
whoseGot: 1,
|
whoseGot: 1,
|
||||||
["1".repeat(72)]: 9000,
|
|
||||||
},
|
},
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -103,7 +103,9 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
|
|||||||
|
|
||||||
// Has to be different from aLabeledCounter so the error we record doesn't
|
// Has to be different from aLabeledCounter so the error we record doesn't
|
||||||
// get in the way.
|
// get in the way.
|
||||||
Glean.testOnlyIpc.anotherLabeledCounter["1".repeat(72)].add(INVALID_COUNTERS);
|
Glean.testOnlyIpc.anotherLabeledCounter["1".repeat(112)].add(
|
||||||
|
INVALID_COUNTERS
|
||||||
|
);
|
||||||
|
|
||||||
Glean.testOnlyIpc.aLabeledCounterForHgram.true.add(1);
|
Glean.testOnlyIpc.aLabeledCounterForHgram.true.add(1);
|
||||||
Glean.testOnlyIpc.aLabeledCounterForHgram.false.add(1);
|
Glean.testOnlyIpc.aLabeledCounterForHgram.false.add(1);
|
||||||
@@ -277,12 +279,7 @@ add_task(
|
|||||||
"telemetry.test.mirror_for_labeled_counter",
|
"telemetry.test.mirror_for_labeled_counter",
|
||||||
"content"
|
"content"
|
||||||
);
|
);
|
||||||
Assert.deepEqual(
|
Assert.deepEqual(undefined, value);
|
||||||
{
|
|
||||||
["1".repeat(72)]: INVALID_COUNTERS,
|
|
||||||
},
|
|
||||||
value
|
|
||||||
);
|
|
||||||
|
|
||||||
const boolHgramCounters = Glean.testOnlyIpc.aLabeledCounterForHgram;
|
const boolHgramCounters = Glean.testOnlyIpc.aLabeledCounterForHgram;
|
||||||
Assert.equal(boolHgramCounters.true.testGetValue(), 1);
|
Assert.equal(boolHgramCounters.true.testGetValue(), 1);
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ add_task(async function test_fog_labels_conform() {
|
|||||||
"wednesday",
|
"wednesday",
|
||||||
Glean.testOnly.mabelsLabelMaker.camelCase.testGetValue()
|
Glean.testOnly.mabelsLabelMaker.camelCase.testGetValue()
|
||||||
);
|
);
|
||||||
const veryLong = "1".repeat(72);
|
const veryLong = "1".repeat(112);
|
||||||
Glean.testOnly.mabelsLabelMaker[veryLong].set("seventy-two");
|
Glean.testOnly.mabelsLabelMaker[veryLong].set("seventy-two");
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.mabelsLabelMaker[veryLong].testGetValue(),
|
() => Glean.testOnly.mabelsLabelMaker[veryLong].testGetValue(),
|
||||||
@@ -358,7 +358,7 @@ add_task(async function test_fog_labeled_boolean_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue()
|
Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnly.mabelsLikeBalloons["1".repeat(72)].set(true);
|
Glean.testOnly.mabelsLikeBalloons["1".repeat(112)].set(true);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue(),
|
() => Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -387,7 +387,7 @@ add_task(async function test_fog_labeled_counter_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue()
|
Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnly.mabelsKitchenCounters["1".repeat(72)].add(1);
|
Glean.testOnly.mabelsKitchenCounters["1".repeat(112)].add(1);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue(),
|
() => Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -416,7 +416,7 @@ add_task(async function test_fog_labeled_string_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue()
|
Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnly.mabelsBalloonStrings["1".repeat(72)].set("valid");
|
Glean.testOnly.mabelsBalloonStrings["1".repeat(112)].set("valid");
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue(),
|
() => Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue(),
|
||||||
/DataError/
|
/DataError/
|
||||||
@@ -715,7 +715,7 @@ add_task(async function test_fog_labeled_custom_distribution_works() {
|
|||||||
Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue()
|
Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.testOnly.mabelsCustomLabelLengths[
|
Glean.testOnly.mabelsCustomLabelLengths[
|
||||||
"1".repeat(72)
|
"1".repeat(112)
|
||||||
].accumulateSingleSample(3);
|
].accumulateSingleSample(3);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue(),
|
() => Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue(),
|
||||||
@@ -786,7 +786,7 @@ add_task(async function test_fog_labeled_quantity_works() {
|
|||||||
Assert.equal(0, Glean.testOnly.buttonJars.curling.testGetValue());
|
Assert.equal(0, Glean.testOnly.buttonJars.curling.testGetValue());
|
||||||
// What about invalid/__other__?
|
// What about invalid/__other__?
|
||||||
Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue());
|
Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue());
|
||||||
Glean.testOnly.buttonJars["1".repeat(72)].set(0);
|
Glean.testOnly.buttonJars["1".repeat(112)].set(0);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.testOnly.buttonJars.__other__.testGetValue(),
|
() => Glean.testOnly.buttonJars.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
|
|||||||
COUNTERS_WITH_JUNK_ON_THEM
|
COUNTERS_WITH_JUNK_ON_THEM
|
||||||
);
|
);
|
||||||
|
|
||||||
Glean.testOnly.mabelsBathroomCounters["1".repeat(72)].add(INVALID_COUNTERS);
|
Glean.testOnly.mabelsBathroomCounters["1".repeat(112)].add(INVALID_COUNTERS);
|
||||||
|
|
||||||
Glean.testOnlyIpc.irate.addToNumerator(44);
|
Glean.testOnlyIpc.irate.addToNumerator(44);
|
||||||
Glean.testOnlyIpc.irate.addToDenominator(14);
|
Glean.testOnlyIpc.irate.addToDenominator(14);
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ add_task(async function test_jog_labeled_boolean_works() {
|
|||||||
Assert.equal(undefined, Glean.jogCat.jogLabeledBool.__other__.testGetValue());
|
Assert.equal(undefined, Glean.jogCat.jogLabeledBool.__other__.testGetValue());
|
||||||
Glean.jogCat.jogLabeledBool.NowValidLabel.set(true);
|
Glean.jogCat.jogLabeledBool.NowValidLabel.set(true);
|
||||||
Assert.ok(Glean.jogCat.jogLabeledBool.NowValidLabel.testGetValue());
|
Assert.ok(Glean.jogCat.jogLabeledBool.NowValidLabel.testGetValue());
|
||||||
Glean.jogCat.jogLabeledBool["1".repeat(72)].set(true);
|
Glean.jogCat.jogLabeledBool["1".repeat(112)].set(true);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.jogCat.jogLabeledBool.__other__.testGetValue(),
|
() => Glean.jogCat.jogLabeledBool.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -448,7 +448,7 @@ add_task(async function test_jog_labeled_counter_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.jogCat.jogLabeledCounter.__other__.testGetValue()
|
Glean.jogCat.jogLabeledCounter.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.jogCat.jogLabeledCounter["1".repeat(72)].add(1);
|
Glean.jogCat.jogLabeledCounter["1".repeat(112)].add(1);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.jogCat.jogLabeledCounter.__other__.testGetValue(),
|
() => Glean.jogCat.jogLabeledCounter.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
@@ -486,7 +486,7 @@ add_task(async function test_jog_labeled_counter_with_static_labels_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue()
|
Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.jogCat.jogLabeledCounterWithLabels["1".repeat(72)].add(1);
|
Glean.jogCat.jogLabeledCounterWithLabels["1".repeat(112)].add(1);
|
||||||
// TODO:(bug 1766515) - This should throw.
|
// TODO:(bug 1766515) - This should throw.
|
||||||
/*Assert.throws(
|
/*Assert.throws(
|
||||||
() => Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue(),
|
() => Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue(),
|
||||||
@@ -522,7 +522,7 @@ add_task(async function test_jog_labeled_string_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.jogCat.jogLabeledString.__other__.testGetValue()
|
Glean.jogCat.jogLabeledString.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.jogCat.jogLabeledString["1".repeat(72)].set("valid");
|
Glean.jogCat.jogLabeledString["1".repeat(112)].set("valid");
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.jogCat.jogLabeledString.__other__.testGetValue(),
|
() => Glean.jogCat.jogLabeledString.__other__.testGetValue(),
|
||||||
/DataError/
|
/DataError/
|
||||||
@@ -559,7 +559,7 @@ add_task(async function test_jog_labeled_string_with_labels_works() {
|
|||||||
undefined,
|
undefined,
|
||||||
Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue()
|
Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.jogCat.jogLabeledStringWithLabels["1".repeat(72)].set("valid");
|
Glean.jogCat.jogLabeledStringWithLabels["1".repeat(112)].set("valid");
|
||||||
// TODO:(bug 1766515) - This should throw.
|
// TODO:(bug 1766515) - This should throw.
|
||||||
/*Assert.throws(
|
/*Assert.throws(
|
||||||
() => Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue(),
|
() => Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue(),
|
||||||
@@ -898,7 +898,7 @@ add_task(async function test_jog_labeled_quantity_works() {
|
|||||||
100,
|
100,
|
||||||
Glean.jogCat.jogLabeledQuantity.NowValidLabel.testGetValue()
|
Glean.jogCat.jogLabeledQuantity.NowValidLabel.testGetValue()
|
||||||
);
|
);
|
||||||
Glean.jogCat.jogLabeledQuantity["1".repeat(72)].set(true);
|
Glean.jogCat.jogLabeledQuantity["1".repeat(112)].set(true);
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => Glean.jogCat.jogLabeledQuantity.__other__.testGetValue(),
|
() => Glean.jogCat.jogLabeledQuantity.__other__.testGetValue(),
|
||||||
/DataError/,
|
/DataError/,
|
||||||
|
|||||||
@@ -207,12 +207,12 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
|
|||||||
Glean.jogIpc.jogLabeledCounter.label_1.add(COUNTERS_1);
|
Glean.jogIpc.jogLabeledCounter.label_1.add(COUNTERS_1);
|
||||||
Glean.jogIpc.jogLabeledCounter.label_2.add(COUNTERS_2);
|
Glean.jogIpc.jogLabeledCounter.label_2.add(COUNTERS_2);
|
||||||
|
|
||||||
Glean.jogIpc.jogLabeledCounterErr["1".repeat(72)].add(INVALID_COUNTERS);
|
Glean.jogIpc.jogLabeledCounterErr["1".repeat(112)].add(INVALID_COUNTERS);
|
||||||
|
|
||||||
Glean.jogIpc.jogLabeledCounterWithLabels.label_1.add(COUNTERS_1);
|
Glean.jogIpc.jogLabeledCounterWithLabels.label_1.add(COUNTERS_1);
|
||||||
Glean.jogIpc.jogLabeledCounterWithLabels.label_2.add(COUNTERS_2);
|
Glean.jogIpc.jogLabeledCounterWithLabels.label_2.add(COUNTERS_2);
|
||||||
|
|
||||||
Glean.jogIpc.jogLabeledCounterWithLabelsErr["1".repeat(72)].add(
|
Glean.jogIpc.jogLabeledCounterWithLabelsErr["1".repeat(112)].add(
|
||||||
INVALID_COUNTERS
|
INVALID_COUNTERS
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user