This commit is contained in:
Manfred Touron
2017-05-18 18:54:23 +02:00
parent dc386661ca
commit 5448f25fd6
645 changed files with 55908 additions and 33297 deletions

View File

@@ -1,10 +1,9 @@
package opentracing
import (
"context"
"github.com/opentracing/opentracing-go"
otext "github.com/opentracing/opentracing-go/ext"
"golang.org/x/net/context"
"github.com/go-kit/kit/endpoint"
)

View File

@@ -1,11 +1,11 @@
package opentracing_test
import (
"context"
"testing"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/mocktracer"
"golang.org/x/net/context"
"github.com/go-kit/kit/endpoint"
kitot "github.com/go-kit/kit/tracing/opentracing"

View File

@@ -1,12 +1,12 @@
package opentracing
import (
"context"
"encoding/base64"
"strings"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"golang.org/x/net/context"
"google.golang.org/grpc/metadata"
"github.com/go-kit/kit/log"
@@ -32,10 +32,10 @@ func ToGRPCRequest(tracer opentracing.Tracer, logger log.Logger) func(ctx contex
// `operationName` accordingly. If no trace could be found in `req`, the Span
// will be a trace root. The Span is incorporated in the returned Context and
// can be retrieved with opentracing.SpanFromContext(ctx).
func FromGRPCRequest(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md metadata.MD) context.Context {
return func(ctx context.Context, md metadata.MD) context.Context {
func FromGRPCRequest(tracer opentracing.Tracer, operationName string, logger log.Logger) func(ctx context.Context, md *metadata.MD) context.Context {
return func(ctx context.Context, md *metadata.MD) context.Context {
var span opentracing.Span
wireContext, err := tracer.Extract(opentracing.TextMap, metadataReaderWriter{&md})
wireContext, err := tracer.Extract(opentracing.TextMap, metadataReaderWriter{md})
if err != nil && err != opentracing.ErrSpanContextNotFound {
logger.Log("err", err)
}

View File

@@ -1,11 +1,11 @@
package opentracing_test
import (
"context"
"testing"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/mocktracer"
"golang.org/x/net/context"
"google.golang.org/grpc/metadata"
"github.com/go-kit/kit/log"
@@ -41,7 +41,7 @@ func TestTraceGRPCRequestRoundtrip(t *testing.T) {
// Use FromGRPCRequest to verify that we can join with the trace given MD.
fromGRPCFunc := kitot.FromGRPCRequest(tracer, "joined", logger)
joinCtx := fromGRPCFunc(afterCtx, md)
joinCtx := fromGRPCFunc(afterCtx, &md)
joinedSpan := opentracing.SpanFromContext(joinCtx).(*mocktracer.MockSpan)
joinedContext := joinedSpan.Context().(mocktracer.MockSpanContext)

View File

@@ -1,13 +1,13 @@
package opentracing
import (
"context"
"net"
"net/http"
"strconv"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"golang.org/x/net/context"
"github.com/go-kit/kit/log"
kithttp "github.com/go-kit/kit/transport/http"

View File

@@ -1,7 +1,6 @@
package opentracing_test
import (
"context"
"net/http"
"reflect"
"testing"
@@ -9,6 +8,7 @@ import (
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/opentracing/opentracing-go/mocktracer"
"golang.org/x/net/context"
"github.com/go-kit/kit/log"
kitot "github.com/go-kit/kit/tracing/opentracing"

View File

@@ -155,7 +155,7 @@ func (svc *Service) GetMeSomeExamples(ctx context.Context, ...) ([]Examples, err
// this will label the span's service & hostPort (called Endpoint in Zipkin)
ext.PeerService.Set(span, serviceName)
ext.PeerHostname.Set(span, serviceHost)
ext.PeerHostname,Set(span, serviceHost)
ext.PeerPort.Set(span, servicePort)
// a Tag is the equivalent of a Zipkin Binary Annotation (key:value pair)