-
Notifications
You must be signed in to change notification settings - Fork 224
feat(nimbus): fetch and store enrollment funnel data alongside monitoring alerts #15735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+156
−12
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2b7c93d
feat(nimbus): fetch and store enrollment funnel data alongside monito…
c8e3d8a
chore(nimbus): refactor GCS client tests and add enrollment funnel co…
737af30
chore(nimbus): convert SAMPLE_FUNNEL_ENTRIES to pytest fixture (EXP-6…
9e6b1f1
Update experimenter/experimenter/jetstream/tests/test_tasks.py
yashikakhurana e9e1eab
Update experimenter/experimenter/jetstream/client.py
yashikakhurana 179ac67
chore(nimbus): limit monitoring data save to only updated fields (EXP…
37629bc
chore(nimbus): fix get_enrollment_funnel_data to use Path consistentl…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| from experimenter.experiments.constants import NimbusConstants | ||
| from experimenter.experiments.models import NimbusChangeLog, NimbusExperiment | ||
| from experimenter.jetstream.client import ( | ||
| get_enrollment_funnel_data, | ||
| get_experiment_data, | ||
| get_monitoring_data, | ||
| get_population_sizing_data, | ||
|
|
@@ -144,6 +145,14 @@ def fetch_monitoring_data(): | |
| return | ||
|
|
||
| alert_data = data.get("v1") | ||
|
|
||
| try: | ||
| funnel_data = get_enrollment_funnel_data() | ||
| funnel_by_slug = funnel_data.get("v1", {}) if funnel_data else {} | ||
| except Exception as e: | ||
| logger.warning(f"Could not fetch enrollment funnel data: {e}") | ||
| funnel_by_slug = {} | ||
|
|
||
| updated_count = 0 | ||
|
|
||
| for exp_slug, monitoring_data in alert_data.items(): | ||
|
|
@@ -153,11 +162,17 @@ def fetch_monitoring_data(): | |
| status=NimbusConstants.Status.LIVE, | ||
| ) | ||
|
|
||
| # Only update if data has changed | ||
| if experiment.monitoring_data != monitoring_data: | ||
| experiment.monitoring_data = monitoring_data | ||
| merged = { | ||
| **monitoring_data, | ||
| "enrollment_funnel": funnel_by_slug.get(exp_slug, []), | ||
| } | ||
|
|
||
| if experiment.monitoring_data != merged: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can call save with |
||
| experiment.monitoring_data = merged | ||
| experiment.monitoring_data_updated_at = timezone.now() | ||
| experiment.save() | ||
| experiment.save( | ||
| update_fields=["monitoring_data", "monitoring_data_updated_at"] | ||
| ) | ||
| generate_nimbus_changelog( | ||
| experiment, | ||
| get_kinto_user(), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got distracted by a meeting partway through reviewing this, so I'll just leave a quick comment for posterity: This is another spot where it'd be nice to have the data defined in the schemas package so we can validate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 we should definitely do schema validation, I will add that in the ticket