Skip to content

Commit

Permalink
fix: set server span kind on invoke (#286)
Browse files Browse the repository at this point in the history
We currently only handle lambda initialization as a server kind span.
Intercept the lambda invocation and set as server kind too.
  • Loading branch information
jta authored May 31, 2024
1 parent 2af8b24 commit 8a6fcbc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tracing/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ type LambdaHandler struct {
}

func (h *LambdaHandler) Invoke(ctx context.Context, payload []byte) (response []byte, err error) {
cctx, span := h.Tracer.Start(ctx, "Invoke", trace.WithAttributes(
attribute.String("payload", string(payload)),
))
cctx, span := h.Tracer.Start(ctx, "Invoke",
trace.WithAttributes(attribute.String("payload", string(payload))),
trace.WithSpanKind(trace.SpanKindServer),
)
defer func() {
if err != nil {
span.RecordError(err)
Expand Down

0 comments on commit 8a6fcbc

Please sign in to comment.