Documentation ¶
Overview ¶
Package tracing provides a simple utility for including opentelemetry and zipkin tracing instrumentation in vHive and Knative workloads
Package tracing provides a simple utility for including opentelemetry and zipkin tracing instrumentation in vHive and Knative workloads
Index ¶
- func DialGRPCWithUnaryInterceptor(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func GetGRPCServerWithUnaryInterceptor() *grpc.Server
- func InitBasicTracer(url string, serviceName string) (func(), error)
- func InitCustomTracer(url string, traceRate float64, logger *log.Logger, attr ...attribute.KeyValue) (func(), error)
- func IsTracingEnabled() bool
- type Span
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialGRPCWithUnaryInterceptor ¶
func DialGRPCWithUnaryInterceptor(addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialGRPCWithUnaryInterceptor creates a connection to the provided address, which is instrumented with an opentelemetry client interceptor enabling the tracing to client grpc messages.
func GetGRPCServerWithUnaryInterceptor ¶
GetGRPCServerWithUnaryInterceptor returns a grpc server instrumented with an opentelemetry interceptor which enables tracing of grpc requests.
func InitBasicTracer ¶
InitBasicTracer initialises a basic OpenTelemetry tracer using a zipkin exporter. The exporter sends span and trace information to the provided URL. The tracer uses the name provided, concatenated with the name of the host (e.g., Knative pod name or docker container), and all nodes / functions which use this tracer will be labeled with "-FU" to denote that they are functions, which distinguishes them from knative queue proxies if used in a cluster.
func InitCustomTracer ¶
func InitCustomTracer(url string, traceRate float64, logger *log.Logger, attr ...attribute.KeyValue) (func(), error)
InitCustomTracer initialises an OpenTelemetry tracer. It uses a zipkin exporter which exports to the given URL and logger, and samples traces at the specified traceRate. Any number of additional attributes (attr) can be provided. Note that this tracer uses the default name, which will be the name of the process according to the OS, so to name your tracer provide a "service.name" attribute.
func IsTracingEnabled ¶
func IsTracingEnabled() bool
Types ¶
type Span ¶
type Span struct {
SpanName, TracerName string
// contains filtered or unexported fields
}
Span is an abstraction for making multiple custom OpenTelemetry spans within a single component (e.g., within processing a single request by a server). Spans can be used to indicate what a process is working on as time progresses, and can be given a name to distinguish them. Spans are used in a hierarchy, whereby one "parent" span can have many "child" spans, and typially the parent span will be "running" for the duration of all its children spans (or potentially longer). This hierarchy is visible within zipkin.
func (*Span) EndSpan ¶
func (s *Span) EndSpan()
EndSpan marks the span as finished at the time when this function is called.
func (*Span) StartSpan ¶
StartSpan starts the span. A context, ctx, is used here to determine any parent spans, IDs, etc. A context is also returned, and it should be given as input to other spans if they should be marked as the chidlren of this span. This is how a parent / child hierarchy can be built between multiple spans in your functions.