Skip to content

[BUG]: dd-trace-go/v2 internal/telemetry when used in AWS Lambda environment posts repeatedly to non-exist agent sidecar #3808

@magnetikonline

Description

@magnetikonline

Tracer Version(s)

v2.1.0

Go Version(s)

go version go1.24.5 darwin/arm64

Bug Report

Hello team,

we've noted that since upgrading to dd-trace-go/v2 within our AWS Lambda functions, we're now getting a flood of log lines in the following form:

2025/07/25 01:04:59 Datadog Tracer v1.74.3 WARN: appsec: error while flushing SCA Security Data: Post "http://localhost:8126/telemetry/proxy/api/v2/apmtelemetry": dial tcp 127.0.0.1:8126: connect: connection refused

Digging into the code, it seems the internal/telemetry package, via the ddtrace/tracer package is setting up this telemetry client (via a startTelemetry() function) that's posting/flushing data to an endpoint of /telemetry/proxy/api/v2/apmtelemetry every 60 seconds at 127.0.0.1:8126.

It seems we could disable this regression by setting a DD_INSTRUMENTATION_TELEMETRY_ENABLED environment variable in our Lambda functions - but ideally it would be good if the internal/telemetry package and it's func Disabled() bool function could determine if we're running as a Lambda function (e.g. check for existence of the AWS_LAMBDA_FUNCTION_NAME env var) and silently disable the telemetry gathering.

Thansks.

Reproduction Code

No response

Error Logs

2025/07/25 01:04:59 Datadog Tracer v1.74.3 WARN: appsec: error while flushing SCA Security Data: Post "http://localhost:8126/telemetry/proxy/api/v2/apmtelemetry": dial tcp 127.0.0.1:8126: connect: connection refused

Go Env Output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunintended behavior that has to be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions