| 1 |
// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
// file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
use malloc_size_of_derive::MallocSizeOf; |
| 6 |
|
| 7 |
use crate::metrics::PingType; |
| 8 |
|
| 9 |
/// Glean-provided pings, all enabled by default. |
| 10 |
/// |
| 11 |
/// These pings are defined in `glean-core/pings.yaml` and for now manually translated into Rust code. |
| 12 |
/// This might get auto-generated when the Rust API lands ([Bug 1579146](https://bugzilla.mozilla.org/show_bug.cgi?id=1579146)). |
| 13 |
/// |
| 14 |
/// They are parsed and registered by the platform-specific wrappers, but might be used Glean-internal directly. |
| 15 |
#[derive(Debug, Clone, MallocSizeOf)] |
| 16 |
pub struct InternalPings { |
| 17 |
pub baseline: PingType, |
| 18 |
pub metrics: PingType, |
| 19 |
pub events: PingType, |
| 20 |
pub deletion_request: PingType, |
| 21 |
} |
| 22 |
|
| 23 |
impl InternalPings { |
| 24 |
pub fn new(enabled: bool) -> InternalPings { |
| 25 |
InternalPings { |
| 26 |
baseline: PingType::new( |
| 27 |
"baseline", |
| 28 |
true, |
| 29 |
true, |
| 30 |
true, |
| 31 |
true, |
| 32 |
enabled, |
| 33 |
vec![], |
| 34 |
vec![ |
| 35 |
"active".to_string(), |
| 36 |
"dirty_startup".to_string(), |
| 37 |
"inactive".to_string(), |
| 38 |
], |
| 39 |
true, |
| 40 |
vec![], |
| 41 |
), |
| 42 |
metrics: PingType::new( |
| 43 |
"metrics", |
| 44 |
true, |
| 45 |
false, |
| 46 |
true, |
| 47 |
true, |
| 48 |
enabled, |
| 49 |
vec![], |
| 50 |
vec![ |
| 51 |
"overdue".to_string(), |
| 52 |
"reschedule".to_string(), |
| 53 |
"today".to_string(), |
| 54 |
"tomorrow".to_string(), |
| 55 |
"upgrade".to_string(), |
| 56 |
], |
| 57 |
true, |
| 58 |
vec![], |
| 59 |
), |
| 60 |
events: PingType::new( |
| 61 |
"events", |
| 62 |
true, |
| 63 |
false, |
| 64 |
true, |
| 65 |
true, |
| 66 |
enabled, |
| 67 |
vec![], |
| 68 |
vec![ |
| 69 |
"startup".to_string(), |
| 70 |
"inactive".to_string(), |
| 71 |
"max_capacity".to_string(), |
| 72 |
], |
| 73 |
true, |
| 74 |
vec![], |
| 75 |
), |
| 76 |
deletion_request: PingType::new( |
| 77 |
"deletion-request", |
| 78 |
true, |
| 79 |
true, |
| 80 |
true, |
| 81 |
true, |
| 82 |
true, // The deletion-request should not be disabled |
| 83 |
vec![], |
| 84 |
vec!["at_init".to_string(), "set_upload_enabled".to_string()], |
| 85 |
true, |
| 86 |
vec![], |
| 87 |
), |
| 88 |
} |
| 89 |
} |
| 90 |
} |