Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions internal/slackcontext/slackcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,6 @@ const (
contextKeyVersion
)

// OpenTracingSpan returns the `opentracing.Span“ associated with `ctx`, or
// `nil` and `slackerror.ErrContextValueNotFound` if no `Span` could be found.
func OpenTracingSpan(ctx context.Context) (opentracing.Span, error) {
span := opentracing.SpanFromContext(ctx)
if span == nil {
return nil, slackerror.New(slackerror.ErrContextValueNotFound).
WithMessage("The value for OpenTracing Span could not be found")
}
return span, nil
}

// SetOpenTracingSpan returns a new `context.Context` that holds a reference to
// the span. If span is nil, a new context without an active span is returned.
func SetOpenTracingSpan(ctx context.Context, span opentracing.Span) context.Context {
Expand Down
25 changes: 0 additions & 25 deletions internal/slackcontext/slackcontext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,6 @@ import (
"github.com/stretchr/testify/require"
)

func Test_SlackContext_OpenTracingSpan(t *testing.T) {
tests := map[string]struct {
expectedSpan opentracing.Span
expectedError error
}{
"returns span when span exists": {
expectedSpan: opentracing.StartSpan("test.span"),
expectedError: nil,
},
"returns error when span not found": {
expectedSpan: nil,
expectedError: slackerror.New(slackerror.ErrContextValueNotFound).WithMessage("The value for OpenTracing Span could not be found"),
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
ctx := t.Context()
ctx = opentracing.ContextWithSpan(ctx, tc.expectedSpan)
actualSpan, actualError := OpenTracingSpan(ctx)
require.Equal(t, tc.expectedSpan, actualSpan)
require.Equal(t, tc.expectedError, actualError)
})
}
}

func Test_SlackContext_SetOpenTracingSpan(t *testing.T) {
tests := map[string]struct {
expectedSpan opentracing.Span
Expand Down
Loading