Skip to content

Commit

Permalink
feat(cirrus): Update user id to nimbus user id (#12017)
Browse files Browse the repository at this point in the history
Because

- To avoid naming confusion for the integrating web application, we are
changing the name of field user_id to nimbus_user_id

This commit
- Rename the field and update the test case

Fixes #12002 
Note: Will also update this in the enrollment query-
mozilla/bigquery-etl#6595
  • Loading branch information
yashikakhurana authored Jan 17, 2025
1 parent 86dd5b9 commit c330a4a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cirrus/server/cirrus/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async def record_metrics(enrollment_data: list[EnrollmentMetricData]):
for enrollment in enrollment_data:
app.state.metrics.cirrus_events.enrollment.record(
app.state.metrics.cirrus_events.EnrollmentExtra(
user_id=enrollment.nimbus_user_id,
nimbus_user_id=enrollment.nimbus_user_id,
app_id=enrollment.app_id,
experiment=enrollment.experiment_slug,
branch=enrollment.branch_slug,
Expand Down
2 changes: 1 addition & 1 deletion cirrus/server/cirrus/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def record_enrollment_statuses(
reason=enrollment_status_extra.reason or "",
slug=enrollment_status_extra.slug or "",
status=enrollment_status_extra.status or "",
user_id=enrollment_status_extra.user_id or "",
nimbus_user_id=enrollment_status_extra.user_id or "",
)
)
self.pings.enrollment_status.submit()
Expand Down
2 changes: 1 addition & 1 deletion cirrus/server/telemetry/docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In addition to those built-in metrics, the following metrics are added to the pi

| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) |
| --- | --- | --- | --- | --- | --- | --- |
| cirrus_events.enrollment |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Recorded when a user has met the conditions and is first bucketed into an experiment (i.e. targeting matched and they were randomized into a bucket and branch of the experiment). Expected a maximum of once per experiment per user. |[mozilla/experimenter#9081](https://github.com/mozilla/experimenter/pull/9081#issuecomment-1625751843)|<ul><li>app_id: A unique identifier for application</li><li>branch: The branch slug/identifier that was randomly chosen</li><li>experiment: The slug/unique identifier of the experiment</li><li>experiment_type: Indicates whether this is an experiment or rollout</li><li>user_id: A unique identifier for User/Client sending a request to get feature configuration</li></ul>|never |1 |
| cirrus_events.enrollment |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Recorded when a user has met the conditions and is first bucketed into an experiment (i.e. targeting matched and they were randomized into a bucket and branch of the experiment). Expected a maximum of once per experiment per user. |[mozilla/experimenter#9081](https://github.com/mozilla/experimenter/pull/9081#issuecomment-1625751843)|<ul><li>app_id: A unique identifier for application</li><li>branch: The branch slug/identifier that was randomly chosen</li><li>experiment: The slug/unique identifier of the experiment</li><li>experiment_type: Indicates whether this is an experiment or rollout</li><li>nimbus_user_id: A unique identifier for User/Client sending a request to get feature configuration</li></ul>|never |1 |

Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection).

Expand Down
4 changes: 2 additions & 2 deletions cirrus/server/telemetry/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cirrus_events:
experiment_type:
type: string
description: Indicates whether this is an experiment or rollout
user_id:
nimbus_user_id:
type: string
description: A unique identifier for User/Client sending a request to get feature configuration
app_id:
Expand Down Expand Up @@ -67,7 +67,7 @@ cirrus_events:
conflict_slug:
type: string
description: If the enrollment hit a feature conflict, the slug of the conflicting experiment/rollout
user_id:
nimbus_user_id:
type: string
description: The ID of the user requesting enrollment
bugs:
Expand Down
4 changes: 2 additions & 2 deletions cirrus/server/tests/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def before_enrollment_ping(data):

extra_1 = snapshot[0].extra
assert extra_1["app_id"] == "test_app_id"
assert extra_1["user_id"] == "test_client_id"
assert extra_1["nimbus_user_id"] == "test_client_id"
assert extra_1["experiment"] == "cirrus-test-1"
assert extra_1["branch"] == "control"
assert extra_1["experiment_type"] == RecipeType.ROLLOUT.value
assert extra_1["is_preview"] == "false"

extra_2 = snapshot[1].extra
assert extra_2["app_id"] == "test_app_id"
assert extra_2["user_id"] == "test_client_id"
assert extra_2["nimbus_user_id"] == "test_client_id"
assert extra_2["experiment"] == "cirrus-test-2"
assert extra_2["branch"] == "control"
assert extra_2["experiment_type"] == RecipeType.EXPERIMENT.value
Expand Down

0 comments on commit c330a4a

Please sign in to comment.