Documentation
¶
Overview ¶
Package agent implements the trace-agent.
Index ¶
- Constants
- Variables
- func ObfuscateRedisSpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
- func ObfuscateSQLSpan(o *obfuscate.Obfuscator, span *pb.Span) (*obfuscate.ObfuscatedQuery, error)
- func ObfuscateValkeySpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
- type Agent
- func (a *Agent) FlushSync()
- func (a *Agent) Process(p *api.Payload)
- func (a *Agent) ProcessStats(ctx context.Context, in *pb.ClientStatsPayload, ...) error
- func (a *Agent) ProcessV1(p *api.PayloadV1)
- func (a *Agent) Run()
- func (a *Agent) SetGlobalTagsUnsafe(tags map[string]string)
- func (a *Agent) Truncate(s *pb.Span)
- func (a *Agent) TruncateResource(r string) (string, bool)
- func (a *Agent) TruncateV1(s *idx.InternalSpan)
- func (a *Agent) UpdateAPIKey(oldKey, newKey string)
- type Concentrator
- type SpanModifier
- type TraceWriter
- type TraceWriterV1
- type TracerPayloadModifier
- type Writer
Constants ¶
const ( // MaxMetaKeyLen the maximum length of metadata key MaxMetaKeyLen = 200 // MaxMetaValLen the maximum length of metadata value MaxMetaValLen = 25_000 // MaxMetricsKeyLen the maximum length of a metric name key MaxMetricsKeyLen = MaxMetaKeyLen )
const (
// MaxTypeLen the maximum length a span type can have
MaxTypeLen = 100
)
Variables ¶
Functions ¶
func ObfuscateRedisSpan ¶ added in v0.73.0
func ObfuscateRedisSpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
ObfuscateRedisSpan obfuscates a Redis span
func ObfuscateSQLSpan ¶ added in v0.73.0
func ObfuscateSQLSpan(o *obfuscate.Obfuscator, span *pb.Span) (*obfuscate.ObfuscatedQuery, error)
ObfuscateSQLSpan obfuscates a SQL span
func ObfuscateValkeySpan ¶ added in v0.73.0
func ObfuscateValkeySpan(o *obfuscate.Obfuscator, span *pb.Span, removeAllArgs bool)
ObfuscateValkeySpan obfuscates a Valkey span
Types ¶
type Agent ¶
type Agent struct {
Receiver *api.HTTPReceiver
OTLPReceiver *api.OTLPReceiver
Concentrator 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
SamplerMetrics *sampler.Metrics
EventProcessor *event.Processor
TraceWriter TraceWriter
TraceWriterV1 TraceWriterV1
StatsWriter *writer.DatadogStatsWriter
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
// SpanModifier 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 SpanModifier calls.
SpanModifier SpanModifier
// TracerPayloadModifier will be called on all tracer payloads early on in
// their processing. In particular this happens before trace chunks are
// meaningfully filtered or modified.
TracerPayloadModifier TracerPayloadModifier
// In takes incoming payloads to be processed by the agent.
In chan *api.Payload
// InV1 takes incoming V1 payloads to be processed by the agent.
InV1 chan *api.PayloadV1
// 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, comp compression.Component) *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 synchronously. This method only works when the agent is configured in synchronous flushing mode via the apm_config.sync_flush option.
func (*Agent) Process ¶
Process is the default work unit that receives a trace, transforms it and passes it downstream.
func (*Agent) ProcessStats ¶
func (a *Agent) ProcessStats(ctx context.Context, in *pb.ClientStatsPayload, lang, tracerVersion, containerID, obfuscationVersion string) error
ProcessStats processes incoming client stats in from the given tracer.
func (*Agent) ProcessV1 ¶ added in v0.73.0
ProcessV1 is the default work unit for a V1 payload 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.
func (*Agent) SetGlobalTagsUnsafe ¶
SetGlobalTagsUnsafe sets global tags to the agent configuration. Unsafe for concurrent use.
func (*Agent) Truncate ¶ added in v0.44.0
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
TruncateResource truncates a span's resource to the maximum allowed length. It returns true if the input was below the max size.
func (*Agent) TruncateV1 ¶ added in v0.73.0
func (a *Agent) TruncateV1(s *idx.InternalSpan)
TruncateV1 checks that the span resource, meta and metrics are within the max length and modifies them if they are not
func (*Agent) UpdateAPIKey ¶ added in v0.59.0
UpdateAPIKey receives the API Key update signal and propagates it across all internal components that rely on API Key configuration: - HTTP Receiver (used in reverse proxies) - Trace Writer senders - Stats Writer senders
type Concentrator ¶ added in v0.56.0
type Concentrator interface {
// Start starts the Concentrator
Start()
// Stop stops the Concentrator and attempts to flush whatever is left in the buffers
Stop()
// Add a stats Input to be concentrated and flushed. After this function returns it is safe to modify the input but those changes will not be in the stats.
Add(t stats.Input)
// AddV1 a stats InputV1 to be concentrated and flushed. After this function returns it is safe to modify the input but those changes will not be reflected in the stats.
AddV1(t stats.InputV1)
}
Concentrator accepts stats input, 'concentrating' them together into buckets before flushing them
type SpanModifier ¶ added in v0.57.0
type SpanModifier interface {
ModifySpan(*pb.TraceChunk, *pb.Span)
}
SpanModifier is an interface that allows to modify spans while they are processed by the agent.
type TraceWriter ¶ added in v0.56.0
type TraceWriter interface {
Writer
// WriteChunks to be written
WriteChunks(pkg *writer.SampledChunks)
}
TraceWriter provides a way to write trace chunks
type TraceWriterV1 ¶ added in v0.73.0
type TraceWriterV1 interface {
Writer
WriteChunksV1(pkg *writer.SampledChunksV1)
}
TraceWriterV1 provides a way to write v1 trace chunks
type TracerPayloadModifier ¶ added in v0.69.0
type TracerPayloadModifier = payload.TracerPayloadModifier
TracerPayloadModifier is an interface that allows tracer implementations to modify a TracerPayload as it is processed in the Agent's Process method.
type Writer ¶ added in v0.73.0
type Writer interface {
// Stop stops the Writer and attempts to flush whatever is left in the senders buffers.
Stop()
// FlushSync blocks and sends pending payloads when syncMode is true
FlushSync() error
// UpdateAPIKey signals the Writer to update the API Keys stored in its senders config.
UpdateAPIKey(oldKey, newKey string)
}
Writer is an interface that provides the base functionality of a writing component Concrete implementations will generally use the TraceWriter, or TraceWriterV1 interface