Documentation
¶
Index ¶
- Constants
- func Run(ctx context.Context)
- func SetupDefaultLogger() error
- func SetupLogger(minLogLvl log.LogLevel, logFilePath string, logsDropInterval time.Duration, ...) error
- func Truncate(s *pb.Span)
- type Agent
- type ProcessedTrace
- type Sampler
- type ServiceMapper
- type ThrottledReceiver
- type TraceServiceExtractor
Constants ¶
const ( // MaxResourceLen the maximum length the resource can have MaxResourceLen = 5000 // 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 ¶
This section is empty.
Functions ¶
func SetupDefaultLogger ¶
func SetupDefaultLogger() error
SetupDefaultLogger sets up a default logger for the agent, showing all log messages and with no throttling.
func SetupLogger ¶
func SetupLogger(minLogLvl log.LogLevel, logFilePath string, logsDropInterval time.Duration, logsDropMaxPerInterval int) error
SetupLogger sets up the agent's logger. We use seelog for logging in the following way:
- Logs with a level under "minLogLvl" are dropped.
- Logs with a level of "trace", "debug" and "info" are always showed if "minLogLvl" is set accordingly. This is for development purposes.
- Logs with a level of "warn" or "error" are dropped after "logsDropMaxPerInterval" number of messages are showed. The counter is reset every "logsDropInterval". If "logsDropInterval" is 0, dropping is disabled (and might flood your logs!).
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
ServiceWriter *writer.ServiceWriter
StatsWriter *writer.StatsWriter
ServiceExtractor *TraceServiceExtractor
ServiceMapper *ServiceMapper
// 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.
type ProcessedTrace ¶
type ProcessedTrace struct {
Trace pb.Trace
WeightedTrace stats.WeightedTrace
Root *pb.Span
Env string
Sublayers stats.SublayerMap
Sampled bool
}
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
type ServiceMapper ¶
type ServiceMapper struct {
// contains filtered or unexported fields
}
ServiceMapper provides a cache layer over model.ServicesMetadata pipeline Used in conjunction with ServiceWriter: in-> ServiceMapper out-> ServiceWriter
func NewServiceMapper ¶
func NewServiceMapper(in <-chan pb.ServicesMetadata, out chan<- pb.ServicesMetadata) *ServiceMapper
NewServiceMapper returns an instance of ServiceMapper with the provided channels
func (*ServiceMapper) Run ¶
func (s *ServiceMapper) Run()
Run triggers the event-loop that consumes model.ServicesMeta
func (*ServiceMapper) Start ¶
func (s *ServiceMapper) Start()
Start runs the event loop in a non-blocking way
func (*ServiceMapper) Stop ¶
func (s *ServiceMapper) Stop()
Stop gracefully terminates the event-loop
type ThrottledReceiver ¶
type ThrottledReceiver struct {
// contains filtered or unexported fields
}
ThrottledReceiver is a custom seelog receiver dropping log messages once the maximum number of log messages per interval have been reached. NOTE: we don't need to protect our log counter with a mutex. Seelog's default logger type is the asynchronous loop logger, implemented as a goroutine processing logs independently from where they were emitted (https://github.com/cihub/seelog/wiki/Logger-types).
func (*ThrottledReceiver) AfterParse ¶
func (r *ThrottledReceiver) AfterParse(args log.CustomReceiverInitArgs) error
AfterParse implements log.CustomReceiver
func (*ThrottledReceiver) Close ¶
func (r *ThrottledReceiver) Close() error
Close implements log.CustomReceiver
func (*ThrottledReceiver) Flush ¶
func (r *ThrottledReceiver) Flush()
Flush implements log.CustomReceiver
func (*ThrottledReceiver) ReceiveMessage ¶
func (r *ThrottledReceiver) ReceiveMessage(msg string, lvl log.LogLevel, _ log.LogContextInterface) error
ReceiveMessage implements log.CustomReceiver
type TraceServiceExtractor ¶
type TraceServiceExtractor struct {
// contains filtered or unexported fields
}
TraceServiceExtractor extracts service metadata from top-level spans
func NewTraceServiceExtractor ¶
func NewTraceServiceExtractor(out chan<- pb.ServicesMetadata) *TraceServiceExtractor
NewTraceServiceExtractor returns a new TraceServiceExtractor
func (*TraceServiceExtractor) Process ¶
func (ts *TraceServiceExtractor) Process(t stats.WeightedTrace)
Process extracts service metadata from top-level spans and sends it downstream