Skip to content

[Tracer] Add Cosmos DB CRUD instrumentation#7837

Merged
pablomartinezbernardo merged 11 commits intomasterfrom
pmartinez/cosmos-crud3
Jan 12, 2026
Merged

[Tracer] Add Cosmos DB CRUD instrumentation#7837
pablomartinezbernardo merged 11 commits intomasterfrom
pmartinez/cosmos-crud3

Conversation

@pablomartinezbernardo
Copy link
Contributor

@pablomartinezbernardo pablomartinezbernardo commented Nov 18, 2025

Summary of changes

Trace CRUD operations in addition to already traced queries. With additional tags:

  • Response status codes
  • Connection mode
  • User Agent

Other details

MinimumVersion = "3.12.0" as that is the lowest we can test with the emulator

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

1 occurrences of :

+    Resource: Create //dbs/,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_3,
+    SpanId: Id_4,
+    Name: cosmosdb.query,
+    Resource: Create dbs/db,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_5,
+    SpanId: Id_6,
+    Name: cosmosdb.query,
+    Resource: Create dbs/db/colls/items,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_7,
+    SpanId: Id_8,
+    Name: cosmosdb.query,
+    Resource: Create dbs/db/colls/items,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_9,
+    SpanId: Id_10,
+    Name: cosmosdb.query,
+    Resource: Delete dbs/db,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 204,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_11,
+    SpanId: Id_12,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_13,
+    SpanId: Id_14,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db/colls/items,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_15,
+    SpanId: Id_16,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db/colls/items/docs/Andersen.1,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_17,
+    SpanId: Id_18,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db/colls/items/docs/Wakefield.7,
+    Service: Samples.CosmosDb.Vnext-cosmosdb,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: https://cosmosdb-emulator:8081/,
+      runtime-id: Guid_1,
+      span.kind: client,
+      _dd.base_service: Samples.CosmosDb.Vnext
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_19,
+    SpanId: Id_20,
+    Name: cosmosdb.query,

2 occurrences of :

-    TraceId: Id_3,
-    SpanId: Id_4,
+    TraceId: Id_21,
+    SpanId: Id_22,

2 occurrences of :

-    TraceId: Id_5,
-    SpanId: Id_6,
+    TraceId: Id_23,
+    SpanId: Id_24,

2 occurrences of :

-    TraceId: Id_7,
-    SpanId: Id_8,
+    TraceId: Id_25,
+    SpanId: Id_26,

1 occurrences of :

+    Resource: Create //dbs/,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: cosmosdb-emulator,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: out.host
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_3,
+    SpanId: Id_4,
+    Name: cosmosdb.query,
+    Resource: Create dbs/db,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: cosmosdb-emulator,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: out.host
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_5,
+    SpanId: Id_6,
+    Name: cosmosdb.query,
+    Resource: Create dbs/db/colls/items,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: db,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: db.name
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_7,
+    SpanId: Id_8,
+    Name: cosmosdb.query,
+    Resource: Create dbs/db/colls/items,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 201,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: db,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: db.name
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_9,
+    SpanId: Id_10,
+    Name: cosmosdb.query,
+    Resource: Delete dbs/db,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 204,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: cosmosdb-emulator,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: out.host
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_11,
+    SpanId: Id_12,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: cosmosdb-emulator,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: out.host
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_13,
+    SpanId: Id_14,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db/colls/items,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: cosmosdb-emulator,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: out.host
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_15,
+    SpanId: Id_16,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db/colls/items/docs/Andersen.1,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: db,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: db.name
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_17,
+    SpanId: Id_18,
+    Name: cosmosdb.query,
+    Resource: Read dbs/db/colls/items/docs/Wakefield.7,
+    Service: Samples.CosmosDb.Vnext,
+    Type: sql,
+    Tags: {
+      component: CosmosDb,
+      cosmosdb.connection.mode: gateway,
+      cosmosdb.container: items,
+      db.name: db,
+      db.response.status_code: 404,
+      db.type: cosmosdb,
+      env: integration_tests,
+      http.useragent: cosmos-netstandard-sdk/3.0.0|3.0.0|00|arch|os|runtime|,
+      language: dotnet,
+      out.host: cosmosdb-emulator,
+      out.port: 8081,
+      peer.service: db,
+      runtime-id: Guid_1,
+      span.kind: client,
+      version: 1.0.0,
+      _dd.peer.service.source: db.name
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_19,
+    SpanId: Id_20,
+    Name: cosmosdb.query,

@datadog-official

This comment has been minimized.

@dd-trace-dotnet-ci-bot
Copy link

dd-trace-dotnet-ci-bot bot commented Nov 18, 2025

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (7837) and master.

✅ No regressions detected - check the details below

Full Metrics Comparison

FakeDbCommand

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration68.46 ± (68.50 - 68.71) ms68.47 ± (68.50 - 68.72) ms+0.0%✅⬆️
.NET Framework 4.8 - Bailout
duration72.45 ± (72.44 - 72.66) ms72.39 ± (72.33 - 72.60) ms-0.1%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1004.81 ± (1005.58 - 1010.73) ms1008.89 ± (1011.39 - 1018.94) ms+0.4%✅⬆️
.NET Core 3.1 - Baseline
process.internal_duration_ms21.99 ± (21.96 - 22.02) ms22.09 ± (22.06 - 22.12) ms+0.5%✅⬆️
process.time_to_main_ms78.91 ± (78.74 - 79.08) ms79.02 ± (78.87 - 79.16) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.90 ± (10.90 - 10.91) MB10.92 ± (10.92 - 10.93) MB+0.2%✅⬆️
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms21.99 ± (21.97 - 22.01) ms21.90 ± (21.89 - 21.92) ms-0.4%
process.time_to_main_ms80.20 ± (80.12 - 80.28) ms80.05 ± (79.95 - 80.15) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.94 ± (10.93 - 10.94) MB10.95 ± (10.94 - 10.95) MB+0.1%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms234.20 ± (230.34 - 238.07) ms231.16 ± (227.54 - 234.78) ms-1.3%
process.time_to_main_ms472.10 ± (471.52 - 472.69) ms473.47 ± (472.95 - 473.98) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.18 ± (48.16 - 48.21) MB48.27 ± (48.24 - 48.29) MB+0.2%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.0%
.NET 6 - Baseline
process.internal_duration_ms20.68 ± (20.65 - 20.71) ms20.94 ± (20.86 - 21.01) ms+1.2%✅⬆️
process.time_to_main_ms68.23 ± (68.10 - 68.36) ms68.93 ± (68.62 - 69.25) ms+1.0%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.62 ± (10.61 - 10.62) MB10.64 ± (10.63 - 10.64) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.58 ± (20.56 - 20.60) ms20.81 ± (20.79 - 20.84) ms+1.2%✅⬆️
process.time_to_main_ms69.02 ± (68.97 - 69.06) ms69.48 ± (69.42 - 69.54) ms+0.7%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.66 ± (10.66 - 10.67) MB10.73 ± (10.72 - 10.74) MB+0.6%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms245.92 ± (244.22 - 247.62) ms246.64 ± (244.79 - 248.49) ms+0.3%✅⬆️
process.time_to_main_ms441.86 ± (441.41 - 442.31) ms443.36 ± (442.93 - 443.79) ms+0.3%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.73 ± (48.70 - 48.76) MB48.77 ± (48.74 - 48.80) MB+0.1%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.4%
.NET 8 - Baseline
process.internal_duration_ms18.90 ± (18.88 - 18.93) ms18.93 ± (18.90 - 18.95) ms+0.1%✅⬆️
process.time_to_main_ms67.34 ± (67.24 - 67.44) ms67.45 ± (67.35 - 67.54) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.68 ± (7.67 - 7.68) MB7.69 ± (7.68 - 7.69) MB+0.1%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms18.89 ± (18.87 - 18.92) ms18.87 ± (18.85 - 18.90) ms-0.1%
process.time_to_main_ms68.64 ± (68.57 - 68.70) ms68.44 ± (68.39 - 68.50) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.76 ± (7.75 - 7.78) MB7.74 ± (7.73 - 7.75) MB-0.3%
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms179.16 ± (178.38 - 179.95) ms177.85 ± (176.90 - 178.80) ms-0.7%
process.time_to_main_ms425.52 ± (424.92 - 426.11) ms425.19 ± (424.70 - 425.69) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.39 ± (36.37 - 36.42) MB36.40 ± (36.37 - 36.42) MB+0.0%✅⬆️
runtime.dotnet.threads.count27 ± (27 - 27)27 ± (27 - 27)+0.1%✅⬆️

HttpMessageHandler

Metric Master (Mean ± 95% CI) Current (Mean ± 95% CI) Change Status
.NET Framework 4.8 - Baseline
duration192.55 ± (192.54 - 193.38) ms192.96 ± (192.85 - 193.68) ms+0.2%✅⬆️
.NET Framework 4.8 - Bailout
duration196.36 ± (196.21 - 196.70) ms196.66 ± (196.49 - 197.28) ms+0.2%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1113.32 ± (1119.65 - 1128.96) ms1108.54 ± (1112.30 - 1121.17) ms-0.4%
.NET Core 3.1 - Baseline
process.internal_duration_ms187.05 ± (186.72 - 187.38) ms187.45 ± (187.08 - 187.82) ms+0.2%✅⬆️
process.time_to_main_ms80.12 ± (79.92 - 80.32) ms80.09 ± (79.92 - 80.26) ms-0.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.11 ± (16.09 - 16.13) MB16.08 ± (16.06 - 16.11) MB-0.2%
runtime.dotnet.threads.count20 ± (20 - 20)20 ± (19 - 20)-0.8%
.NET Core 3.1 - Bailout
process.internal_duration_ms187.05 ± (186.71 - 187.38) ms187.67 ± (187.34 - 188.01) ms+0.3%✅⬆️
process.time_to_main_ms81.31 ± (81.18 - 81.45) ms81.76 ± (81.60 - 81.91) ms+0.5%✅⬆️
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.14 ± (16.11 - 16.17) MB16.19 ± (16.17 - 16.21) MB+0.3%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (21 - 21)+0.6%✅⬆️
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms419.47 ± (415.95 - 423.00) ms430.92 ± (428.59 - 433.24) ms+2.7%✅⬆️
process.time_to_main_ms473.43 ± (472.83 - 474.03) ms473.30 ± (472.79 - 473.81) ms-0.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.55 ± (58.43 - 58.66) MB58.75 ± (58.64 - 58.87) MB+0.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 30)29 ± (29 - 29)-0.1%
.NET 6 - Baseline
process.internal_duration_ms193.47 ± (193.03 - 193.90) ms192.37 ± (191.99 - 192.75) ms-0.6%
process.time_to_main_ms69.90 ± (69.69 - 70.11) ms69.61 ± (69.39 - 69.83) ms-0.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.24 ± (16.15 - 16.32) MB16.21 ± (16.09 - 16.33) MB-0.2%
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.2%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.15 ± (190.87 - 191.44) ms191.38 ± (190.98 - 191.78) ms+0.1%✅⬆️
process.time_to_main_ms70.23 ± (70.14 - 70.33) ms70.53 ± (70.38 - 70.67) ms+0.4%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.87 ± (15.70 - 16.03) MB16.10 ± (15.95 - 16.25) MB+1.5%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)+0.5%✅⬆️
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms446.29 ± (443.08 - 449.49) ms455.00 ± (452.74 - 457.27) ms+2.0%✅⬆️
process.time_to_main_ms446.86 ± (446.19 - 447.53) ms447.23 ± (446.61 - 447.85) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.58 ± (58.45 - 58.71) MB58.46 ± (58.34 - 58.59) MB-0.2%
runtime.dotnet.threads.count30 ± (29 - 30)30 ± (30 - 30)+0.2%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms190.69 ± (190.35 - 191.02) ms189.30 ± (188.98 - 189.61) ms-0.7%
process.time_to_main_ms68.90 ± (68.73 - 69.06) ms68.73 ± (68.56 - 68.89) ms-0.2%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.74 ± (11.72 - 11.76) MB11.77 ± (11.74 - 11.80) MB+0.2%✅⬆️
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.6%
.NET 8 - Bailout
process.internal_duration_ms189.46 ± (189.19 - 189.74) ms188.76 ± (188.49 - 189.04) ms-0.4%
process.time_to_main_ms69.81 ± (69.72 - 69.90) ms69.75 ± (69.65 - 69.84) ms-0.1%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.75 ± (11.72 - 11.78) MB11.86 ± (11.83 - 11.88) MB+0.9%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.3%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms363.29 ± (361.84 - 364.74) ms360.75 ± (359.30 - 362.20) ms-0.7%
process.time_to_main_ms428.31 ± (427.66 - 428.95) ms428.29 ± (427.66 - 428.91) ms-0.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.93 ± (47.90 - 47.97) MB48.09 ± (48.05 - 48.12) MB+0.3%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)-0.0%
Comparison explanation

