From a7573a439bfea38065385ce0c62abf441734d0a4 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Tue, 17 Dec 2024 14:04:44 -0500 Subject: [PATCH] move constants to span_pointers.go --- pkg/serverless/invocationlifecycle/trace.go | 9 ++++----- pkg/serverless/spanpointers/span_pointers.go | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/serverless/invocationlifecycle/trace.go b/pkg/serverless/invocationlifecycle/trace.go index 5e3e1b03fc54a..121630a60a637 100644 --- a/pkg/serverless/invocationlifecycle/trace.go +++ b/pkg/serverless/invocationlifecycle/trace.go @@ -8,6 +8,7 @@ package invocationlifecycle import ( "bytes" "fmt" + "github.com/DataDog/datadog-agent/pkg/serverless/spanpointers" "net/http" "os" "regexp" @@ -28,9 +29,7 @@ import ( ) const ( - functionNameEnvVar = "AWS_LAMBDA_FUNCTION_NAME" - spanPointerLinkKind = "span-pointer" - spanPointerUpDirection = "u" // Tracers will handle cases where direction is down + functionNameEnvVar = "AWS_LAMBDA_FUNCTION_NAME" ) var /* const */ runtimeRegex = regexp.MustCompile(`^(dotnet|go|java|ruby)(\d+(\.\d+)*|\d+(\.x))$`) @@ -169,8 +168,8 @@ func (lp *LifecycleProcessor) endExecutionSpan(endDetails *InvocationEndDetails) for _, sp := range lp.requestHandler.spanPointers { spanLink := map[string]interface{}{ "attributes": map[string]string{ - "link.kind": spanPointerLinkKind, - "ptr.dir": spanPointerUpDirection, + "link.kind": spanpointers.SpanPointerLinkKind, + "ptr.dir": spanpointers.SpanPointerUpDirection, "ptr.hash": sp.Hash, "ptr.kind": sp.Kind, }, diff --git a/pkg/serverless/spanpointers/span_pointers.go b/pkg/serverless/spanpointers/span_pointers.go index f342bfad3d2fb..93a7f98803b29 100644 --- a/pkg/serverless/spanpointers/span_pointers.go +++ b/pkg/serverless/spanpointers/span_pointers.go @@ -14,7 +14,9 @@ import ( ) const ( - s3PointerKind = "aws.s3.object" + s3PointerKind = "aws.s3.object" + SpanPointerLinkKind = "span-pointer" + SpanPointerUpDirection = "u" // Tracers will handle cases where direction is down ) // SpanPointer is a struct that stores a hash and span kind to uniquely