Skip to content

Commit

Permalink
Send error message along with error flag (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsabados authored Mar 6, 2024
1 parent c3fb2ee commit 8470f40
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ import (
type ddTraceContext string

const (
DdTraceId ddTraceContext = "x-datadog-trace-id"
DdParentId ddTraceContext = "x-datadog-parent-id"
DdSpanId ddTraceContext = "x-datadog-span-id"
DdSamplingPriority ddTraceContext = "x-datadog-sampling-priority"
DdInvocationError ddTraceContext = "x-datadog-invocation-error"
DdTraceId ddTraceContext = "x-datadog-trace-id"
DdParentId ddTraceContext = "x-datadog-parent-id"
DdSpanId ddTraceContext = "x-datadog-span-id"
DdSamplingPriority ddTraceContext = "x-datadog-sampling-priority"
DdInvocationError ddTraceContext = "x-datadog-invocation-error"
DdInvocationErrorMsg ddTraceContext = "x-datadog-invocation-error-msg"

DdSeverlessSpan ddTraceContext = "dd-tracer-serverless-span"
DdLambdaResponse ddTraceContext = "dd-response"
Expand Down Expand Up @@ -137,6 +138,7 @@ func (em *ExtensionManager) SendEndInvocationRequest(ctx context.Context, functi
// Mark the invocation as an error if any
if err != nil {
req.Header.Set(string(DdInvocationError), "true")
req.Header.Set(string(DdInvocationErrorMsg), err.Error())
}

// Extract the DD trace context and pass them to the extension via request headers
Expand Down

0 comments on commit 8470f40

Please sign in to comment.