Skip to content

[SVLS-7360] Fix Exception Replay in Lambda#8043

Merged
shreyamalpani merged 4 commits intomasterfrom
shreya.malpani/add-top-level-span-to-context-lambda
Jan 13, 2026
Merged

[SVLS-7360] Fix Exception Replay in Lambda#8043
shreyamalpani merged 4 commits intomasterfrom
shreya.malpani/add-top-level-span-to-context-lambda

Conversation

@shreyamalpani
Copy link
Contributor

@shreyamalpani shreyamalpani commented Jan 8, 2026

Summary of changes

  • Sends the placeholder tracer span to the Lambda extension as dd-tracer-serverless-span
  • Sets the Lambda request ID on the span so that the extension can copy the tracer tags to the aws.lambda span that is created in the extension

Reason for change

To support Exception Replay in Lambda

Test coverage

Manually tested with Lambda
image

Other details

SVLS-7360

@shreyamalpani shreyamalpani changed the title Support Exception Replay in Lambda [SVLS-7360] Support Exception Replay in Lambda Jan 8, 2026
@shreyamalpani shreyamalpani changed the title [SVLS-7360] Support Exception Replay in Lambda [SVLS-7360] Fix Exception Replay in Lambda Jan 9, 2026
@pr-commenter
Copy link

pr-commenter bot commented Jan 9, 2026

Benchmarks

Benchmark execution time: 2026-01-12 15:19:36

Comparing candidate commit 45845a1 in PR branch shreya.malpani/add-top-level-span-to-context-lambda with baseline commit 02f5187 in branch master.

