feat(experimentation): provision per-org ingestion infra on external warehouse connect#8052
feat(experimentation): provision per-org ingestion infra on external warehouse connect#8052gagantrivedi wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughAdds organisation-scoped ingestion infrastructure persistence with lifecycle statuses and storage metadata. External warehouse creation now queues organisation provisioning, which records success or failure and writes environment keys. Teardown deletes Firehose streams and S3 buckets, including bucket contents. Organisation deletion schedules asynchronous cleanup. New task, service, model, AWS teardown, and deletion-hook tests cover these paths, while the observability catalogue documents the new events. Estimated code review effort: 3 (Moderate) | ~25 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3fd6331 to
535d4e0
Compare
…warehouse connect Wire per-organisation events S3 bucket and Firehose stream provisioning to external (non-flagsmith) warehouse connection creation, tracked by a new OrganisationIngestionInfrastructure model, and tear it down on organisation deletion.
535d4e0 to
421a205
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8052 +/- ##
========================================
Coverage 98.65% 98.66%
========================================
Files 1514 1517 +3
Lines 60110 60292 +182
========================================
+ Hits 59304 59486 +182
Misses 806 806 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@themis-blindfold review |
Docker builds report
|
⚖️ Themis judgement: 🟠 Fix before mergeWires per-org ingestion infrastructure (S3 bucket + Firehose delivery stream) to warehouse connections: provisions on external warehouse create, tears down on organisation delete. The create-once pattern in
🟠 Majors
📝 Walkthrough
🧪 How to verify
Automate: add a test for Product take: This is the glue that makes per-org event ingestion real for external (bring-your-own) warehouse users. It's a solid step toward self-service experimentation infrastructure, but the deprovisioning path needs to be reliable before it can run unsupervised in production. 🧭 Assumptions & unverified claims
The provisioning side is retry-proof; the deprovisioning side is retry-hostile — a rare asymmetry worth closing before merge. · reviewed at 421a205 |
|
Review was cancelled before completing (worker timeout or shutdown). Mention @themis-blindfold with |
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18560 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
🗂️ Previous results✅ private-cloud · depot-ubuntu-latest-16 — run #18560 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #18560 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #18560 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
There was a problem hiding this comment.
Actionable comments posted: 7
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 749a0e98-f03d-4265-84ef-c9a73d79ca88
📒 Files selected for processing (13)
api/experimentation/ingestion_infra_service.pyapi/experimentation/migrations/0011_organisation_ingestion_infrastructure.pyapi/experimentation/models.pyapi/experimentation/organisation_ingestion_service.pyapi/experimentation/tasks.pyapi/organisations/models.pyapi/tests/unit/experimentation/conftest.pyapi/tests/unit/experimentation/test_ingestion_infra_service.pyapi/tests/unit/experimentation/test_models.pyapi/tests/unit/experimentation/test_organisation_ingestion_service.pyapi/tests/unit/experimentation/test_tasks.pyapi/tests/unit/organisations/test_unit_organisations_models.pydocs/docs/deployment-self-hosting/observability/_events-catalogue.md
Zaimwa9
left a comment
There was a problem hiding this comment.
The deprovisioning path doesn't work as expected from what I see
| infrastructure = OrganisationIngestionInfrastructure.objects.filter( | ||
| organisation_id=organisation_id | ||
| ).first() | ||
| if infrastructure is None: |
There was a problem hiding this comment.
I suspect the organisation soft delete would delete the OrganisationIngestionInfrastructure row here (it's not a soft deletable model) so we would always hit the early return.
I think we could either:
- Have the check upstream ?
- Use a
SoftDeletableModeland include the deleted records in the query ? But that's a bit dirty
I'm not sure we can verify my claims with a test there ?
There was a problem hiding this comment.
Ok I just gave it a try with this test that fails
def test_organisation__delete_with_created_infrastructure__deprovisions_aws_resources(
organisation: Organisation,
mocker: MockerFixture,
) -> None:
# Given
OrganisationIngestionInfrastructure.objects.create(
organisation=organisation,
status=IngestionInfrastructureStatus.CREATED,
bucket_name="flagsmith-events-lake-org-1-123456789012-eu-west-2-an",
stream_name="events-ingestion-org-1",
)
deprovision = mocker.patch(
"experimentation.organisation_ingestion_service"
".deprovision_ingestion_infrastructure",
)
organisation_id = organisation.id
# When
organisation.delete()
# Then
deprovision.assert_called_once_with(organisation_id)
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to the experimentation analytics ingestion pipeline (builds on #8035 and #8020).
Wires the per-organisation events S3 bucket and Firehose delivery stream to warehouse connections:
OrganisationIngestionInfrastructuremodel tracking, per organisation, whether the bucket and stream have been created (create-once).flagsmith) warehouse connection provisions the organisation's bucket and stream, then syncs the environment's ingestion keys.flagsmith) warehouse path is unchanged.How did you test this code?
Unit tests covering the AWS provision/deprovision primitives (via moto), the create-once/errored service layer, the two tasks, and the warehouse-connection and organisation lifecycle hooks. New modules are at 100% coverage and the full experimentation and organisation model suites pass.