Update vendored dependencies

This includes github.com/kurin/blazer 0.2.0, which resolves #1291
This commit is contained in:
Alexander Neumann
2017-10-01 10:13:39 +02:00
parent ba23d24dd1
commit 61cb1cc6f8
1044 changed files with 203022 additions and 97709 deletions

View File

@@ -29,10 +29,16 @@ const grpcMetadataKey = "grpc-trace-bin"
// GRPCClientInterceptor returns a grpc.UnaryClientInterceptor that traces all outgoing requests from a gRPC client.
// The calling context should already have a *trace.Span; a child span will be
// created for the outgoing gRPC call. If the calling context doesn't have a span,
// the call will not be traced.
// the call will not be traced. If the client is nil, then the interceptor just
// passes through the request.
//
// The functionality in gRPC that this feature relies on is currently experimental.
func (c *Client) GRPCClientInterceptor() grpc.UnaryClientInterceptor {
if c == nil {
return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
return invoker(ctx, method, req, reply, cc, opts...)
}
}
return grpc.UnaryClientInterceptor(c.grpcUnaryInterceptor)
}
@@ -75,8 +81,15 @@ func (c *Client) grpcUnaryInterceptor(ctx context.Context, method string, req, r
//
// span := trace.FromContext(ctx)
//
// If the client is nil, then the interceptor just invokes the handler.
//
// The functionality in gRPC that this feature relies on is currently experimental.
func (c *Client) GRPCServerInterceptor() grpc.UnaryServerInterceptor {
if c == nil {
return func(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
return handler(ctx, req)
}
}
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
md, _ := metadata.FromIncomingContext(ctx)
var traceHeader string

View File

@@ -69,6 +69,9 @@ func (t Transport) base() http.RoundTripper {
//
// The span will be auto finished by the handler.
func (c *Client) HTTPHandler(h http.Handler) http.Handler {
if c == nil {
return h
}
return &handler{traceClient: c, handler: h}
}
@@ -101,5 +104,4 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set(httpHeader, spanHeader(traceID, parentSpanID, span.trace.localOptions))
}
h.handler.ServeHTTP(w, r)
}

View File

@@ -254,7 +254,8 @@ func nextTraceID() string {
return fmt.Sprintf("%016x%016x", id1, id2)
}
// Client is a client for uploading traces to the Google Stackdriver Trace server.
// Client is a client for uploading traces to the Google Stackdriver Trace service.
// A nil Client will no-op for all of its methods.
type Client struct {
service *api.Service
projectID string
@@ -310,13 +311,13 @@ func (c *Client) SetSamplingPolicy(p SamplingPolicy) {
}
}
// SpanFromHeader returns a new trace span, based on a provided request header
// value. See https://cloud.google.com/trace/docs/faq.
//
// It returns nil iff the client is nil.
// SpanFromHeader returns a new trace span based on a provided request header
// value or nil iff the client is nil.
//
// The trace information and identifiers will be read from the header value.
// Otherwise, a new trace ID is made and the parent span ID is zero.
// For the exact format of the header value, see
// https://cloud.google.com/trace/docs/support#how_do_i_force_a_request_to_be_traced
//
// The name of the new span is provided as an argument.
//
@@ -352,9 +353,8 @@ func (c *Client) SpanFromHeader(name string, header string) *Span {
return span
}
// SpanFromRequest returns a new trace span for an HTTP request.
//
// It returns nil iff the client is nil.
// SpanFromRequest returns a new trace span for an HTTP request or nil
// iff the client is nil.
//
// If the incoming HTTP request contains a trace context header, the trace ID,
// parent span ID, and tracing options will be read from that header.
@@ -390,7 +390,8 @@ func (c *Client) SpanFromRequest(r *http.Request) *Span {
return span
}
// NewSpan returns a new trace span with the given name.
// NewSpan returns a new trace span with the given name or nil iff the
// client is nil.
//
// A new trace and span ID is generated to trace the span.
// Returned span need to be finished by calling Finish or FinishWait.