go-vitess.v1: gopkg.in/src-d/go-vitess.v1/trace Index | Files

package trace

import "gopkg.in/src-d/go-vitess.v1/trace"

Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package trace contains a helper interface that allows various tracing tools to be plugged in to components using this interface. If no plugin is registered, the default one makes all trace calls into no-ops.

Index

Package Files

fake.go opentracing.go plugin_jaeger.go trace.go utils.go

func AddGrpcClientOptions Uses

func AddGrpcClientOptions(addInterceptors func(s grpc.StreamClientInterceptor, u grpc.UnaryClientInterceptor))

func AddGrpcServerOptions Uses

func AddGrpcServerOptions(addInterceptors func(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor))

func AnnotateSQL Uses

func AnnotateSQL(span Span, sql string)

AnnotateSQL annotates information about a sql query in the span. This is done in a way so as to not leak personally identifying information (PII), or sensitive personal information (SPI)

func CopySpan Uses

func CopySpan(parentCtx, spanCtx context.Context) context.Context

CopySpan creates a new context from parentCtx, with only the trace span copied over from spanCtx, if it has any. If not, parentCtx is returned.

func LogErrorsWhenClosing Uses

func LogErrorsWhenClosing(in io.Closer) func()

LogErrorsWhenClosing will close the provided Closer, and log any errors it generates

func NewContext Uses

func NewContext(parent context.Context, span Span) context.Context

NewContext returns a context based on parent with a new Span value.

func StartTracing Uses

func StartTracing(serviceName string) io.Closer

StartTracing enables tracing for a named service

type Span Uses

type Span interface {
    Finish()
    // Annotate records a key/value pair associated with a Span. It should be
    // called between Start and Finish.
    Annotate(key string, value interface{})
}

Span represents a unit of work within a trace. After creating a Span with NewSpan(), call one of the Start methods to mark the beginning of the work represented by this Span. Call Finish() when that work is done to record the Span. A Span may be reused by calling Start again.

func FromContext Uses

func FromContext(ctx context.Context) (Span, bool)

FromContext returns the Span from a Context if present. The bool return value indicates whether a Span was present in the Context.

func NewSpan Uses

func NewSpan(inCtx context.Context, label string) (Span, context.Context)

NewSpan creates a new Span with the currently installed tracing plugin. If no tracing plugin is installed, it returns a fake Span that does nothing.

type TracerFactory Uses

type TracerFactory func(serviceName string) (tracingService, io.Closer, error)

Package trace imports 12 packages (graph) and is imported by 20 packages. Updated 2019-06-13. Refresh now. Tools for package owners.