Skip to content

Commit

Permalink
Move trace logic to separate package
Browse files Browse the repository at this point in the history
  • Loading branch information
DarcyRaynerDD committed May 21, 2019
1 parent 1233c3c commit 29f5da6
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions ddlambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"

"github.com/DataDog/dd-lambda-go/internal"
"github.com/DataDog/dd-lambda-go/internal/trace"
)

type (
Expand All @@ -15,17 +15,17 @@ type (
// It returns a modified handler that can be passed directly to the lambda.Start function.
func WrapHandler(handler interface{}) interface{} {
hl := handlerListener{}
return internal.WrapHandlerWithListener(handler, &hl)
return trace.WrapHandlerWithListener(handler, &hl)
}

// GetTraceHeaders reads a map containing the DataDog trace headers from a context object.
func GetTraceHeaders(ctx context.Context) map[string]string {
result := internal.GetTraceHeaders(ctx, true)
result := trace.GetTraceHeaders(ctx, true)
return result
}

func (hl *handlerListener) HandlerStarted(ctx context.Context, msg json.RawMessage) context.Context {
ctx, _ = internal.ExtractTraceContext(ctx, msg)
ctx, _ = trace.ExtractTraceContext(ctx, msg)
return ctx
}

Expand Down
2 changes: 1 addition & 1 deletion internal/constants.go → internal/trace/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package trace

const (
traceIDHeader = "x-datadog-trace-id"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package trace

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package trace

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package trace

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package trace

import (
"context"
Expand Down

0 comments on commit 29f5da6

Please sign in to comment.