tracer

package
v3.65.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 13 Imported by: 5

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.

func WalkConstructors added in v3.43.0

func WalkConstructors(fn func(ConstructorFunc, docs.ComponentSpec))

WalkConstructors iterates each component constructor.

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) Sanitised added in v3.24.0

func (conf Config) Sanitised(removeDeprecated bool) (interface{}, error)

Sanitised returns a sanitised version of the config, meaning sections that aren't relevant to behaviour are removed. Also optionally removes deprecated fields.

func (*Config) UnmarshalYAML

func (conf *Config) UnmarshalYAML(value *yaml.Node) error

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

type ConstructorFunc added in v3.43.0

type ConstructorFunc func(Config, ...func(Type)) (Type, error)

ConstructorFunc is a func signature able to construct a tracer.

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"`
	CollectorURL          string            `json:"collector_url" yaml:"collector_url"`
	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 {
	Status      docs.Status
	Version     string
	Summary     string
	Description string
	Footnotes   string

	FieldSpecs docs.FieldSpecs
	// 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