Documentation
¶
Overview ¶
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 ¶
- func AddGrpcClientOptions(...)
- func AddGrpcServerOptions(...)
- func AnnotateSQL(span Span, sql string)
- func CopySpan(parentCtx, spanCtx context.Context) context.Context
- func LogErrorsWhenClosing(in io.Closer) func()
- func NewContext(parent context.Context, span Span) context.Context
- func StartTracing(serviceName string) io.Closer
- type Span
- type TracerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddGrpcClientOptions ¶ added in v1.7.0
func AddGrpcClientOptions(addInterceptors func(s grpc.StreamClientInterceptor, u grpc.UnaryClientInterceptor))
func AddGrpcServerOptions ¶ added in v1.7.0
func AddGrpcServerOptions(addInterceptors func(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor))
func AnnotateSQL ¶ added in v1.7.0
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 ¶
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 ¶ added in v1.7.0
LogErrorsWhenClosing will close the provided Closer, and log any errors it generates
func NewContext ¶
NewContext returns a context based on parent with a new Span value.
func StartTracing ¶ added in v1.7.0
StartTracing enables tracing for a named service
Types ¶
type Span ¶
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 ¶
FromContext returns the Span from a Context if present. The bool return value indicates whether a Span was present in the Context.