Skip to content

Commit

Permalink
test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nhulston committed Nov 8, 2024
1 parent e26296e commit b6f241a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ func (em *ExtensionManager) SendEndInvocationRequest(ctx context.Context, functi
if contextKey, ok := ctx.Value("internal.contextKey").(string); ok {
fmt.Printf("[DEBUG lambda]: contextKey%s\n", contextKey)
}
priority := getSamplingPriority(functionExecutionSpan.Context())
fmt.Printf("[DEBUG lambda copied from agent]: priority: %s\n", priority)

Check failure on line 185 in internal/extension/extension.go

View workflow job for this annotation

GitHub Actions / unit-test

fmt.Printf format %s has arg priority of wrong type int

Check failure on line 185 in internal/extension/extension.go

View workflow job for this annotation

GitHub Actions / lint

printf: fmt.Printf format %s has arg priority of wrong type int (govet)
}
fmt.Printf("[DEBUG lambda] full extension.go context: %+v\n", ctx)

Expand All @@ -200,6 +202,21 @@ func (em *ExtensionManager) SendEndInvocationRequest(ctx context.Context, functi
}
}

func getSamplingPriority(sc ddtrace.SpanContext) int {
// Default priority (matching -128 from the agent code)
priority := -128

// Check if the context implements SamplingPriority method
if pc, ok := sc.(interface{ SamplingPriority() (int, bool) }); ok && pc != nil {
if p, ok := pc.SamplingPriority(); ok {
priority = p
fmt.Printf("[DEBUG] [extension.go] Found sampling priority: %d\n", priority)
return priority
}
}
return priority
}

// defaultStackLength specifies the default maximum size of a stack trace.
const defaultStackLength = 32

Expand Down

0 comments on commit b6f241a

Please sign in to comment.