Skip to content

feat(rum): add rum_config resource (singleton) - #723

Open
michael-richey wants to merge 3 commits into
michael.richey/add-rum-teams-ownership-mappingsfrom
michael.richey/add-rum-config
Open

michael-richey wants to merge 3 commits into
michael.richey/add-rum-teams-ownership-mappingsfrom
michael.richey/add-rum-config

Conversation

@michael-richey

Copy link
Copy Markdown
Collaborator

Summary

RUM config — singleton org setting (no DELETE, no per-id path). Only enforced_application_tags is configurable; all other attributes are server-managed and excluded from diffs.

Stacked on #722 (rum_teams_ownership_mappings).

Design

  • get_resources returns a single-element list from GET /rum/config; import_resource keys it by a fixed rum-config id.
  • create_resource checks whether the destination singleton already exists (GET); if so, hydrates state.destination and delegates to update_resource (mirrors logs_archives_order); otherwise POSTs.
  • update_resource PATCHes /rum/config with only enforced_application_tags.
  • delete_resource is a no-op (no DELETE endpoint).
  • concurrent=False (singleton).
  • excluded_attributes: id + all server-managed read-only attrs; only enforced_application_tags participates in diffs.

Changes

  • datadog_sync/model/rum_config.py (new)
  • datadog_sync/models/__init__.py — register
  • tests/unit/test_rum_config.py (new) — 6 unit tests
  • README.md — add rum_config (no dependencies)

Testing

  • pytest tests/unit/test_rum_config.py → 6 passed
  • Full unit suite: no new failures.

Follow-up

Integration tests + VCR cassettes deferred (require sandbox-org API access).

@michael-richey michael-richey left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good singleton modeling overall, and tests clearly cover create-vs-update delegation plus payload minimization.

One reliability concern worth tightening:

  • _existing_destination() catches broad Exception and treats all failures as "singleton absent".
  • On transient/network/auth errors, this can incorrectly fall through to POST and produce misleading failures.

Recommendation: catch CustomClientHTTPError and only suppress 404 (or equivalent not-found), re-raising everything else.

No other blockers in this diff.

@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from e1b613c to 9906fd9 Compare September 25, 2026 20:53
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 11b0454 to ed4224c Compare September 25, 2026 20:53
@michael-richey

Copy link
Copy Markdown
Collaborator Author

Good catch — fixed in 9906fd97. _existing_destination() now catches CustomClientHTTPError and only suppresses 404 (not found), re-raising everything else. A broad Exception fallback is kept for non-HTTP errors (e.g. JSON decode), but HTTP errors now propagate correctly. New test verifies that a 500 error is re-raised rather than swallowed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The existence check incorrectly treats non-HTTP failures as confirmation that the singleton is absent.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds synchronization support for the organization-level RUM configuration singleton.

Changes:

  • Registers and documents the rum_config resource.
  • Implements singleton retrieval, creation, update, and no-op deletion.
  • Adds unit coverage for its lifecycle behavior.
File Description
datadog_sync/​model/​rum_config.py Implements the RUM configuration model.
datadog_sync/​models/​__init__.py Registers the new resource.
tests/​unit/​test_rum_config.py Tests singleton synchronization behavior.
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.

Comment thread datadog_sync/model/rum_config.py Outdated
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from ed4224c to a6f1bb1 Compare September 25, 2026 21:25
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 9906fd9 to 11e9493 Compare September 25, 2026 21:25
@michael-richey

Copy link
Copy Markdown
Collaborator Author

Fixed in 0bb6236f. The broad except Exception fallback is removed. Now only CustomClientHTTPError with status 404 is suppressed; all other exceptions (timeouts, connection failures, malformed responses, 5xx, etc.) propagate immediately.

@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from a6f1bb1 to 6a6c262 Compare September 28, 2026 14:10
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 11e9493 to 3b15fa3 Compare September 28, 2026 14:10
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 6a6c262 to b93a496 Compare October 1, 2026 15:54
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 3b15fa3 to a96af0f Compare October 1, 2026 15:54
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from b93a496 to a20e489 Compare October 1, 2026 16:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from a96af0f to 39a3adb Compare October 1, 2026 16:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from a20e489 to 8dba3ab Compare October 1, 2026 18:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 39a3adb to a183917 Compare October 1, 2026 18:13
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 8dba3ab to 120de49 Compare October 1, 2026 18:49
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from a183917 to db198e5 Compare October 1, 2026 18:49
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 120de49 to f74aaf7 Compare October 1, 2026 19:43
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from db198e5 to 3ab658b Compare October 1, 2026 19:43
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from f74aaf7 to c87118c Compare October 1, 2026 20:17
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 3ab658b to 65d39cd Compare October 1, 2026 20:17
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from c87118c to 9906780 Compare October 1, 2026 20:37
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 65d39cd to 2d94958 Compare October 1, 2026 20:38
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 9906780 to 486b57c Compare October 1, 2026 21:17
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from 2d94958 to ac43644 Compare October 1, 2026 21:17
RUM config is a singleton org setting (no DELETE, no per-id path). Only
enforced_application_tags is configurable; all other attributes are
server-managed and excluded from diffs. create_resource checks whether the
destination singleton already exists and delegates to update_resource if so
(mirroring logs_archives_order); delete_resource is a no-op.

- datadog_sync/model/rum_config.py (new)
- datadog_sync/models/__init__.py -- register
- tests/unit/test_rum_config.py (new) -- 6 unit tests
- README.md -- add rum_config (no dependencies)

Integration tests + VCR cassettes deferred (require sandbox-org API access).
Per review: _existing_destination() caught broad Exception and treated all
failures as 'singleton absent'. On transient/network/auth errors, this
incorrectly fell through to POST and produced misleading failures.

Fix: catch CustomClientHTTPError and only suppress 404 (not found),
re-raising everything else. A broad Exception fallback is kept for
non-HTTP errors (e.g. JSON decode) but HTTP errors now propagate
correctly.
Per review: the broad except Exception fallback in _existing_destination()
converted timeouts, connection failures, and malformed responses into
'absent', causing create_resource to proceed with a POST after an
inconclusive GET. Now only CustomClientHTTPError 404 is suppressed;
all other exceptions propagate.
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-teams-ownership-mappings branch from 486b57c to 41e8074 Compare October 2, 2026 01:45
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-config branch from ac43644 to 1cab88e Compare October 2, 2026 01:45
@michael-richey

Copy link
Copy Markdown
Collaborator Author

Nice work — singleton semantics are handled cleanly.

Highlights:

  • Correctly treating this as a singleton (id = "singleton") simplifies diffing.
  • create_resource() fallback to PATCH when config already exists is a good guardrail.
  • Lightweight, focused tests around list/get behavior and no-op delete behavior are useful.

No blocking concerns from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants