[Tracer] Add Cosmos DB CRUD instrumentation#7837
[Tracer] Add Cosmos DB CRUD instrumentation#7837pablomartinezbernardo merged 11 commits intomasterfrom
Conversation
Snapshots difference summaryThe following differences have been observed in committed snapshots. It is meant to help the reviewer. 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,
|
This comment has been minimized.
This comment has been minimized.
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7837) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-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:
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 chartsFakeDbCommand (.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
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
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
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
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
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
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
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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-01-10 17:53:54 Comparing candidate commit cdd0c25 in PR branch 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
scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472
scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0
scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0
scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472
scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0
scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472
scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
|
33c2603 to
d791f85
Compare
16cc8ed to
b1e239e
Compare
|
Note for @bouwkast : This will likely modify the snapshots made with the manual win emulator tests |
|
@codex review |
There was a problem hiding this comment.
💡 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".
| perTraceSettings.Schema.RemapPeerService(tags); | ||
|
|
||
| var scope = tracer.StartActiveInternal(operationName, tags: tags, serviceName: serviceName); | ||
| var span = scope.Span; | ||
|
|
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
| tags.ResponseStatusCode = statusCode.ToString(); | |
| tags.ResponseStatusCode = statusCode.ToString(CultureInfo.InvariantCulture); |
| IntegrationName = nameof(IntegrationId.CosmosDb))] | ||
| [Browsable(false)] | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public class RequestInvokerHandlerSendAsyncIntegration |
There was a problem hiding this comment.
See #7879
| public class RequestInvokerHandlerSendAsyncIntegration | |
| public sealed class RequestInvokerHandlerSendAsyncIntegration |
| if (cosmosContainerCore?.Instance != null) | ||
| { | ||
| containerId = cosmosContainerCore.Id; | ||
| databaseId = cosmosContainerCore.Database.Id; |
There was a problem hiding this comment.
We check if cosmosContainerCore is null above, but is cosmosContainerCore.Database guaranteed to not be null?
| databaseId = cosmosContainerCore.Database.Id; | |
| databaseId = cosmosContainerCore.Database?.Id; |
| { | ||
| HttpStatusCode StatusCode { get; } | ||
|
|
||
| IResponseHeaders Headers { get; } |
There was a problem hiding this comment.
We check for null Headers in RequestInvokerHandlerSendAsyncIntegration:121
if (returnValue.Headers?.Instance != null)If it's nullable, we should make that explicit:
| IResponseHeaders Headers { get; } | |
| IResponseHeaders? Headers { get; } |
| tags.UserAgent = clientContext.UserAgent; | ||
|
|
||
| var connectionMode = clientContext.ClientOptions.ConnectionMode; | ||
| tags.ConnectionMode = connectionMode == 0 ? "gateway" : "direct"; |
There was a problem hiding this comment.
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"
};
| string Id { get; } | ||
|
|
||
| IDatabase Database { get; } |
There was a problem hiding this comment.
Check with @bouwkast, but I think recently we've opted to make most of these nullable to enforce null checks.
| string Id { get; } | |
| IDatabase Database { get; } | |
| string? Id { get; } | |
| IDatabase? Database { get; } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Yeah I think marking them nullable is a good idea 👍
| /// </remarks> | ||
| internal interface IDatabase : IDuckType | ||
| { | ||
| string Id { get; } |
There was a problem hiding this comment.
See comment in IContainer.cs
| string Id { get; } | |
| string? Id { get; } |
bouwkast
left a comment
There was a problem hiding this comment.
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
tracer/src/Datadog.Trace/Tags.cs
Outdated
| /// <summary> | ||
| /// The original user agent string. Used for SDK clients such as Azure SDK. | ||
| /// </summary> | ||
| internal const string UserAgentOriginal = "user_agent.original"; |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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
| string Id { get; } | ||
|
|
||
| IDatabase Database { get; } |
There was a problem hiding this comment.
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
ff0fb9c to
4818d94
Compare
# 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
4818d94 to
cdd0c25
Compare
Summary of changes
Trace CRUD operations in addition to already traced queries. With additional tags:
Other details
MinimumVersion = "3.12.0"as that is the lowest we can test with the emulator