package
1.10.3
Repository: https://github.com/caring/go-packages.git
Documentation: pkg.go.dev

# README

Tracing

About

This package contains tooling to configure tracing objects and middleware to be used between services and in tandem with gRPC. This package is a thin wrapper around jaeger tracing go which supports the open tracing standard.

Configuration

Most of the tracing configuration can be done through environment variables. Any values passed into the tracing initialization config object will overwrite environment variables. See the table below for details.

PropertyDescriptionDefault
SERVICE_NAMEThe service name"" Empty String
TRACE_DESTINATION_DNSThe DNS at which the trace collector is located"" Empty String
TRACE_DESTINATION_PORTThe port of the trace collector destination"" Empty String
TRACE_DISABLEBoolean flag to disable trace reporting"TRUE"
TRACE_SAMPLE_RATEThe rate spans are sampled expressed as a float. 0.8 is 80%, 0.9 is 90% etc."0.0"

Usage


config := &Config{
  ServiceName: "myservice",
  Logger: logging.Logger{},
  GlobalTags: map[string]string{
    "my-tag": "my-value",
  },
}

  tracer, err := NewTracer(config)

  defer tracer.Close()

  // To obtain a chain interceptor for you gRPC server...
  tracer.NewGRPCUnaryServerInterceptor()
  // or
  tracer.NewGRPCStreamServerInterceptor()

# Functions

NewTracer configures a jaeger tracing setup wrapped an a Tracer form this package.

# Structs

Config contains initialization config for NewTracer.
Tracer is a service object for accessing and creating tracing utils.