Skip to content

fix(azure_cosmos): normalize cosmos resources#18258

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
pmartinez/cosmosdb-resource
May 28, 2026
Merged

fix(azure_cosmos): normalize cosmos resources#18258
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
pmartinez/cosmosdb-resource

Conversation

@pablomartinezbernardo

Copy link
Copy Markdown
Contributor

Description

Normalize CosmosDB resource URI IDs to reduce resource cardinality. Resource cardinality should be bound, as it affects metrics and UI. Normalize even segments from the URI that are not the database id or the collection id.

Replicates dotnet fix DataDog/dd-trace-dotnet#8541

Testing

Unit tests

Risks

Users with dashboards and monitors configured on the resource of these spans. Changed without possibility to fall back to the old behavior because this is a bug:

  • Unbounded card can be problematic
  • Filters/groups on resources containing IDs are pretty much useless

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 8 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-py | build linux: [amd64, cp315-cp315, v113741491-d2b8243-musllinux_1_2_x86_64]   View in Datadog   GitLab

🔧 Fix in code (Fix with Cursor). NotImplementedError: This version of CPython is not supported yet

DataDog/apm-reliability/dd-trace-py | build linux serverless: [amd64, cp315-cp315, v113741238-d2b8243-manylinux2014_x86_64, 1]   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. Unable to schedule job due to all nodes being unschedulable: insufficient memory, CPU, and untolerated taints.

DataDog/apm-reliability/dd-trace-py | build linux serverless: [arm64, cp315-cp315, v113741589-d2b8243-musllinux_1_2_aarch64, 1]   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. Error cloning repository: repository not found in cache.

View all 8 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c869b5e | Docs | Datadog PR Page | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d359ce924

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ddtrace/contrib/internal/azure_cosmos/utils.py Outdated
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented May 25, 2026

Copy link
Copy Markdown

Codeowners resolved as

ddtrace/_trace/trace_handlers.py                                        @DataDog/apm-sdk-capabilities-python @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/azure_cosmos/utils.py                          @DataDog/apm-core-python @DataDog/apm-idm-python
releasenotes/notes/azure-cosmos-normalize-resource-uri-9b73444519e403c4.yaml  @DataDog/apm-python
tests/contrib/azure_cosmos/test_normalize_resource_uri.py               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/snapshots/tests.contrib.azure_cosmos.test_azure_cosmos_snapshot.test_cosmos_async.json  @DataDog/apm-python
tests/snapshots/tests.contrib.azure_cosmos.test_azure_cosmos_snapshot.test_cosmos_error.json  @DataDog/apm-python
tests/snapshots/tests.contrib.azure_cosmos.test_azure_cosmos_snapshot.test_cosmos_sync.json  @DataDog/apm-python

@pr-commenter

pr-commenter Bot commented May 25, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-28 08:09:33

Comparing candidate commit c869b5e in PR branch pmartinez/cosmosdb-resource with baseline commit d6198b1 in branch main.

Found 0 performance improvements and 2 performance regressions! Performance is the same for 384 metrics, 9 unstable metrics.

scenario:span-start

  • 🟥 execution_time [+1.335ms; +1.492ms] or [+8.789%; +9.825%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+241.572ns; +280.364ns] or [+11.494%; +13.340%]

@brettlangdon brettlangdon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just a question, not a blocker, otherwise lgtm

Comment thread ddtrace/contrib/internal/azure_cosmos/utils.py
@pablomartinezbernardo

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented May 28, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-05-28 07:03:35 UTC ℹ️ Start processing command /merge


2026-05-28 07:03:41 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 53m (p90).


2026-05-28 07:40:30 UTCMergeQueue: The checks failed on this merge request

Tests failed on this commit 9dcb913:

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 35dcf14 into main May 28, 2026
1161 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the pmartinez/cosmosdb-resource branch May 28, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants