summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/api/src/metrics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/glean/api/src/metrics.rs')
-rw-r--r--toolkit/components/glean/api/src/metrics.rs70
1 files changed, 70 insertions, 0 deletions
diff --git a/toolkit/components/glean/api/src/metrics.rs b/toolkit/components/glean/api/src/metrics.rs
new file mode 100644
index 0000000000..9c2860bc29
--- /dev/null
+++ b/toolkit/components/glean/api/src/metrics.rs
@@ -0,0 +1,70 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// 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/.
+
+//! This file contains the Generated Glean Metrics API
+//!
+//! The contents of this module are generated by
+//! `toolkit/components/glean/build_scripts/glean_parser_ext/run_glean_parser.py`, from
+//! 'toolkit/components/glean/metrics.yaml`.
+
+#[cfg(not(feature = "cargo-clippy"))]
+include!(concat!(
+ env!("MOZ_TOPOBJDIR"),
+ "/toolkit/components/glean/api/src/metrics.rs"
+));
+
+// When running clippy the linter, `MOZ_TOPOBJDIR` is not set
+// (and the `metrics.rs` file might not even be generated yet),
+// so we need to manually define some things we expect from it so the rest of the build can assume
+// it's there.
+// See https://bugzilla.mozilla.org/show_bug.cgi?id=1674726.
+#[cfg(feature = "cargo-clippy")]
+#[allow(dead_code)]
+pub(crate) mod __glean_metric_maps {
+ use std::collections::HashMap;
+
+ use crate::private::*;
+ use once_cell::sync::Lazy;
+
+ pub static TIMESPAN_MAP: Lazy<HashMap<MetricId, &Lazy<TimespanMetric>>> =
+ Lazy::new(HashMap::new);
+
+ pub static COUNTER_MAP: Lazy<HashMap<MetricId, &Lazy<CounterMetric>>> = Lazy::new(HashMap::new);
+
+ pub static BOOLEAN_MAP: Lazy<HashMap<MetricId, &Lazy<BooleanMetric>>> = Lazy::new(HashMap::new);
+
+ pub static DATETIME_MAP: Lazy<HashMap<MetricId, &Lazy<DatetimeMetric>>> =
+ Lazy::new(HashMap::new);
+
+ pub static STRING_MAP: Lazy<HashMap<MetricId, &Lazy<StringMetric>>> = Lazy::new(HashMap::new);
+
+ pub static MEMORY_DISTRIBUTION_MAP: Lazy<HashMap<MetricId, &Lazy<MemoryDistributionMetric>>> =
+ Lazy::new(HashMap::new);
+
+ pub static STRING_LIST_MAP: Lazy<HashMap<MetricId, &Lazy<StringListMetric>>> =
+ Lazy::new(HashMap::new);
+
+ pub static UUID_MAP: Lazy<HashMap<MetricId, &Lazy<UuidMetric>>> = Lazy::new(HashMap::new);
+
+ pub(crate) fn event_record_wrapper(
+ _metric_id: u32,
+ _extra: Option<HashMap<i32, String>>,
+ ) -> Result<(), EventRecordingError> {
+ Err(EventRecordingError::InvalidId)
+ }
+
+ pub(crate) fn event_record_wrapper_str(
+ _metric_id: u32,
+ _extra: Option<HashMap<String, String>>,
+ ) -> Result<(), EventRecordingError> {
+ Err(EventRecordingError::InvalidId)
+ }
+
+ pub(crate) fn event_test_get_value_wrapper(
+ _metric_id: u32,
+ _storage_name: &str,
+ ) -> Option<Vec<RecordedEvent>> {
+ None
+ }
+}