config

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Disabled bool            `yaml:"disabled"`
	Sampler  *SamplerConfig  `yaml:"sampler"`
	Reporter *ReporterConfig `yaml:"reporter"`

	// Logger can be provided to log Reporter errors, as well as to log spans
	// if Reporter.LogSpans is set to true. This cannot be specified in
	// the configuration file, it must be specified in code.
	Logger jaeger.Logger `yaml:"-"`
}

Configuration configures and creates Jaeger Tracer

func (Configuration) InitGlobalTracer

func (c Configuration) InitGlobalTracer(
	serviceName string,
	statsReporter jaeger.StatsReporter,
) (io.Closer, error)

InitGlobalTracer creates a new Jaeger Tracer, and sets is as global OpenTracing Tracer. It returns a closer func that can be used to flush buffers before shutdown.

func (Configuration) New

func (c Configuration) New(
	serviceName string,
	statsReporter jaeger.StatsReporter,
) (opentracing.Tracer, io.Closer, error)

New creates a new Jaeger Tracer, and a closer func that can be used to flush buffers before shutdown.

type ReporterConfig

type ReporterConfig struct {
	// QueueSize controls how many spans the reporter can keep in memory before it starts dropping
	// new spans. The queue is continuously drained by a background go-routine, as fast as spans
	// can be sent out of process.
	QueueSize int `yaml:"queueSize"`

	// BufferFlushInterval controls how often the buffer is force-flushed, even if it's not full.
	// It is generally not useful, as it only matters for very low traffic services.
	BufferFlushInterval time.Duration

	// LogSpans, when true, enables LoggingReporter that runs in parallel with the main reporter
	// and logs all submitted spans. Main Configuration.Logger must be initialized in the code
	// for this option to have any effect.
	LogSpans bool `yaml:"logSpans"`

	// LocalAgentHostPort instructs reporter to send spans to jaeger-agent at this address
	LocalAgentHostPort string `yaml:"localAgentHostPort"`
}

ReporterConfig configures the reporter. All fields are optional.

func (*ReporterConfig) NewReporter

func (rc *ReporterConfig) NewReporter(
	serviceName string,
	metrics *jaeger.Metrics,
	logger jaeger.Logger,
) (jaeger.Reporter, error)

NewReporter instantiates a new reporter that submits spans to tcollector

type SamplerConfig

type SamplerConfig struct {
	// Type specifies the type of the sampler: const, probabilistic, rateLimiting, or remote
	Type string `yaml:"type"`

	// Param is a value passed to the sampler.
	// Valid values for Param field are:
	// - for "const" sampler, 0 or 1 for always false/true respectively
	// - for "probabilistic" sampler, a probability between 0 and 1
	// - for "rateLimiting" sampler, the number of spans per second
	// - for "remote" sampler, param is the same as for "probabilistic"
	//   and indicates the initial sampling rate before the actual one
	//   is received from the mothership
	Param float64 `yaml:"param"`

	// LocalAgentHostPort is the address of jaeger-agent's HTTP server
	LocalAgentHostPort string `yaml:"localAgentHostPort"`
}

SamplerConfig allows initializing a non-default sampler. All fields are optional.

func (*SamplerConfig) NewSampler

func (sc *SamplerConfig) NewSampler(
	serviceName string,
	metrics *jaeger.Metrics,
) (jaeger.Sampler, error)

NewSampler creates a new sampler based on the configuration

Jump to

Keyboard shortcuts

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