Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change span injection/extraction from HTTP request #821

Merged
merged 1 commit into from
Jan 9, 2019
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
6 changes: 3 additions & 3 deletions tracing/opentracing/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"strconv"

"github.com/opentracing/opentracing-go"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"

"github.com/go-kit/kit/log"
Expand Down Expand Up @@ -36,7 +36,7 @@ func ContextToHTTP(tracer opentracing.Tracer, logger log.Logger) kithttp.Request
// There's nothing we can do with any errors here.
if err = tracer.Inject(
span.Context(),
opentracing.TextMap,
opentracing.HTTPHeaders,
opentracing.HTTPHeadersCarrier(req.Header),
); err != nil {
logger.Log("err", err)
Expand All @@ -56,7 +56,7 @@ func HTTPToContext(tracer opentracing.Tracer, operationName string, logger log.L
// Try to join to a trace propagated in `req`.
var span opentracing.Span
wireContext, err := tracer.Extract(
opentracing.TextMap,
opentracing.HTTPHeaders,
opentracing.HTTPHeadersCarrier(req.Header),
)
if err != nil && err != opentracing.ErrSpanContextNotFound {
Expand Down
4 changes: 2 additions & 2 deletions tracing/opentracing/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"
"testing"

"github.com/opentracing/opentracing-go"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/opentracing/opentracing-go/mocktracer"

Expand Down Expand Up @@ -89,7 +89,7 @@ func TestHTTPToContextTags(t *testing.T) {
parentSpan := tracer.StartSpan("to_extract").(*mocktracer.MockSpan)
defer parentSpan.Finish()
req, _ := http.NewRequest("GET", "http://test.biz/path", nil)
tracer.Inject(parentSpan.Context(), opentracing.TextMap, opentracing.HTTPHeadersCarrier(req.Header))
tracer.Inject(parentSpan.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header))

ctx := kitot.HTTPToContext(tracer, "op", log.NewNopLogger())(context.Background(), req)
opentracing.SpanFromContext(ctx).Finish()
Expand Down