Execution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard.

Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph).

Duration charts
FakeDbCommand (.NET Framework 4.8)
gantt
    title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (69ms)  : 67, 70
    master - mean (69ms)  : 67, 70

    section Bailout
    This PR (7837) - mean (72ms)  : 71, 74
    master - mean (73ms)  : 71, 74

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (1,015ms)  : 960, 1071
    master - mean (1,008ms)  : 971, 1045

Loading
FakeDbCommand (.NET Core 3.1)
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (106ms)  : 104, 109
    master - mean (106ms)  : 103, 109

    section Bailout
    This PR (7837) - mean (107ms)  : 105, 109
    master - mean (107ms)  : 106, 108

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (732ms)  : 679, 785
    master - mean (732ms)  : 678, 785

Loading
FakeDbCommand (.NET 6)
gantt
    title Execution time (ms) FakeDbCommand (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (95ms)  : 88, 101
    master - mean (94ms)  : 91, 96

    section Bailout
    This PR (7837) - mean (95ms)  : 94, 96
    master - mean (94ms)  : 93, 95

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (715ms)  : 689, 742
    master - mean (713ms)  : 679, 746

Loading
FakeDbCommand (.NET 8)
gantt
    title Execution time (ms) FakeDbCommand (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (92ms)  : 90, 95
    master - mean (92ms)  : 90, 94

    section Bailout
    This PR (7837) - mean (93ms)  : 92, 94
    master - mean (94ms)  : 92, 95

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (633ms)  : 614, 651
    master - mean (634ms)  : 618, 650

Loading
HttpMessageHandler (.NET Framework 4.8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (193ms)  : 189, 197
    master - mean (193ms)  : 189, 197

    section Bailout
    This PR (7837) - mean (197ms)  : 193, 201
    master - mean (196ms)  : 194, 199

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (1,117ms)  : 1053, 1181
    master - mean (1,124ms)  : 1054, 1195

Loading
HttpMessageHandler (.NET Core 3.1)
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (276ms)  : 271, 281
    master - mean (276ms)  : 271, 281

    section Bailout
    This PR (7837) - mean (278ms)  : 270, 286
    master - mean (276ms)  : 272, 281

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (931ms)  : 894, 968
    master - mean (923ms)  : 863, 983

Loading
HttpMessageHandler (.NET 6)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (270ms)  : 264, 276
    master - mean (272ms)  : 265, 278

    section Bailout
    This PR (7837) - mean (270ms)  : 264, 276
    master - mean (270ms)  : 266, 273

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (928ms)  : 887, 969
    master - mean (923ms)  : 869, 976

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (7837) - mean (268ms)  : 263, 272
    master - mean (269ms)  : 262, 276

    section Bailout
    This PR (7837) - mean (268ms)  : 265, 272
    master - mean (269ms)  : 265, 272

    section CallTarget+Inlining+NGEN
    This PR (7837) - mean (821ms)  : 801, 841
    master - mean (822ms)  : 804, 841

Loading

@pr-commenter
Copy link

pr-commenter bot commented Nov 18, 2025

Benchmarks

Benchmark execution time: 2026-01-10 17:53:54

Comparing candidate commit cdd0c25 in PR branch pmartinez/cosmos-crud3 with baseline commit f7b598c in branch master.

Found 15 performance improvements and 5 performance regressions! Performance is the same for 149 metrics, 17 unstable metrics.

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+81.878ms; +82.249ms] or [+67.098%; +67.402%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟩 throughput [+548.048op/s; +561.490op/s] or [+6.259%; +6.412%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟩 execution_time [-23.590ms; -23.199ms] or [-11.549%; -11.358%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟩 throughput [+68.570op/s; +114.193op/s] or [+6.387%; +10.637%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472

  • 🟩 throughput [+25.428op/s; +26.685op/s] or [+5.100%; +5.352%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • 🟥 throughput [-212.966op/s; -158.731op/s] or [-39.196%; -29.214%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1

  • 🟩 execution_time [-131.053µs; -120.160µs] or [-6.575%; -6.028%]
  • 🟩 throughput [+32.261op/s; +35.223op/s] or [+6.430%; +7.021%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 throughput [-20979.402op/s; -19725.420op/s] or [-7.117%; -6.692%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟩 execution_time [-15.801ms; -10.850ms] or [-7.515%; -5.160%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.150ms; -10.713ms] or [-7.551%; -5.009%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1

  • 🟩 execution_time [-17.386ms; -11.908ms] or [-8.266%; -5.661%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • 🟥 throughput [-3755.068op/s; -1503.923op/s] or [-16.231%; -6.500%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟩 execution_time [-13.915ms; -13.267ms] or [-6.867%; -6.547%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟩 execution_time [-36.140ms; -34.125ms] or [-18.116%; -17.106%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟥 execution_time [+10.866ms; +12.250ms] or [+5.406%; +6.095%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1

  • 🟩 throughput [+25580.233op/s; +34906.735op/s] or [+6.966%; +9.506%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟩 throughput [+7411.593op/s; +8600.152op/s] or [+5.036%; +5.844%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟩 throughput [+12653.137op/s; +18027.169op/s] or [+5.743%; +8.182%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟩 execution_time [-16.374ms; -11.089ms] or [-7.687%; -5.206%]

@pablomartinezbernardo pablomartinezbernardo force-pushed the pmartinez/cosmos-crud3 branch 2 times, most recently from 33c2603 to d791f85 Compare November 20, 2025 15:11
@pablomartinezbernardo pablomartinezbernardo force-pushed the pmartinez/cosmos-crud3 branch 2 times, most recently from 16cc8ed to b1e239e Compare December 3, 2025 12:07
@pablomartinezbernardo pablomartinezbernardo changed the title Cosmos CRUD [Tracer] Add Cosmos DB CRUD instrumentation Dec 4, 2025
@pablomartinezbernardo pablomartinezbernardo added area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:new-feature area:integrations labels Dec 4, 2025
@pablomartinezbernardo pablomartinezbernardo marked this pull request as ready for review December 4, 2025 15:19
@pablomartinezbernardo pablomartinezbernardo requested review from a team as code owners December 4, 2025 15:19
@pablomartinezbernardo
Copy link
Contributor Author

Note for @bouwkast : This will likely modify the snapshots made with the manual win emulator tests

@pablomartinezbernardo pablomartinezbernardo requested review from bouwkast and lucaspimentel and removed request for bouwkast and lucaspimentel December 23, 2025 13:26
@lucaspimentel
Copy link
Member

@codex review

Copy link

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

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: 9e76fdeb01

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +88 to +92
perTraceSettings.Schema.RemapPeerService(tags);

var scope = tracer.StartActiveInternal(operationName, tags: tags, serviceName: serviceName);
var span = scope.Span;

Choose a reason for hiding this comment

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

P2 Badge Honor analytics settings on Cosmos CRUD spans

The new CRUD instrumentation creates the Cosmos span and remaps peer service but never applies the integration analytics sampling (tags.SetAnalyticsSampleRate(...)) before starting the scope. Existing Cosmos query spans call this helper in CosmosCommon.CreateCosmosDbCallState, so DD_TRACE_COSMOSDB_ANALYTICS_ENABLED/DD_TRACE_ANALYTICS_ENABLED will be ignored for CRUD operations while still affecting query spans. This leaves analytics dashboards missing the new CRUD spans even when users have explicitly enabled analytics sampling.

Useful? React with 👍 / 👎.

{
var tags = (CosmosDbTags)scope.Span.Tags;
var statusCode = (int)returnValue.StatusCode;
tags.ResponseStatusCode = statusCode.ToString();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tags.ResponseStatusCode = statusCode.ToString();
tags.ResponseStatusCode = statusCode.ToString(CultureInfo.InvariantCulture);

IntegrationName = nameof(IntegrationId.CosmosDb))]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public class RequestInvokerHandlerSendAsyncIntegration
Copy link
Member

Choose a reason for hiding this comment

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

See #7879

Suggested change
public class RequestInvokerHandlerSendAsyncIntegration
public sealed class RequestInvokerHandlerSendAsyncIntegration

if (cosmosContainerCore?.Instance != null)
{
containerId = cosmosContainerCore.Id;
databaseId = cosmosContainerCore.Database.Id;
Copy link
Member

@lucaspimentel lucaspimentel Jan 6, 2026

Choose a reason for hiding this comment

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

We check if cosmosContainerCore is null above, but is cosmosContainerCore.Database guaranteed to not be null?

Suggested change
databaseId = cosmosContainerCore.Database.Id;
databaseId = cosmosContainerCore.Database?.Id;

{
HttpStatusCode StatusCode { get; }

IResponseHeaders Headers { get; }
Copy link
Member

@lucaspimentel lucaspimentel Jan 6, 2026

Choose a reason for hiding this comment

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

We check for null Headers in RequestInvokerHandlerSendAsyncIntegration:121

if (returnValue.Headers?.Instance != null)

If it's nullable, we should make that explicit:

Suggested change
IResponseHeaders Headers { get; }
IResponseHeaders? Headers { get; }

tags.UserAgent = clientContext.UserAgent;

var connectionMode = clientContext.ClientOptions.ConnectionMode;
tags.ConnectionMode = connectionMode == 0 ? "gateway" : "direct";
Copy link
Member

@lucaspimentel lucaspimentel Jan 6, 2026

Choose a reason for hiding this comment

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

Currently, 0 == gateway and 1 == direct. To be safe (and for future-proofing), should we use something like "other" if we get any other value?

tags.ConnectionMode = connectionMode switch
{
    0 => "gateway"
    1 => "direct"
    _ => "other"
};

ref: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/ConnectionMode.cs

Comment on lines +20 to +22
string Id { get; }

IDatabase Database { get; }
Copy link
Member

Choose a reason for hiding this comment

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

Check with @bouwkast, but I think recently we've opted to make most of these nullable to enforce null checks.

Suggested change
string Id { get; }
IDatabase Database { get; }
string? Id { get; }
IDatabase? Database { get; }

Copy link
Collaborator

Choose a reason for hiding this comment

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

So the analyzer that I added for the nullability would actually be usages of this IContainer to assert that we correctly check that the .Instance of it isn't null like so here https://github.com/DataDog/dd-trace-dotnet/pull/7837/changes/BASE..9e76fdeb01fdc793552cf359a499630ac8517d31#diff-6d20fdf5e3a9fdde27d0c555d0d967ce44f5ae83910a05acb7b4ad7c0d511756R65

So not necessarily the properties within the object

Copy link
Member

Choose a reason for hiding this comment

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

Our internal analyzer aside, is making these properties nullable something we recommend so that the C# compiler itself will warn you if you don't check for null?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I think marking them nullable is a good idea 👍

/// </remarks>
internal interface IDatabase : IDuckType
{
string Id { get; }
Copy link
Member

Choose a reason for hiding this comment

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

See comment in IContainer.cs

Suggested change
string Id { get; }
string? Id { get; }

Copy link
Collaborator

@bouwkast bouwkast left a comment

Choose a reason for hiding this comment

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

LGTM I do see the changes on the snapshots
Up to you if you want me to include those in your PR or to just do them in a later PR, level of care for those is low as they are the old ones skipped in CI

/// <summary>
/// The original user agent string. Used for SDK clients such as Azure SDK.
/// </summary>
internal const string UserAgentOriginal = "user_agent.original";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this http.useragent? Or at least I thought that is our convention / mapping to this OpenTelemetry one

<RequiresDockerDependency>All</RequiresDockerDependency>
<SampleName>Samples.Kafka</SampleName>
</PackageVersionSample>
<PackageVersionSample Include="test\test-applications\integrations\Samples.CosmosDb\Samples.CosmosDb.csproj">
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these have all been removed due to running the GeneratePackageVersions script on Mac?
Not a major deal though and probably something I will note down to try and improve.

Everything seems to work correctly though on .NET FX

Comment on lines +20 to +22
string Id { get; }

IDatabase Database { get; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

So the analyzer that I added for the nullability would actually be usages of this IContainer to assert that we correctly check that the .Instance of it isn't null like so here https://github.com/DataDog/dd-trace-dotnet/pull/7837/changes/BASE..9e76fdeb01fdc793552cf359a499630ac8517d31#diff-6d20fdf5e3a9fdde27d0c555d0d967ce44f5ae83910a05acb7b4ad7c0d511756R65

So not necessarily the properties within the object

@pablomartinezbernardo pablomartinezbernardo force-pushed the pmartinez/cosmos-crud3 branch 3 times, most recently from ff0fb9c to 4818d94 Compare January 10, 2026 17:10
@pablomartinezbernardo pablomartinezbernardo requested a review from a team as a code owner January 10, 2026 17:10
# Conflicts:
#	tracer/build/PackageVersionsLatestMajors.g.props
#	tracer/build/PackageVersionsLatestMinors.g.props
#	tracer/build/PackageVersionsLatestSpecific.g.props
#	tracer/build/supported_versions.json
#	tracer/dependabot/integrations/Datadog.Dependabot.Microsoft.Azure.Cosmos.csproj
#	tracer/src/Datadog.Tracer.Native/Generated/generated_calltargets.g.cpp
#	tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs
#	tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs
#	tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs
@pablomartinezbernardo pablomartinezbernardo enabled auto-merge (squash) January 10, 2026 18:46
@pablomartinezbernardo pablomartinezbernardo merged commit 3a587ba into master Jan 12, 2026
151 checks passed
@pablomartinezbernardo pablomartinezbernardo deleted the pmartinez/cosmos-crud3 branch January 12, 2026 13:06
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) type:new-feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants