diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/glean-core/src/metrics/mod.rs | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/glean-core/src/metrics/mod.rs')
-rw-r--r-- | third_party/rust/glean-core/src/metrics/mod.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/third_party/rust/glean-core/src/metrics/mod.rs b/third_party/rust/glean-core/src/metrics/mod.rs index 92001efd2a..9234fff2d1 100644 --- a/third_party/rust/glean-core/src/metrics/mod.rs +++ b/third_party/rust/glean-core/src/metrics/mod.rs @@ -22,13 +22,13 @@ mod experiment; pub(crate) mod labeled; mod memory_distribution; mod memory_unit; -mod metrics_enabled_config; mod numerator; mod object; mod ping; mod quantity; mod rate; mod recorded_experiment; +mod remote_settings_config; mod string; mod string_list; mod text; @@ -72,7 +72,7 @@ pub use self::uuid::UuidMetric; pub use crate::histogram::HistogramType; pub use recorded_experiment::RecordedExperiment; -pub use self::metrics_enabled_config::MetricsEnabledConfig; +pub use self::remote_settings_config::RemoteSettingsConfig; /// A snapshot of all buckets and the accumulated sum of a distribution. // @@ -180,7 +180,7 @@ pub trait MetricType { // Technically nothing prevents multiple calls to should_record() to run in parallel, // meaning both are reading self.meta().disabled and later writing it. In between it can - // also read remote_settings_metrics_config, which also could be modified in between those 2 reads. + // also read remote_settings_config, which also could be modified in between those 2 reads. // This means we could write the wrong remote_settings_epoch | current_disabled value. All in all // at worst we would see that metric enabled/disabled wrongly once. // But since everything is tunneled through the dispatcher, this should never ever happen. @@ -200,11 +200,7 @@ pub trait MetricType { } // The epoch's didn't match so we need to look up the disabled flag // by the base_identifier from the in-memory HashMap - let metrics_enabled = &glean - .remote_settings_metrics_config - .lock() - .unwrap() - .metrics_enabled; + let remote_settings_config = &glean.remote_settings_config.lock().unwrap(); // Get the value from the remote configuration if it is there, otherwise return the default value. let current_disabled = { let base_id = self.meta().base_identifier(); @@ -215,8 +211,13 @@ pub trait MetricType { // NOTE: The `!` preceding the `*is_enabled` is important for inverting the logic since the // underlying property in the metrics.yaml is `disabled` and the outward API is treating it as // if it were `enabled` to make it easier to understand. - if let Some(is_enabled) = metrics_enabled.get(identifier) { - u8::from(!*is_enabled) + + if !remote_settings_config.metrics_enabled.is_empty() { + if let Some(is_enabled) = remote_settings_config.metrics_enabled.get(identifier) { + u8::from(!*is_enabled) + } else { + u8::from(self.meta().inner.disabled) + } } else { u8::from(self.meta().inner.disabled) } |