agent

package
v0.0.0-...-dca2ff9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxMetaKeyLen the maximum length of metadata key
	MaxMetaKeyLen = 100
	// MaxMetaValLen the maximum length of metadata value
	MaxMetaValLen = 5000
	// MaxMetricsKeyLen the maximum length of a metric name key
	MaxMetricsKeyLen = MaxMetaKeyLen
)

Variables

View Source
var MaxResourceLen = 5000

MaxResourceLen the maximum length the resource can have

Functions

func Run

func Run(ctx context.Context)

Run is the entrypoint of our code, which starts the agent.

func Truncate

func Truncate(s *pb.Span)

Truncate checks that the span resource, meta and metrics are within the max length and modifies them if they are not

Types

type Agent

type Agent struct {
	Receiver           *api.HTTPReceiver
	Concentrator       *stats.Concentrator
	Blacklister        *filters.Blacklister
	Replacer           *filters.Replacer
	ScoreSampler       *Sampler
	ErrorsScoreSampler *Sampler
	PrioritySampler    *Sampler
	EventProcessor     *event.Processor
	TraceWriter        *writer.TraceWriter
	StatsWriter        *writer.StatsWriter

	In  chan *api.Trace
	Out chan *writer.SampledSpans
	// contains filtered or unexported fields
}

Agent struct holds all the sub-routines structs and make the data flow between them

func NewAgent

func NewAgent(ctx context.Context, conf *config.AgentConfig) *Agent

NewAgent returns a new Agent object, ready to be started. It takes a context which may be cancelled in order to gracefully stop the agent.

func (*Agent) Process

func (a *Agent) Process(t *api.Trace)

Process is the default work unit that receives a trace, transforms it and passes it downstream.

func (*Agent) Run

func (a *Agent) Run()

Run starts routers routines and individual pieces then stop them when the exit order is received

type ProcessedTrace

type ProcessedTrace struct {
	Trace         pb.Trace
	WeightedTrace stats.WeightedTrace
	Root          *pb.Span
	Env           string
	Sublayers     stats.SublayerMap
}

ProcessedTrace represents a trace being processed in the agent.

func (*ProcessedTrace) GetSamplingPriority

func (pt *ProcessedTrace) GetSamplingPriority() (sampler.SamplingPriority, bool)

GetSamplingPriority returns the sampling priority of the root span.

func (*ProcessedTrace) Weight

func (pt *ProcessedTrace) Weight() float64

Weight returns the weight at the root span.

type Sampler

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

Sampler chooses which spans to write to the API

func NewErrorsSampler

func NewErrorsSampler(conf *config.AgentConfig) *Sampler

NewErrorsSampler creates a new sampler dedicated to traces containing errors to isolate them from the global max tps. It behaves exactly like the normal ScoreSampler except that its statistics are reported under a different name.

func NewPrioritySampler

func NewPrioritySampler(conf *config.AgentConfig, dynConf *sampler.DynamicConfig) *Sampler

NewPrioritySampler creates a new empty distributed sampler ready to be started

func NewScoreSampler

func NewScoreSampler(conf *config.AgentConfig) *Sampler

NewScoreSampler creates a new empty sampler ready to be started

func (*Sampler) Add

func (s *Sampler) Add(t ProcessedTrace) (sampled bool, rate float64)

Add samples a trace and returns true if trace was sampled (should be kept), false otherwise

func (*Sampler) Start

func (s *Sampler) Start()

Start starts sampling traces

func (*Sampler) Stop

func (s *Sampler) Stop()

Stop stops the sampler

Jump to

Keyboard shortcuts

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