1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
// -*- mode: Rust -*-
// AUTOGENERATED BY glean_parser. DO NOT EDIT.
/* 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 http://mozilla.org/MPL/2.0/. */
use crate::private::Ping;
use once_cell::sync::Lazy;
#[allow(non_upper_case_globals)]
/// This ping is intended to provide metrics that are managed by the library itself, and not explicitly set by the application or included in the application's `metrics.yaml` file. The `baseline` ping is automatically sent when the application is moved to the background.
pub static not_baseline: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"not-baseline",
true,
false,
true,
true,
true,
vec![],
vec!["background".into(), "dirty_startup".into(), "foreground".into()],
true,
vec![],
)
});
#[allow(non_upper_case_globals)]
/// This ping is submitted when a user opts out of sending technical and interaction data to Mozilla. This ping is intended to communicate to the Data Pipeline that the user wishes to have their reported Telemetry data deleted. As such it attempts to send itself at the moment the user opts out of data collection.
pub static not_deletion_request: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"not-deletion-request",
true,
true,
true,
true,
true,
vec![],
vec![],
true,
vec![],
)
});
#[allow(non_upper_case_globals)]
/// The events ping's purpose is to transport all of the event metric information. The `events` ping is automatically sent when the application is moved to the background.
pub static not_events: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"not-events",
true,
false,
true,
true,
true,
vec![],
vec!["background".into(), "max_capacity".into(), "startup".into()],
true,
vec![],
)
});
#[allow(non_upper_case_globals)]
/// The `metrics` ping is intended for all of the metrics that are explicitly set by the application or are included in the application's `metrics.yaml` file (except events). The reported data is tied to the ping's *measurement window*, which is the time between the collection of two `metrics` ping. Ideally, this window is expected to be about 24 hours, given that the collection is scheduled daily at 4AM. Data in the `ping_info` section of the ping can be used to infer the length of this window.
pub static not_metrics: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"not-metrics",
true,
false,
true,
true,
true,
vec![],
vec!["overdue".into(), "reschedule".into(), "today".into(), "tomorrow".into(), "upgrade".into()],
true,
vec![],
)
});
#[allow(non_upper_case_globals)]
/// A fake OHTTP-using ping
pub static not_ohttp: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"not-ohttp",
false,
true,
true,
false,
true,
vec![],
vec![],
true,
vec!["ohttp".into()],
)
});
#[allow(non_upper_case_globals)]
/// A fake ping to test ride-along
pub static ridealong_test: Lazy<Ping> = Lazy::new(|| {
Ping::new(
"ridealong-test",
false,
true,
true,
true,
true,
vec![],
vec![],
true,
vec![],
)
});
/// Instantiate custom pings once to trigger registration.
///
/// # Arguments
///
/// application_id: If present, limit to only registering custom pings
/// assigned to the identified application.
#[doc(hidden)]
pub fn register_pings(application_id: Option<&str>) {
match application_id {
_ => {
let _ = &*not_baseline;
let _ = &*not_deletion_request;
let _ = &*not_events;
let _ = &*not_metrics;
let _ = &*not_ohttp;
let _ = &*ridealong_test;
}
}
extern "C" {
fn JOG_MaybeReload();
}
unsafe {
JOG_MaybeReload();
}
}
/// Map from pings to the pings scheduled along with them.
///
#[doc(hidden)]
pub fn ping_schedule() -> std::collections::HashMap<String, Vec<String>> {
std::collections::HashMap::from([
(
"baseline".into(),
vec!["ridealong-test".into()]
),
])
}
#[cfg(feature = "with_gecko")]
pub(crate) fn submit_ping_by_id(id: u32, reason: Option<&str>) {
if id & (1 << crate::factory::DYNAMIC_PING_BIT) > 0 {
let map = crate::factory::__jog_metric_maps::PING_MAP
.read()
.expect("Read lock for dynamic ping map was poisoned!");
if let Some(ping) = map.get(&id) {
ping.submit(reason);
} else {
// TODO: instrument this error.
log::error!("Cannot submit unknown dynamic ping {} by id.", id);
}
return;
}
match id {
1 => not_baseline.submit(reason),
2 => not_deletion_request.submit(reason),
3 => not_events.submit(reason),
4 => not_metrics.submit(reason),
5 => not_ohttp.submit(reason),
6 => ridealong_test.submit(reason),
_ => {
// TODO: instrument this error.
log::error!("Cannot submit unknown ping {} by id.", id);
}
}
}
#[cfg(feature = "with_gecko")]
pub(crate) fn set_ping_enabled_by_id(id: u32, enabled: bool) {
if id & (1 << crate::factory::DYNAMIC_PING_BIT) > 0 {
let map = crate::factory::__jog_metric_maps::PING_MAP
.read()
.expect("Read lock for dynamic ping map was poisoned!");
if let Some(ping) = map.get(&id) {
ping.set_enabled(enabled);
} else {
// TODO: instrument this error.
log::error!("Cannot set_enabled on unknown dynamic ping {} by id.", id);
}
return;
}
match id {
1 => not_baseline.set_enabled(enabled),
2 => not_deletion_request.set_enabled(enabled),
3 => not_events.set_enabled(enabled),
4 => not_metrics.set_enabled(enabled),
5 => not_ohttp.set_enabled(enabled),
6 => ridealong_test.set_enabled(enabled),
_ => {
// TODO: instrument this error.
log::error!("Cannot set_enabled on unknown ping {} by id.", id);
}
}
}
/// Measure the allocation size of all known pings.
#[doc(hidden)]
pub fn fog_ping_alloc_size(ops: &mut malloc_size_of::MallocSizeOfOps) -> usize {
use malloc_size_of::MallocSizeOf;
let mut n = 0;
n += not_baseline.size_of(ops);
n += not_deletion_request.size_of(ops);
n += not_events.size_of(ops);
n += not_metrics.size_of(ops);
n += not_ohttp.size_of(ops);
n += ridealong_test.size_of(ops);
n
}
|