Documentation ¶
Index ¶
- Constants
- Variables
- type Collector
- type InMemCollector
- func (i *InMemCollector) AddSpan(sp *types.Span) error
- func (i *InMemCollector) AddSpanFromPeer(sp *types.Span) error
- func (i *InMemCollector) GetStressedSampleRate(traceID string) (rate uint, keep bool, reason string)
- func (i *InMemCollector) ProcessSpanImmediately(sp *types.Span, keep bool, sampleRate uint, reason string)
- func (i *InMemCollector) Start() error
- func (i *InMemCollector) Stop() error
- func (i *InMemCollector) Stressed() bool
- type MockStressReliever
- func (m *MockStressReliever) GetSampleRate(traceID string) (rate uint, keep bool, reason string)
- func (m *MockStressReliever) Recalc()
- func (m *MockStressReliever) Start() error
- func (m *MockStressReliever) StressLevel() uint
- func (m *MockStressReliever) Stressed() bool
- func (m *MockStressReliever) UpdateFromConfig(cfg config.StressReliefConfig) error
- type StressRelief
- func (s *StressRelief) GetSampleRate(traceID string) (rate uint, keep bool, reason string)
- func (s *StressRelief) Recalc()
- func (s *StressRelief) Start() error
- func (s *StressRelief) StressLevel() uint
- func (s *StressRelief) Stressed() bool
- func (s *StressRelief) UpdateFromConfig(cfg config.StressReliefConfig) error
- type StressReliefCalculation
- type StressReliefMode
- type StressReliever
Constants ¶
const ( TraceSendGotRoot = "trace_send_got_root" TraceSendExpired = "trace_send_expired" TraceSendEjectedFull = "trace_send_ejected_full" TraceSendEjectedMemsize = "trace_send_ejected_memsize" )
These are the names of the metrics we use to track our send decisions.
Variables ¶
var ErrWouldBlock = errors.New("not adding span, channel buffer is full")
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector interface { // AddSpan adds a span to be collected, buffered, and merged into a trace. // Once the trace is "complete", it'll be passed off to the sampler then // scheduled for transmission. AddSpan(*types.Span) error AddSpanFromPeer(*types.Span) error Stressed() bool GetStressedSampleRate(traceID string) (rate uint, keep bool, reason string) ProcessSpanImmediately(sp *types.Span, keep bool, sampleRate uint, reason string) }
type InMemCollector ¶
type InMemCollector struct { Config config.Config `inject:""` Logger logger.Logger `inject:""` Transmission transmit.Transmission `inject:"upstreamTransmission"` Metrics metrics.Metrics `inject:"genericMetrics"` SamplerFactory *sample.SamplerFactory `inject:""` StressRelief StressReliever `inject:"stressRelief"` // For test use only BlockOnAddSpan bool // contains filtered or unexported fields }
InMemCollector is a single threaded collector.
func (*InMemCollector) AddSpan ¶
func (i *InMemCollector) AddSpan(sp *types.Span) error
AddSpan accepts the incoming span to a queue and returns immediately
func (*InMemCollector) AddSpanFromPeer ¶
func (i *InMemCollector) AddSpanFromPeer(sp *types.Span) error
AddSpan accepts the incoming span to a queue and returns immediately
func (*InMemCollector) GetStressedSampleRate ¶ added in v1.20.0
func (i *InMemCollector) GetStressedSampleRate(traceID string) (rate uint, keep bool, reason string)
func (*InMemCollector) ProcessSpanImmediately ¶ added in v1.20.0
func (i *InMemCollector) ProcessSpanImmediately(sp *types.Span, keep bool, sampleRate uint, reason string)
ProcessSpanImmediately is an escape hatch used under stressful conditions -- it submits a span for immediate transmission without enqueuing it for normal processing. This means it ignores dry run mode and doesn't build a complete trace context or cache the trace in the active trace buffer. It only gets called on the first span for a trace under stressful conditions; we got here because the StressRelief system detected that this is a new trace AND that it is being sampled. Therefore, we also put the traceID into the sent traces cache as "kept". It doesn't do any logging and barely touches metrics; this is about as minimal as we can make it.
func (*InMemCollector) Start ¶
func (i *InMemCollector) Start() error
func (*InMemCollector) Stop ¶
func (i *InMemCollector) Stop() error
func (*InMemCollector) Stressed ¶ added in v1.20.0
func (i *InMemCollector) Stressed() bool
Stressed returns true if the collector is undergoing significant stress
type MockStressReliever ¶ added in v1.20.0
type MockStressReliever struct{}
func (*MockStressReliever) GetSampleRate ¶ added in v1.20.0
func (m *MockStressReliever) GetSampleRate(traceID string) (rate uint, keep bool, reason string)
func (*MockStressReliever) Recalc ¶ added in v1.20.0
func (m *MockStressReliever) Recalc()
func (*MockStressReliever) Start ¶ added in v1.20.0
func (m *MockStressReliever) Start() error
func (*MockStressReliever) StressLevel ¶ added in v1.20.0
func (m *MockStressReliever) StressLevel() uint
func (*MockStressReliever) Stressed ¶ added in v1.20.0
func (m *MockStressReliever) Stressed() bool
func (*MockStressReliever) UpdateFromConfig ¶ added in v1.20.0
func (m *MockStressReliever) UpdateFromConfig(cfg config.StressReliefConfig) error
type StressRelief ¶ added in v1.20.0
type StressRelief struct { RefineryMetrics metrics.Metrics `inject:"metrics"` Logger logger.Logger `inject:""` Done chan struct{} // contains filtered or unexported fields }
func (*StressRelief) GetSampleRate ¶ added in v1.20.0
func (s *StressRelief) GetSampleRate(traceID string) (rate uint, keep bool, reason string)
func (*StressRelief) Recalc ¶ added in v1.20.0
func (s *StressRelief) Recalc()
We want to calculate the stress from various values around the system. Each key value can be reported as a key-value. This should be called periodically.
func (*StressRelief) Start ¶ added in v1.20.0
func (s *StressRelief) Start() error
func (*StressRelief) StressLevel ¶ added in v1.20.0
func (s *StressRelief) StressLevel() uint
func (*StressRelief) Stressed ¶ added in v1.20.0
func (s *StressRelief) Stressed() bool
Stressed() indicates whether the system should act as if it's stressed. Note that the stress_level metric is independent of mode.
func (*StressRelief) UpdateFromConfig ¶ added in v1.20.0
func (s *StressRelief) UpdateFromConfig(cfg config.StressReliefConfig) error
type StressReliefCalculation ¶ added in v1.20.0
type StressReliefMode ¶ added in v1.20.0
type StressReliefMode int
const ( Never StressReliefMode = iota Monitor Always )