Skip to content

Commit

Permalink
simplify creating span context
Browse files Browse the repository at this point in the history
  • Loading branch information
kaibocai committed Jan 4, 2024
1 parent 9fd912b commit d11688c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions task/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package task

import (
"context"
"fmt"

"github.com/microsoft/durabletask-go/internal/helpers"
"github.com/microsoft/durabletask-go/internal/protos"
"go.opentelemetry.io/otel/trace"
"google.golang.org/protobuf/types/known/wrapperspb"
)

Expand Down Expand Up @@ -54,15 +54,15 @@ type activityContext struct {
type Activity func(ctx ActivityContext) (any, error)

func newTaskActivityContext(ctx context.Context, taskID int32, ts *protos.TaskScheduledEvent) *activityContext {
spanContext, err := helpers.SpanContextFromTraceContext(ts.ParentTraceContext)
ctx, err := helpers.ContextFromTraceContext(ctx, ts.ParentTraceContext)
if err != nil {
return nil
fmt.Printf("%v: failed to parse trace context: %v", ts.Name, err)
}
return &activityContext{
TaskID: taskID,
Name: ts.Name,
rawInput: []byte(ts.Input.GetValue()),
ctx: trace.ContextWithRemoteSpanContext(ctx, spanContext),
ctx: ctx,
}
}

Expand Down

0 comments on commit d11688c

Please sign in to comment.