diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/rust/glean-core/src/metrics/mod.rs | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-upstream/125.0.1.tar.xz firefox-upstream/125.0.1.zip |
Adding upstream version 125.0.1.upstream/125.0.1
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 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/third_party/rust/glean-core/src/metrics/mod.rs b/third_party/rust/glean-core/src/metrics/mod.rs index 43253b9aa7..92001efd2a 100644 --- a/third_party/rust/glean-core/src/metrics/mod.rs +++ b/third_party/rust/glean-core/src/metrics/mod.rs @@ -9,7 +9,8 @@ use std::sync::atomic::Ordering; use chrono::{DateTime, FixedOffset}; use serde::{Deserialize, Serialize}; -use serde_json::{json, Value as JsonValue}; +use serde_json::json; +pub use serde_json::Value as JsonValue; mod boolean; mod counter; @@ -23,6 +24,7 @@ mod memory_distribution; mod memory_unit; mod metrics_enabled_config; mod numerator; +mod object; mod ping; mod quantity; mod rate; @@ -54,6 +56,7 @@ pub use self::labeled::{LabeledBoolean, LabeledCounter, LabeledMetric, LabeledSt pub use self::memory_distribution::MemoryDistributionMetric; pub use self::memory_unit::MemoryUnit; pub use self::numerator::NumeratorMetric; +pub use self::object::ObjectMetric; pub use self::ping::PingType; pub use self::quantity::QuantityMetric; pub use self::rate::{Rate, RateMetric}; @@ -141,6 +144,8 @@ pub enum Metric { Url(String), /// A Text metric. See [`TextMetric`] for more information. Text(String), + /// An Object metric. See [`ObjectMetric`] for more information. + Object(String), } /// A [`MetricType`] describes common behavior across all metrics. @@ -251,6 +256,7 @@ impl Metric { Metric::MemoryDistribution(_) => "memory_distribution", Metric::Jwe(_) => "jwe", Metric::Text(_) => "text", + Metric::Object(_) => "object", } } @@ -280,6 +286,9 @@ impl Metric { Metric::MemoryDistribution(hist) => json!(memory_distribution::snapshot(hist)), Metric::Jwe(s) => json!(s), Metric::Text(s) => json!(s), + Metric::Object(s) => { + serde_json::from_str(s).expect("object storage should have been json") + } } } } |