feat(rum): add rum_retention_filters_order resource - #717
michael-richey wants to merge 3 commits into
Conversation
michael-richey
left a comment
There was a problem hiding this comment.
Nice incremental step.
The per-app order modeling and concurrent=False choice both make sense for an ordering resource, and tests cover remapping + endpoint payload shape well.
Non-blocking nit:
- The class/test docstrings mention
exclude_regex_pathsforid/data[*].id, but the config currently doesn't set those exclusions. Behavior looks fine as-is because IDs are remapped before apply; this is mainly a docstring accuracy tweak if you want to align narrative with config.
No blocking issues from my side in this diff.
|
Thanks for the nit — fixed in |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Destination-only filters must be preserved when patching the complete order relationship.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds per-application synchronization of RUM retention-filter ordering.
Changes:
- Introduces the PATCH-only order resource with ID remapping.
- Registers and documents its dependencies.
- Adds unit coverage for retrieval, remapping, patching, and deletion behavior.
| File | Description |
|---|---|
datadog_sync/model/rum_retention_filters_order.py |
Implements order synchronization. |
datadog_sync/models/__init__.py |
Registers the resource model. |
tests/unit/test_rum_retention_filters_order.py |
Adds model unit tests. |
README.md |
Documents support and dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| async def create_resource(self, _id: str, resource: Dict) -> Tuple[str, Dict]: | ||
| destination_client = self.config.destination_client | ||
| app_id = resource["id"] | ||
| payload = {"data": resource["data"]} |
| ``prep_resource`` (so create/update can read them), so they are excluded from | ||
| diffs via ``deep_diff_config.exclude_regex_paths`` rather than | ||
| ``excluded_attributes``. |
e298847 to
c2e4117
Compare
|
Fixed in
|
c2e4117 to
56d4b34
Compare
Integration Test Finding: Cascading dependency failure from
|
| Scenario | Result | Details |
|---|---|---|
| Create | ❌ FAIL | Missing connections to default_errors/default_sessions (cascading from PR #716) |
| Update | SKIP | No destination resources (create failed) |
| Skip | SKIP | No destination resources |
| Delete | SKIP | No destination resources |
No code change needed on this PR — the fix is on PR #716.
56d4b34 to
221d602
Compare
|
This is a cascading failure from PR #716 — |
dec6067 to
2a81276
Compare
221d602 to
390b682
Compare
2a81276 to
6d64fe1
Compare
390b682 to
48de449
Compare
Per-application RUM retention filter order. The order endpoint is PATCH-only
(no GET/DELETE); the source order is captured from the ordered list returned
by /api/v2/rum/applications/{app_id}/retention_filters. The resource is keyed
by application id; id (the app id) and data[*].id (filter ids) are remapped
via resource_connections before apply, and both survive prep_resource (no
excluded_attributes) so create/update can read them. deep_diff_config uses
ignore_order=False so reordering is detected as a diff (ids already match
after connect remapping, so no exclusion is needed).
Order is a separate resource synced after the filters exist at the
destination, matching the codebase convention (logs_archives_order,
sensitive_data_scanner_groups_order, logs_indexes_order, logs_pipelines_order)
-- a pre_apply_hook would run before the destination filters exist.
- datadog_sync/model/rum_retention_filters_order.py (new)
- datadog_sync/models/__init__.py -- register
- tests/unit/test_rum_retention_filters_order.py (new) -- 6 unit tests
- README.md -- add rum_retention_filters_order (depends on rum_applications,
rum_retention_filters)
Integration tests + VCR cassettes deferred (require sandbox-org API access).
The review nit pointed out that the docstring mentions deep_diff_config.exclude_regex_paths for id/data[*].id, but the config doesn't set those exclusions (they were removed during implementation because ids are remapped to match the destination before the diff is computed, so no exclusion is needed). Align the docstring with the actual config.
Per review: the order PATCH sent only source-side IDs, discarding any destination-only filters. Now reads the destination's current filter list, appends destination-only IDs while preserving their relative order, and uses the merged list for the PATCH (matching logs_archives_order.py, logs_indexes_order.py, and sensitive_data_scanner_groups_order.py). Also fixes the test docstring to accurately describe the deep_diff_config (no exclude_regex_paths is set; ids are remapped before the diff, so no exclusion is needed; ignore_order=False so reordering is detected).
6d64fe1 to
e7798c9
Compare
48de449 to
d42eac2
Compare
|
Good addition overall, but I think this currently inherits an ambiguity from the retention filter ids in #716. Ordering remap needs app contextThis resource connects via If retention filter ids are only unique per app (e.g., built-in/default filters), then Suggested direction:
I’d treat this as a blocker for multi-app correctness. |


Summary
Per-application RUM retention filter order. The order endpoint is PATCH-only (no GET/DELETE); the source order is captured from the ordered list returned by
/api/v2/rum/applications/{app_id}/retention_filters.Stacked on #716 (
rum_retention_filters).Design
id(app id) anddata[*].id(filter ids) are remapped viaresource_connections(rum_applications,rum_retention_filters) before apply.prep_resource(noexcluded_attributes) so create/update can read them.deep_diff_config.ignore_order=Falseso reordering is detected as a diff (ids already match after connect remapping, so no exclusion is needed).pre_apply_hookruns before apply, when destination filters do not yet exist. Matches the codebase convention (logs_archives_order,sensitive_data_scanner_groups_order,logs_indexes_order,logs_pipelines_order).delete_resourceis a no-op (no DELETE endpoint).Changes
datadog_sync/model/rum_retention_filters_order.py(new)datadog_sync/models/__init__.py— registertests/unit/test_rum_retention_filters_order.py(new) — 6 unit testsREADME.md— addrum_retention_filters_order(depends onrum_applications,rum_retention_filters)Testing
pytest tests/unit/test_rum_retention_filters_order.py→ 6 passedFollow-up
Integration tests + VCR cassettes deferred (require sandbox-org API access).