Skip to content

Commit ee13371

Browse files
authored
bug(experimenter): send glean opt outs in custom ping (#13829)
Because - python glean doesn't send the events ping unless there's 500 outstanding events or we use [glean.Glean.handle_client_inactive](https://mozilla.github.io/glean/python/glean/index.html#glean.Glean.handle_client_inactive) This commit - Removes the data collection opt out event - Adds a data collection opt out ping Fixes #13828
1 parent 701753e commit ee13371

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

experimenter/experimenter/glean/views.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class OptOutView(UpdateView):
1111
template_name = "glean/opt_out_button.html"
1212

1313
metrics = glean.load_metrics(settings.BASE_DIR / "telemetry" / "metrics.yaml")
14+
pings = glean.load_pings(settings.BASE_DIR / "telemetry" / "pings.yaml")
1415

1516
def get_object(self, queryset=None):
1617
if not hasattr(self.request.user, "glean_prefs"):
@@ -19,11 +20,8 @@ def get_object(self, queryset=None):
1920

2021
def form_valid(self, form):
2122
if ("opt_out" in form.changed_data) and (form.cleaned_data["opt_out"] is True):
22-
self.metrics.data_collection.opt_out.record(
23-
self.metrics.data_collection.OptOutExtra(
24-
nimbus_user_id=str(self.request.user.id),
25-
)
26-
)
23+
self.metrics.nimbus.nimbus_user_id.set(str(self.request.user.id))
24+
self.pings.data_collection_opt_out.submit()
2725

2826
self.object = form.save()
2927

experimenter/experimenter/telemetry/metrics.yaml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ nimbus:
3939
expires: never
4040
send_in_pings:
4141
- page-view
42+
- data-collection-opt-out
4243
enrollments:
4344
type: object
4445
description: The list of enrollments associated with this page view as returned by Cirrus.
@@ -71,24 +72,3 @@ nimbus:
7172
expires: never
7273
send_in_pings:
7374
- page-view
74-
data_collection:
75-
opt_out:
76-
type: event
77-
description: >
78-
Recorded when a user has opted out of data collection.
79-
extra_keys:
80-
nimbus_user_id:
81-
type: string
82-
description: A unique identifier for User/Client sending a request to get feature configuration
83-
bugs:
84-
- https://bugzilla.mozilla.org/show_bug.cgi?id=1977472
85-
data_reviews:
86-
- https://bugzilla.mozilla.org/show_bug.cgi?id=1977472
87-
data_sensitivity:
88-
- technical
89-
notification_emails:
90-
91-
92-
expires: never
93-
send_in_pings:
94-
- events

experimenter/experimenter/telemetry/pings.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,16 @@ page-view:
1414
- https://bugzilla.mozilla.org/show_bug.cgi?id=1977472
1515
data_reviews:
1616
- https://bugzilla.mozilla.org/show_bug.cgi?id=1977472
17+
18+
data-collection-opt-out:
19+
description: >
20+
A ping to record data collection opt outs. The purpose of this data
21+
gathering is to act as a custom deletion request for nimbus_user_id.
22+
include_client_id: false
23+
notification_emails:
24+
25+
26+
bugs:
27+
- https://bugzilla.mozilla.org/show_bug.cgi?id=1977472
28+
data_reviews:
29+
- https://bugzilla.mozilla.org/show_bug.cgi?id=1977472

0 commit comments

Comments
 (0)