Skip to content

Commit

Permalink
added span kind tag in aws sdk v2 instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Angith committed Mar 26, 2024
1 parent 6499dc0 commit f7239bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions instrumentation/instaawsv2/lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/lambda/types"
instana "github.com/instana/go-sensor"
ot "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/pkg/errors"
)
Expand All @@ -27,8 +28,9 @@ var _ AWSOperations = (*AWSInvokeLambdaOperations)(nil)
func (o AWSInvokeLambdaOperations) injectContextWithSpan(tr instana.TracerLogger, ctx context.Context, params interface{}) context.Context {
// An exit span will be created independently without a parent span
// and sent if the user has opted in.
// TODO: check what is the type of span for lambda and add it in options
opts := []ot.StartSpanOption{}
opts := []ot.StartSpanOption{
ot.Tag{Key: string(ext.SpanKind), Value: "exit"},
}
parent, ok := instana.SpanFromContext(ctx)
if ok {
opts = append(opts, ot.ChildOf(parent.Context()))
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/instaawsv2/lambda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestInvokeLambdaNoParentSpan(t *testing.T) {
assert.NoError(t, err, "Error while invoking the lambda")

recorderSpans := recorder.GetQueuedSpans()
assert.Equal(t, 1, len(recorderSpans))
assert.Equal(t, 0, len(recorderSpans))
}

func TestInvokeLambdaWithClientContext(t *testing.T) {
Expand Down

0 comments on commit f7239bf

Please sign in to comment.