tracer

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tracer contains components able to send opentracing events.

Index

Constants

View Source
const (
	TypeJaeger = "jaeger"
	TypeNone   = "none"
)

String constants representing each tracer type.

Variables

View Source
var Constructors = map[string]TypeSpec{}

Constructors is a map of all tracer types with their specs.

View Source
var (
	ErrInvalidTracerType = errors.New("invalid tracer type")
)

Errors for the tracer package.

Functions

func Descriptions

func Descriptions() string

Descriptions returns a formatted string of collated descriptions of each type.

func SanitiseConfig

func SanitiseConfig(conf Config) (interface{}, error)

SanitiseConfig returns a sanitised version of the Config, meaning sections that aren't relevant to behaviour are removed.

Types

type Config

type Config struct {
	Type   string       `json:"type" yaml:"type"`
	Jaeger JaegerConfig `json:"jaeger" yaml:"jaeger"`
	None   struct{}     `json:"none" yaml:"none"`
}

Config is the all encompassing configuration struct for all tracer types.

func NewConfig

func NewConfig() Config

NewConfig returns a configuration struct fully populated with default values.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(bytes []byte) error

UnmarshalJSON ensures that when parsing configs that are in a map or slice the default values are still applied.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML ensures that when parsing configs that are in a map or slice the default values are still applied.

type Jaeger

type Jaeger struct {
	// contains filtered or unexported fields
}

Jaeger is a tracer with the capability to push spans to a Jaeger instance.

func (*Jaeger) Close

func (j *Jaeger) Close() error

Close stops the tracer.

type JaegerConfig

type JaegerConfig struct {
	AgentAddress          string            `json:"agent_address" yaml:"agent_address"`
	ServiceName           string            `json:"service_name" yaml:"service_name"`
	SamplerType           string            `json:"sampler_type" yaml:"sampler_type"`
	SamplerManagerAddress string            `json:"sampler_manager_address" yaml:"sampler_manager_address"`
	SamplerParam          float64           `json:"sampler_param" yaml:"sampler_param"`
	Tags                  map[string]string `json:"tags" yaml:"tags"`
	FlushInterval         string            `json:"flush_interval" yaml:"flush_interval"`
}

JaegerConfig is config for the Jaeger metrics type.

func NewJaegerConfig

func NewJaegerConfig() JaegerConfig

NewJaegerConfig creates an JaegerConfig struct with default values.

type Type

type Type interface {
	// Close stops and cleans up the tracers resources.
	Close() error
}

Type is an interface implemented by all tracer types.

func New

func New(conf Config, opts ...func(Type)) (Type, error)

New creates a tracer type based on a configuration.

func NewJaeger

func NewJaeger(config Config, opts ...func(Type)) (Type, error)

NewJaeger creates and returns a new Jaeger object.

func NewNone

func NewNone(config Config, opts ...func(Type)) (Type, error)

NewNone creates a noop tracer.

func Noop

func Noop() Type

Noop returns a tracer implementation that does nothing.

type TypeSpec

type TypeSpec struct {
	// contains filtered or unexported fields
}

TypeSpec is a constructor and a usage description for each tracer type.

Jump to

Keyboard shortcuts

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