Help us shape the future of Go! Take the 2026 Go Developer Survey

agent

package
v0.55.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 26 Imported by: 7

Documentation

Overview

Package agent implements the trace-agent.

Index

Constants

View Source
const (
	// MaxMetaKeyLen the maximum length of metadata key
	MaxMetaKeyLen = 200
	// MaxMetaValLen the maximum length of metadata value
	MaxMetaValLen = 25000
	// MaxMetricsKeyLen the maximum length of a metric name key
	MaxMetricsKeyLen = MaxMetaKeyLen
)
View Source
const (
	// MaxTypeLen the maximum length a span type can have
	MaxTypeLen = 100
)

Variables

View Source
var (
	// Year2000NanosecTS is an arbitrary cutoff to spot weird-looking values
	Year2000NanosecTS = time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC).UnixNano()
)

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Receiver              *api.HTTPReceiver
	OTLPReceiver          *api.OTLPReceiver
	Concentrator          *stats.Concentrator
	ClientStatsAggregator *stats.ClientStatsAggregator
	Blacklister           *filters.Blacklister
	Replacer              *filters.Replacer
	PrioritySampler       *sampler.PrioritySampler
	ErrorsSampler         *sampler.ErrorsSampler
	RareSampler           *sampler.RareSampler
	NoPrioritySampler     *sampler.NoPrioritySampler
	ProbabilisticSampler  *sampler.ProbabilisticSampler
	EventProcessor        *event.Processor
	TraceWriter           *writer.TraceWriter
	StatsWriter           *writer.StatsWriter
	RemoteConfigHandler   *remoteconfighandler.RemoteConfigHandler
	TelemetryCollector    telemetry.TelemetryCollector
	DebugServer           *api.DebugServer
	Statsd                statsd.ClientInterface
	Timing                timing.Reporter

	// DiscardSpan will be called on all spans, if non-nil. If it returns true, the span will be deleted before processing.
	DiscardSpan func(*pb.Span) bool

	// ModifySpan will be called on all non-nil spans of received trace chunks.
	// Note that any modification of the trace chunk could be overwritten by subsequent ModifySpan calls.
	ModifySpan func(*pb.TraceChunk, *pb.Span)

	// In takes incoming payloads to be processed by the agent.
	In chan *api.Payload
	// 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, telemetryCollector telemetry.TelemetryCollector, statsd statsd.ClientInterface) *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) FlushSync

func (a *Agent) FlushSync()

FlushSync flushes traces sychronously. This method only works when the agent is configured in synchronous flushing mode via the apm_config.sync_flush option.

func (*Agent) Process

func (a *Agent) Process(p *api.Payload)

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

func (*Agent) ProcessStats

func (a *Agent) ProcessStats(in *pb.ClientStatsPayload, lang, tracerVersion string)

ProcessStats processes incoming client stats in from the given tracer.

func (*Agent) Run

func (a *Agent) Run()

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

func (*Agent) SetGlobalTagsUnsafe

func (a *Agent) SetGlobalTagsUnsafe(tags map[string]string)

SetGlobalTagsUnsafe sets global tags to the agent configuration. Unsafe for concurrent use.

func (*Agent) Truncate added in v0.44.0

func (a *Agent) 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

func (*Agent) TruncateResource added in v0.44.0

func (a *Agent) TruncateResource(r string) (string, bool)

TruncateResource truncates a span's resource to the maximum allowed length. It returns true if the input was below the max size.

Jump to

Keyboard shortcuts

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