Skip to content

feat(rum): add rum_metrics resource - #715

Open
michael-richey wants to merge 2 commits into
michael.richey/add-rum-applications-testsfrom
michael.richey/add-rum-metrics
Open

michael-richey wants to merge 2 commits into
michael.richey/add-rum-applications-testsfrom
michael.richey/add-rum-metrics

Conversation

@michael-richey

Copy link
Copy Markdown
Collaborator

Summary

First RUM resource in the RUM initiative. Adds rum_metrics (RUM-based metrics, /api/v2/rum/config/metrics), modeled on spans_metrics: skip_resource_mapping=True, full CRUD, and a 409-on-create fallback that hydrates state.destination via GET-by-id then PATCHes — so a first run against a pre-populated destination does not fail permanently on a metric-name conflict.

Stacked on top of #714 (the rum_applications prep PR).

Changes

  • datadog_sync/model/rum_metrics.py (new) — RUMMetrics model, resource_type="rum_metrics", base_path="/api/v2/rum/config/metrics", skip_resource_mapping=True.
  • datadog_sync/models/__init__.py — register RUMMetrics.
  • tests/unit/test_rum_metrics.py (new) — 8 unit tests pinning get_resources, import_resource (by-id + passthrough), create_resource, update_resource, delete_resource, and the 409 fallback contract (GET-by-id → hydrate state → PATCH) plus non-409 reraise.
  • README.md — add rum_metrics to the supported-resources and dependency tables (no dependencies).

Testing

  • pytest tests/unit/test_rum_metrics.py → 8 passed
  • pytest tests/unit/test_rum_metrics.py tests/unit/test_rum_applications.py → 15 passed
  • Full unit suite: no new failures (5 pre-existing subprocess-test failures unchanged).

Notes / follow-up

Integration tests + VCR cassettes are deferred — recording requires sandbox-org API access not available in this session. The model behavior is fully covered by unit tests (AsyncMock clients, same pattern as test_spans_metrics_409_fallback.py). A follow-up will add tests/integration/resources/test_rum_metrics.py (subclassing BaseResourcesTestClass, field_to_update="attributes.filter.query") and record the 8 cassettes.

@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.

Solid addition.

Highlights:

  • Model implementation is consistent with existing spans_metrics semantics.
  • The POST-409 fallback to GET-by-id + PATCH is a strong reliability pattern for skip_resource_mapping=True resources.
  • Tests cover happy path plus non-409 re-raise behavior, which is exactly what we want.

No blocking issues found in this PR diff.

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

🟢 Approval recommended

The implementation follows established resource patterns and has focused unit coverage for its key behaviors.

Review effort: Balanced
Findings: None

What changed in this PR

Adds rum_metrics synchronization with full CRUD support and conflict recovery for pre-existing destination metrics.

Changes:

  • Implements and registers the RUMMetrics resource model.
  • Adds unit coverage for CRUD and 409 fallback behavior.
  • Documents rum_metrics as a supported, dependency-free resource.
File Description
datadog_sync/​model/​rum_metrics.py Implements RUM metric synchronization.
datadog_sync/​models/​__init__.py Registers the new resource model.
tests/​unit/​test_rum_metrics.py Covers CRUD and conflict handling.
README.md Documents resource support and dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@michael-richey
michael-richey force-pushed the michael.richey/add-rum-applications-tests branch from 628a03c to db40ee8 Compare October 1, 2026 20:37
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-metrics branch 3 times, most recently from 0b8775f to 062e450 Compare October 1, 2026 21:16
michael-richey and others added 2 commits October 1, 2026 21:45
Add the rum_metrics resource type (RUM-based metrics, /api/v2/rum/config/metrics),
modeled on spans_metrics: skip_resource_mapping=True, full CRUD, and a 409-on-create
fallback that hydrates state.destination via GET-by-id then PATCHes — so a first run
against a pre-populated destination does not fail permanently on a metric-name conflict.

- datadog_sync/model/rum_metrics.py (new) — RUMMetrics model
- datadog_sync/models/__init__.py — register RUMMetrics
- tests/unit/test_rum_metrics.py (new) — 8 unit tests pinning get/import/create/
  update/delete and the 409 fallback contract
- README.md — add rum_metrics to the supported-resources and dependency tables

Integration tests + VCR cassettes are deferred (require sandbox-org API access to
record) and will be added in a follow-up.
State in the README, import short help, and import docstring that import
reads from the source organization into local state and writes to no
Datadog organization.

Closes #501

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@michael-richey
michael-richey force-pushed the michael.richey/add-rum-metrics branch from 062e450 to 90ac6fb Compare October 2, 2026 01:45
@michael-richey

Copy link
Copy Markdown
Collaborator Author

Nice addition overall. The model/test shape is consistent with spans_metrics, and the 409 fallback contract is clearly tested.

A couple things I liked in particular:

  • The POST(409) -> GET-by-id -> PATCH fallback is explicit and covered.
  • Help-text/documentation updates around import directionality are clear and operator-friendly.

No blocking issues from my side on this PR.

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.

3 participants