tracing

package
v0.0.0-...-af9c1cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTracedHttpHandler

func NewTracedHttpHandler(h http.Handler, operation string, provider trace.TracerProvider) http.Handler

Types

type Config

type Config struct {
	// Specifies the service name to use on the tracer.
	ServiceName string `json:"service_name" alias:"appName"`

	// Set this to the tracing backend you wish to use.
	// If omitted or empty, tracing will be disabled.
	Provider string `json:"provider" default:"jaeger"`

	// Use synchronous span exporter processor.
	//
	// This is not recommended for production use.
	Sync bool `json:"sync" default:"false"`

	Stdout StdOutConfig `json:"stdout" validate:"dive"`
	OTLP   OTLPConfig   `json:"otlp" validate:"dive"`
	Jaeger JaegerConfig `json:"jaeger" validate:"dive"`
	Zipkin ZipkinConfig `json:"zipkin" validate:"dive"`
}

type JaegerConfig

type JaegerConfig struct {
	AgentHost string `json:"agent_host"`
	AgentPort string `json:"agent_port"`
}

JaegerConfig encapsulates jaeger's configuration.

type OTLPConfig

type OTLPConfig struct {
	Endpoint    string            `json:"endpoint"`
	Insecure    bool              `json:"insecure" default:"true"`
	Headers     map[string]string `json:"headers"`
	Compression string            `json:"compression"`
	Timeout     time.Duration     `json:"timeout"`
	Protocol    string            `json:"protocol" default:"grpc"`
}

OTLPConfig encapsulates OTLP exporter configuration.

type StdOutConfig

type StdOutConfig struct {
	PrettyPrint bool `json:"pretty_print" default:"false"`
	Timestamps  bool `json:"timestamps" default:"true"`
}

StdOutConfig encapsulates STDOUT exporter configuration.

type Tracer

type Tracer struct {
	Config Config
	// contains filtered or unexported fields
}

Tracer encapsulates tracing abilities.

func New

func New(log *zap.SugaredLogger, c Config) (*Tracer, error)

func (*Tracer) IsLoaded

func (t *Tracer) IsLoaded() bool

IsLoaded returns true if the tracer has been loaded.

func (*Tracer) Shutdown

func (t *Tracer) Shutdown(ctx context.Context)

Shutdown stops the Tracer.

func (*Tracer) TracerProvider

func (t *Tracer) TracerProvider() trace.TracerProvider

TracerProvider returns the wrapped tracer.

type ZipkinConfig

type ZipkinConfig struct {
	ServerURL string `json:"server_url"`
}

ZipkinConfig encapsulates zipkin's configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL