Skip to content

Commit

Permalink
default to aws.lambda if DD_SERVICE isn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
piochelepiotr committed Jan 25, 2024
1 parent 1643835 commit ddfd86f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/trace/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"context"
"encoding/json"
"fmt"
"os"
"strings"

"github.com/DataDog/datadog-lambda-go/internal/extension"
Expand Down Expand Up @@ -71,7 +72,12 @@ func (l *Listener) HandlerStarted(ctx context.Context, msg json.RawMessage) cont
ctx, _ = contextWithRootTraceContext(ctx, msg, l.mergeXrayTraces, l.traceContextExtractor)

if !tracerInitialized {
serviceName := os.Getenv("DD_SERVICE")
if serviceName == "" {
serviceName = "aws.lambda"
}
tracer.Start(
tracer.WithService(serviceName),
tracer.WithLambdaMode(!l.extensionManager.IsExtensionRunning()),
tracer.WithGlobalTag("_dd.origin", "lambda"),
tracer.WithSendRetries(2),
Expand Down

0 comments on commit ddfd86f

Please sign in to comment.