Bug 1943581 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

We would like to be able to record gecko profiler markers whenever a `Glean::Ping` is sent by FoG. Unfortunately, at present, we do not have access to any of the `Ping` metadata that would be needed to record a useful marker. 

We would like to record a marker during `Ping::submit`, [here]([ping::private::Ping::Ping::submit](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/toolkit/components/glean/api/src/private/ping.rs#92)). At this point we have both a reason (an `Option<&str>`), and `&self`. The latter contains a `glean::private::PingType` [member]([ping::private::Parent](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/toolkit/components/glean/api/src/private/ping.rs#14)), which in turn contains a member of an (internal to Glean) [`glean_core::metrics::PingType`]([ping::private::PingType](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/third_party/rust/glean/src/private/ping.rs#13)). As this member is only accessible within the internal Glean APIs and RLB, we cannot access it, nor its details. (This is good design).

However, we still would like to get some of these details, as we need them when we record a marker! This bug proposes that the `ping::private::PingType` [impl]([ping::private::PingType](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/third_party/rust/glean/src/private/ping.rs#22)) be extended to add a full panopoly of methods allowing access to `Ping` metadata. This should include (but may not be limited to): 

```
// Get the name of the ping
fn get_name(&'a self) -> &'a str

// Does the ping include a client ID?
fn includes_client_id(&self) -> bool

// Should we send the ping if it's empty?
fn should_send_if_empty(&self) -> bool

// Does the ping include precise timestamps? 
fn includes_precise_timestamps(&self) -> bool

// Does the ping include info sections?
fn includes_info_sections(&self) -> bool

// Whether or not the ping is enabled
fn is_enabled(&self) -> bool

// An iterator over the pings that this ping schedules
fn get_schedules_pings(&'a self) -> Iter<'a str, T>
// An iterator over the reason codes for this ping
fn get_reason_codes(&'a self) -> Iter<'a str, T>
```
We would like to be able to record gecko profiler markers whenever a `Glean::Ping` is sent by FoG. Unfortunately, at present, we do not have access to any of the `Ping` metadata that would be needed to record a useful marker. 

We would like to record a marker during `Ping::submit`, [here]([ping::private::Ping::Ping::submit](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/toolkit/components/glean/api/src/private/ping.rs#92)). At this point we have both a reason (an `Option<&str>`), and `&self`. The latter contains a `glean::private::PingType` [member]([ping::private::Parent](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/toolkit/components/glean/api/src/private/ping.rs#14)), which in turn contains a member of an (internal to Glean) [`glean_core::metrics::PingType`]([ping::private::PingType](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/third_party/rust/glean/src/private/ping.rs#13)). As this member is only accessible within the internal Glean APIs and RLB, we cannot access it, nor its details. (This is good design).

However, we still would like to get some of these details, as we need them when we record a marker! This bug proposes that the `ping::private::PingType` [impl]([ping::private::PingType](https://searchfox.org/mozilla-central/rev/f41e8cacb8e8ce254204e2526e98d49d024f1674/third_party/rust/glean/src/private/ping.rs#22)) be extended to add a full panopoly of methods allowing access to `Ping` metadata. This should probably include (but may not be limited to): 

```
// Get the name of the ping
fn get_name(&'a self) -> &'a str

// Does the ping include a client ID?
fn includes_client_id(&self) -> bool

// Should we send the ping if it's empty?
fn should_send_if_empty(&self) -> bool

// Does the ping include precise timestamps? 
fn includes_precise_timestamps(&self) -> bool

// Does the ping include info sections?
fn includes_info_sections(&self) -> bool

// Whether or not the ping is enabled
fn is_enabled(&self) -> bool

// An iterator over the pings that this ping schedules
fn get_schedules_pings(&'a self) -> Iter<'a str, T>

// An iterator over the reason codes for this ping
fn get_reason_codes(&'a self) -> Iter<'a str, T>
```

Back to Bug 1943581 Comment 0