Found 8 performance improvements and 6 performance regressions! Performance is the same for 161 metrics, 11 unstable metrics.

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

  • 🟥 execution_time [+80.530ms; +80.718ms] or [+65.965%; +66.119%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟩 execution_time [-91.339ms; -90.766ms] or [-45.480%; -45.195%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟩 execution_time [-15.920ms; -11.010ms] or [-7.568%; -5.234%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟩 execution_time [-18.930ms; -14.935ms] or [-8.834%; -6.969%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 execution_time [-19.227ms; -14.253ms] or [-8.856%; -6.565%]

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

  • 🟥 execution_time [+20.328ms; +22.522ms] or [+11.158%; +12.362%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟩 execution_time [-100.174ms; -89.373ms] or [-50.611%; -45.154%]

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

  • 🟩 throughput [+127.707op/s; +155.202op/s] or [+9.802%; +11.913%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+31.848ms; +37.907ms] or [+20.695%; +24.633%]

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

  • 🟩 execution_time [-16.112ms; -13.846ms] or [-7.522%; -6.464%]

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

  • 🟥 execution_time [+13.555ms; +17.787ms] or [+6.897%; +9.050%]

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

  • 🟩 execution_time [-14.242ms; -10.823ms] or [-7.031%; -5.343%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472

  • 🟥 throughput [-34816.704op/s; -33439.236op/s] or [-9.941%; -9.548%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟥 execution_time [+17.741ms; +18.516ms] or [+8.865%; +9.253%]

@datadog-datadog-prod-us1

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

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.

38 occurrences of :

-      process_id: 0,
-      _dd.top_level: 1.0,
-      _dd.tracer_kr: 1.0,
-      _sampling_priority_v1: 1.0
+      _dd.top_level: 1.0

1 occurrences of :

+  },
+  {
+    TraceId: Id_1,
+    SpanId: Id_2,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_39,
+      runtime-id: Guid_1,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_40,
+      runtime-id: Guid_2,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_41,
+      runtime-id: Guid_3,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_42,
+      runtime-id: Guid_4,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_43,
+      runtime-id: Guid_5,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_44,
+      runtime-id: Guid_6,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_45,
+      runtime-id: Guid_7,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_46,
+      runtime-id: Guid_8,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_47,
+      runtime-id: Guid_9,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    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: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_48,
+      runtime-id: Guid_10,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_21,
+    SpanId: Id_22,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_49,
+      runtime-id: Guid_11,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_23,
+    SpanId: Id_24,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_50,
+      runtime-id: Guid_12,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_25,
+    SpanId: Id_26,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_51,
+      runtime-id: Guid_13,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_27,
+    SpanId: Id_28,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_52,
+      runtime-id: Guid_14,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_29,
+    SpanId: Id_30,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_53,
+      runtime-id: Guid_15,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_31,
+    SpanId: Id_32,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_54,
+      runtime-id: Guid_16,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_33,
+    SpanId: Id_34,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_55,
+      runtime-id: Guid_17,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_35,
+    SpanId: Id_36,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_56,
+      runtime-id: Guid_18,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_37,
+    SpanId: Id_38,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_57,
+      runtime-id: Guid_19,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_39,
+    SpanId: Id_40,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_58,
+      runtime-id: Guid_20,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_41,
+    SpanId: Id_42,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_59,
+      runtime-id: Guid_21,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_43,
+    SpanId: Id_44,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_60,
+      runtime-id: Guid_22,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_45,
+    SpanId: Id_46,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_61,
+      runtime-id: Guid_23,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_47,
+    SpanId: Id_48,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      request_id: Guid_62,
+      runtime-id: Guid_24,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_49,
+    SpanId: Id_50,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      request_id: Guid_63,
+      runtime-id: Guid_25,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_51,
+    SpanId: Id_52,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      request_id: Guid_64,
+      runtime-id: Guid_26,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_53,
+    SpanId: Id_54,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      request_id: Guid_65,
+      runtime-id: Guid_27,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_55,
+    SpanId: Id_56,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      request_id: Guid_66,
+      runtime-id: Guid_28,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_57,
+    SpanId: Id_58,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Error: 1,
+    Tags: {
+      error.msg: Cannot assign requested address,
+      error.stack: Cannot assign requested address (SocketException),
+      error.type: System.Net.WebException,
+      language: dotnet,
+      request_id: Guid_67,
+      runtime-id: Guid_29,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_59,
+    SpanId: Id_60,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_68,
+      runtime-id: Guid_30,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_61,
+    SpanId: Id_62,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_69,
+      runtime-id: Guid_31,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_63,
+    SpanId: Id_64,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_70,
+      runtime-id: Guid_32,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_65,
+    SpanId: Id_66,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_71,
+      runtime-id: Guid_33,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_67,
+    SpanId: Id_68,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_72,
+      runtime-id: Guid_34,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_69,
+    SpanId: Id_70,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_73,
+      runtime-id: Guid_35,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_71,
+    SpanId: Id_72,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_74,
+      runtime-id: Guid_36,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_73,
+    SpanId: Id_74,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_75,
+      runtime-id: Guid_37,
+      _dd.base_service: Samples.AWS.Lambda
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_75,
+    SpanId: Id_76,
+    Name: dd-tracer-serverless-span,
+    Resource: dd-tracer-serverless-span,
+    Service: dd-tracer-serverless-span,
+    Tags: {
+      language: dotnet,
+      request_id: Guid_76,
+      runtime-id: Guid_38,
+      _dd.base_service: Samples.Amazon.Lambda.RuntimeSupport
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }

@shreyamalpani shreyamalpani marked this pull request as ready for review January 9, 2026 21:49
@shreyamalpani shreyamalpani requested review from a team as code owners January 9, 2026 21:49
@dd-trace-dotnet-ci-bot
Copy link

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (8043) 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.49 ± (68.45 - 68.63) ms68.51 ± (68.50 - 68.70) ms+0.0%✅⬆️
.NET Framework 4.8 - Bailout
duration72.29 ± (72.20 - 72.45) ms72.45 ± (72.37 - 72.59) ms+0.2%✅⬆️
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1012.97 ± (1014.46 - 1022.13) ms1005.63 ± (1008.79 - 1016.08) ms-0.7%
.NET Core 3.1 - Baseline
process.internal_duration_ms21.91 ± (21.87 - 21.94) ms22.01 ± (21.98 - 22.04) ms+0.5%✅⬆️
process.time_to_main_ms78.96 ± (78.82 - 79.11) ms78.73 ± (78.59 - 78.86) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.93 ± (10.93 - 10.93) MB10.92 ± (10.92 - 10.92) MB-0.1%
runtime.dotnet.threads.count12 ± (12 - 12)12 ± (12 - 12)+0.0%
.NET Core 3.1 - Bailout
process.internal_duration_ms21.84 ± (21.82 - 21.87) ms21.94 ± (21.92 - 21.97) ms+0.5%✅⬆️
process.time_to_main_ms80.16 ± (80.06 - 80.26) ms80.01 ± (79.92 - 80.11) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.96 ± (10.95 - 10.96) MB10.96 ± (10.96 - 10.96) MB+0.0%✅⬆️
runtime.dotnet.threads.count13 ± (13 - 13)13 ± (13 - 13)+0.0%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms251.56 ± (247.87 - 255.25) ms236.73 ± (232.76 - 240.71) ms-5.9%
process.time_to_main_ms472.55 ± (472.05 - 473.06) ms473.43 ± (472.86 - 474.01) ms+0.2%✅⬆️
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.32 ± (48.30 - 48.34) MB48.27 ± (48.25 - 48.30) MB-0.1%
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)-0.3%
.NET 6 - Baseline
process.internal_duration_ms20.71 ± (20.68 - 20.73) ms20.64 ± (20.61 - 20.66) ms-0.3%
process.time_to_main_ms68.39 ± (68.26 - 68.52) ms68.21 ± (68.08 - 68.34) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.63 ± (10.62 - 10.63) MB10.65 ± (10.65 - 10.65) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 6 - Bailout
process.internal_duration_ms20.65 ± (20.62 - 20.67) ms20.58 ± (20.56 - 20.60) ms-0.3%
process.time_to_main_ms69.41 ± (69.35 - 69.47) ms69.20 ± (69.13 - 69.26) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed10.73 ± (10.72 - 10.73) MB10.75 ± (10.74 - 10.75) MB+0.2%✅⬆️
runtime.dotnet.threads.count11 ± (11 - 11)11 ± (11 - 11)+0.0%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms241.55 ± (238.59 - 244.50) ms245.02 ± (242.93 - 247.12) ms+1.4%✅⬆️
process.time_to_main_ms442.46 ± (441.98 - 442.93) ms442.19 ± (441.74 - 442.64) ms-0.1%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed48.74 ± (48.70 - 48.77) MB48.75 ± (48.72 - 48.78) MB+0.0%✅⬆️
runtime.dotnet.threads.count28 ± (28 - 28)28 ± (28 - 28)+0.1%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms18.95 ± (18.92 - 18.98) ms18.89 ± (18.86 - 18.92) ms-0.3%
process.time_to_main_ms67.61 ± (67.48 - 67.73) ms67.28 ± (67.18 - 67.39) ms-0.5%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.67 ± (7.67 - 7.68) MB7.69 ± (7.68 - 7.70) MB+0.2%✅⬆️
runtime.dotnet.threads.count10 ± (10 - 10)10 ± (10 - 10)+0.0%
.NET 8 - Bailout
process.internal_duration_ms18.92 ± (18.90 - 18.94) ms18.89 ± (18.87 - 18.92) ms-0.1%
process.time_to_main_ms68.59 ± (68.53 - 68.65) ms68.39 ± (68.35 - 68.43) ms-0.3%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed7.72 ± (7.71 - 7.72) MB7.74 ± (7.72 - 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.54 ± (178.53 - 180.54) ms179.79 ± (178.78 - 180.80) ms+0.1%✅⬆️
process.time_to_main_ms426.68 ± (426.01 - 427.34) ms425.98 ± (425.26 - 426.69) ms-0.2%
runtime.dotnet.exceptions.count0 ± (0 - 0)0 ± (0 - 0)+0.0%
runtime.dotnet.mem.committed36.34 ± (36.31 - 36.37) MB36.37 ± (36.34 - 36.40) MB+0.1%✅⬆️
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.80 ± (192.85 - 193.74) ms193.26 ± (193.05 - 193.96) ms+0.2%✅⬆️
.NET Framework 4.8 - Bailout
duration197.57 ± (197.39 - 198.12) ms195.82 ± (195.74 - 196.29) ms-0.9%
.NET Framework 4.8 - CallTarget+Inlining+NGEN
duration1117.53 ± (1119.65 - 1129.09) ms1108.99 ± (1108.03 - 1113.60) ms-0.8%
.NET Core 3.1 - Baseline
process.internal_duration_ms188.21 ± (187.84 - 188.59) ms187.08 ± (186.68 - 187.48) ms-0.6%
process.time_to_main_ms80.40 ± (80.17 - 80.63) ms79.85 ± (79.59 - 80.11) ms-0.7%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.03 ± (16.00 - 16.05) MB16.10 ± (16.07 - 16.13) MB+0.4%✅⬆️
runtime.dotnet.threads.count20 ± (19 - 20)20 ± (20 - 20)+0.6%✅⬆️
.NET Core 3.1 - Bailout
process.internal_duration_ms188.73 ± (188.27 - 189.20) ms186.94 ± (186.66 - 187.23) ms-0.9%
process.time_to_main_ms82.35 ± (82.15 - 82.55) ms81.56 ± (81.43 - 81.70) ms-1.0%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed16.10 ± (16.08 - 16.12) MB16.17 ± (16.14 - 16.19) MB+0.4%✅⬆️
runtime.dotnet.threads.count21 ± (21 - 21)21 ± (20 - 21)-0.3%
.NET Core 3.1 - CallTarget+Inlining+NGEN
process.internal_duration_ms421.70 ± (418.42 - 424.98) ms417.19 ± (413.77 - 420.62) ms-1.1%
process.time_to_main_ms474.57 ± (473.93 - 475.20) ms472.57 ± (471.90 - 473.24) ms-0.4%
runtime.dotnet.exceptions.count3 ± (3 - 3)3 ± (3 - 3)+0.0%
runtime.dotnet.mem.committed58.73 ± (58.61 - 58.86) MB58.63 ± (58.50 - 58.76) MB-0.2%
runtime.dotnet.threads.count29 ± (29 - 30)29 ± (29 - 30)-0.0%
.NET 6 - Baseline
process.internal_duration_ms192.37 ± (191.99 - 192.74) ms192.72 ± (192.28 - 193.16) ms+0.2%✅⬆️
process.time_to_main_ms69.59 ± (69.43 - 69.75) ms69.57 ± (69.39 - 69.76) ms-0.0%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed16.13 ± (15.99 - 16.26) MB15.91 ± (15.76 - 16.05) MB-1.4%
runtime.dotnet.threads.count18 ± (18 - 19)19 ± (19 - 19)+2.2%✅⬆️
.NET 6 - Bailout
process.internal_duration_ms191.44 ± (191.16 - 191.71) ms190.79 ± (190.56 - 191.03) ms-0.3%
process.time_to_main_ms70.53 ± (70.45 - 70.60) ms70.28 ± (70.19 - 70.36) ms-0.4%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed15.99 ± (15.83 - 16.14) MB16.00 ± (15.84 - 16.17) MB+0.1%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.4%
.NET 6 - CallTarget+Inlining+NGEN
process.internal_duration_ms449.24 ± (446.21 - 452.27) ms450.66 ± (447.49 - 453.83) ms+0.3%✅⬆️
process.time_to_main_ms448.11 ± (447.54 - 448.67) ms445.81 ± (445.27 - 446.36) ms-0.5%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed58.44 ± (58.32 - 58.55) MB58.36 ± (58.23 - 58.50) MB-0.1%
runtime.dotnet.threads.count29 ± (29 - 30)30 ± (30 - 30)+0.4%✅⬆️
.NET 8 - Baseline
process.internal_duration_ms190.60 ± (190.24 - 190.95) ms189.96 ± (189.67 - 190.26) ms-0.3%
process.time_to_main_ms69.32 ± (69.12 - 69.53) ms68.99 ± (68.81 - 69.17) ms-0.5%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.78 ± (11.75 - 11.80) MB11.77 ± (11.74 - 11.80) MB-0.0%
runtime.dotnet.threads.count18 ± (18 - 18)18 ± (18 - 18)-0.4%
.NET 8 - Bailout
process.internal_duration_ms190.48 ± (190.05 - 190.91) ms189.28 ± (189.04 - 189.51) ms-0.6%
process.time_to_main_ms70.49 ± (70.35 - 70.63) ms69.95 ± (69.85 - 70.05) ms-0.8%
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed11.81 ± (11.79 - 11.84) MB11.86 ± (11.83 - 11.89) MB+0.4%✅⬆️
runtime.dotnet.threads.count19 ± (19 - 19)19 ± (19 - 19)-0.1%
.NET 8 - CallTarget+Inlining+NGEN
process.internal_duration_ms363.96 ± (362.28 - 365.63) ms364.48 ± (362.91 - 366.06) ms+0.1%✅⬆️
process.time_to_main_ms428.86 ± (428.37 - 429.35) ms429.48 ± (428.87 - 430.08) ms+0.1%✅⬆️
runtime.dotnet.exceptions.count4 ± (4 - 4)4 ± (4 - 4)+0.0%
runtime.dotnet.mem.committed47.95 ± (47.92 - 47.99) MB48.06 ± (48.03 - 48.09) MB+0.2%✅⬆️
runtime.dotnet.threads.count29 ± (29 - 29)29 ± (29 - 29)+0.4%✅⬆️
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 (8043) - mean (69ms)  : 67, 70
    master - mean (69ms)  : 67, 70

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

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (1,012ms)  : 960, 1064
    master - mean (1,018ms)  : 964, 1073

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 (8043) - mean (106ms)  : 104, 108
    master - mean (106ms)  : 103, 109

    section Bailout
    This PR (8043) - mean (107ms)  : 106, 108
    master - mean (107ms)  : 106, 108

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (735ms)  : 677, 793
    master - mean (751ms)  : 690, 813

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

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

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (713ms)  : 681, 745
    master - mean (705ms)  : 646, 765

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

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

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (634ms)  : 621, 647
    master - mean (635ms)  : 617, 653

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 (8043) - mean (194ms)  : 189, 198
    master - mean (193ms)  : 189, 198

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

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (1,111ms)  : 1071, 1151
    master - mean (1,124ms)  : 1052, 1197

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 (8043) - mean (275ms)  : 270, 281
    master - mean (277ms)  : 271, 283

    section Bailout
    This PR (8043) - mean (276ms)  : 273, 280
    master - mean (279ms)  : 272, 286

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (921ms)  : 870, 973
    master - mean (929ms)  : 888, 970

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

    section Bailout
    This PR (8043) - mean (269ms)  : 265, 274
    master - mean (270ms)  : 267, 273

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (924ms)  : 872, 976
    master - mean (928ms)  : 879, 976

Loading
HttpMessageHandler (.NET 8)
gantt
    title Execution time (ms) HttpMessageHandler (.NET 8)
    dateFormat  x
    axisFormat %Q
    todayMarker off
    section Baseline
    This PR (8043) - mean (269ms)  : 265, 273
    master - mean (270ms)  : 265, 275

    section Bailout
    This PR (8043) - mean (269ms)  : 265, 273
    master - mean (270ms)  : 264, 276

    section CallTarget+Inlining+NGEN
    This PR (8043) - mean (825ms)  : 800, 850
    master - mean (824ms)  : 804, 844

Loading

@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: 45845a104e

ℹ️ 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 33 to +38
var span = tracer.StartSpan(
PlaceholderOperationName,
operationName: InvocationSpanName,
tags: null,
parent: context.SpanContext,
serviceName: PlaceholderServiceName,
addToTraceContext: false);
serviceName: InvocationSpanName,
addToTraceContext: true);

Choose a reason for hiding this comment

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

P2 Badge Preserve sampling metrics if placeholder span is filtered

In LambdaCommon.CreatePlaceholderScope (lines 33–38), the placeholder span is now added to the TraceContext (addToTraceContext: true), which makes it the local root span. As a result, trace-level metrics (e.g., _sampling_priority_v1, _dd.tracer_kr, process_id) get attached to this placeholder (the snapshot update shows they moved off the real spans). If the Lambda extension filters out dd-tracer-serverless-span as intended, the remaining spans will be sent without those trace-level metrics, which can drop sampling priority/keep-rate metadata for the invocation. This manifests when running with an extension that removes the placeholder. Consider copying those metrics to a remaining span (e.g., the aws.lambda span) or avoiding making the placeholder the local root when it will be filtered.

Useful? React with 👍 / 👎.

Copy link
Member

@lucaspimentel lucaspimentel Jan 12, 2026

Choose a reason for hiding this comment

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

This is a good call out, and I believe this is fine as long as the agent (in this case the "Lambda Extension" aka Bottlecap) is handling it correctly.

Copy link
Member

@lucaspimentel lucaspimentel Jan 12, 2026

Choose a reason for hiding this comment

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

We should also consider what happens when using a newer version of the Extension layer with an older version of the tracer layer, and vice-versa. Is this change both backwards- and forwards-compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We previously were not actually copying the .NET tracer tags, since the extension looks for the span resource dd-tracer-serverless-span here which was never being sent, so this fixes that issue.

The extension always filtered that span and I verified that traces look the same as before, so I think it should be good.

// Need to set request_id to copy tracer tags to the aws.lambda span
if (awsRequestId != null)
{
span.SetTag("request_id", awsRequestId);
Copy link
Member

@lucaspimentel lucaspimentel Jan 12, 2026

Choose a reason for hiding this comment

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

request_id is quite ambiguous. Is this the attribute name we're already using elsewhere (in the Extension and other client libraries)? If so, it may be too late to change it.

But we could've used aws.requestid instead which we already use when instrumenting the AWS SDK.

Copy link
Member

@lucaspimentel lucaspimentel Jan 12, 2026

Choose a reason for hiding this comment

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

fwiw, we already send the request id in the http headers we send to the Extension's /lambda/start-invocation and /lambda/end-invocation endpoints. See #7835.

If this has to be in a span attribute for some reason, it seems wasteful to send a whole additional span (dd-tracer-serverless-span) only to carry the request id attribute. Couldn't we add the attribute to the existing lambda.invocation span?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, the Lambda extension looks for the dd-tracer-serverless-span span with the matching request_id field to enrich the new invocation span here. We want to send this span so that we are able to copy the tracer tags, including the Exception replay snapshot identifiers, to the new invocation span.

Copy link
Member

@lucaspimentel lucaspimentel left a comment

Choose a reason for hiding this comment

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

Code LGTM. This "request changed" is just to prevent merging the PR until some questions I have are answered.

@shreyamalpani shreyamalpani merged commit 4e44d73 into master Jan 13, 2026
151 checks passed
@shreyamalpani shreyamalpani deleted the shreya.malpani/add-top-level-span-to-context-lambda branch January 13, 2026 18:49
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 13, 2026
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