From 382c3b3257ca37ec78adaa982ef8447607752367 Mon Sep 17 00:00:00 2001 From: John Chrostek Date: Wed, 15 Apr 2026 13:15:31 -0400 Subject: [PATCH] fix: disable stats computation to prevent per-invocation latency overhead in Lambda Stats computation was enabled by default in dd-trace-go v2.1.0 (DataDog/dd-trace-go#3548). When extension v91+ advertises /v0.6/stats support in its /info response, tracer.Flush() makes a synchronous HTTP POST to http://127.0.0.1:8126/v0.6/stats before returning, adding 33-59ms per warm invocation. This fix disables stats computation at the tracer level so it is never posted from Lambda, mirroring the identical fix already applied to the dd-trace-go contrib Lambda wrapper in DataDog/dd-trace-go#4471 (APMSVLS-389). Resolves: SLES-2790 --- internal/trace/listener.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/trace/listener.go b/internal/trace/listener.go index 401a931..0fe9b12 100644 --- a/internal/trace/listener.go +++ b/internal/trace/listener.go @@ -81,6 +81,7 @@ func (l *Listener) initTracer() { opts := append([]tracer.StartOption{ tracer.WithService(serviceName), tracer.WithLambdaMode(extensionNotRunning), + tracer.WithStatsComputation(false), // Disabled: stats computation adds an HTTP round-trip to the extension on every flush, causing per-invocation latency overhead in Lambda tracer.WithGlobalTag("_dd.origin", "lambda"), tracer.WithSendRetries(2), }, l.tracerOptions...)