Skip to content

Commit

Permalink
Bug 1889114 - Add 'enabled' property to pings
Browse files Browse the repository at this point in the history
This is enabled initially for Swift, Kotlin, and Rust
  • Loading branch information
travis79 committed Apr 2, 2024
1 parent be54910 commit 6739957
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions glean_parser/pings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(
reasons: Optional[Dict[str, str]] = None,
defined_in: Optional[Dict] = None,
no_lint: Optional[List[str]] = None,
enabled: Optional[bool] = True,
_validated: bool = False,
):
# Avoid cyclical import
Expand All @@ -46,6 +47,7 @@ def __init__(
self.metadata = metadata
self.precise_timestamps = self.metadata.get("precise_timestamps", True)
self.include_info_sections = self.metadata.get("include_info_sections", True)
self.enabled = enabled
if data_reviews is None:
data_reviews = []
self.data_reviews = data_reviews
Expand Down
8 changes: 8 additions & 0 deletions glean_parser/schemas/pings.2-0-0.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ additionalProperties:
additionalProperties:
type: string

enabled:
title: Whether or not this ping is enabled
description: |
When `true`, the ping will be sent as usual.
When `false`, the ping will not be sent, but the data will continue to
be collected but will not be cleared when the ping is submitted.
type: boolean

no_lint:
title: Lint checks to skip
description: |
Expand Down
2 changes: 1 addition & 1 deletion glean_parser/templates/rust.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} {
/// {{ obj.description|wordwrap() | replace('\n', '\n/// ') }}
#[rustfmt::skip]
pub static {{ obj.name|snake_case }}: ::glean::private::__export::Lazy<::glean::private::PingType> =
::glean::private::__export::Lazy::new(|| ::glean::private::PingType::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.precise_timestamps|rust }}, {{ obj.include_info_sections|rust }}, {{ obj.reason_codes|rust }}));
::glean::private::__export::Lazy::new(|| ::glean::private::PingType::new("{{ obj.name }}", {{ obj.include_client_id|rust }}, {{ obj.send_if_empty|rust }}, {{ obj.precise_timestamps|rust }}, {{ obj.include_info_sections|rust }}, {{ obj.reason_codes|rust }}, {{ obj.enabled|rust}}));
{% endfor %}
{% else %}
pub mod {{ category.name|snake_case }} {
Expand Down
3 changes: 2 additions & 1 deletion glean_parser/templates/swift.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ extension {{ namespace }} {
sendIfEmpty: {{obj.send_if_empty|swift}},
preciseTimestamps: {{obj.precise_timestamps|swift}},
includeInfoSections: {{obj.include_info_sections|swift}},
reasonCodes: {{obj.reason_codes|swift}}
reasonCodes: {{obj.reason_codes|swift}},
enabled: {{obj.enabled|swift}}
)

{% endfor %}
Expand Down

0 comments on commit 6739957

Please sign in to comment.