Documentation
¶
Overview ¶
Package processor provides log message processing functionality
Index ¶
Constants ¶
const ( // UnstructuredProcessingMetricName collects how many rules are used on unstructured // content for tailers capable of processing both unstructured and structured content. UnstructuredProcessingMetricName = "datadog.logs_agent.tailer.unstructured_processing" )
Variables ¶
var JSONPayload = jsonPayload{}
JSONPayload is a shared JSON representation of a message
Functions ¶
func ResolveSourceTagFilter ¶ added in v0.86.0
ResolveSourceTagFilter compiles and caches a source's effective filter. It is idempotent and safe for concurrent calls.
func SetServerlessInitTagCache ¶ added in v0.84.0
func SetServerlessInitTagCache(tags []string)
SetServerlessInitTagCache pre-populates the JSONServerlessInitEncoder's cache with the provided tags. This must be called (instead of clearing the cache) whenever the log tag set changes at runtime (e.g. after /run appends lambda_microvm_id). Setting the cache directly prevents in-flight pre-run messages — whose origin.tags were snapshotted before the update — from being encoded first and re-priming the cache with stale tags.
Pass nil or an empty slice to reset the cache (equivalent to the old InvalidateServerlessInitTagCache behaviour; the next Encode call will re-populate from the message).
Types ¶
type Encoder ¶
Encoder turns a message into a raw byte array ready to be sent.
var JSONEncoder Encoder = &jsonEncoder{}
JSONEncoder is a shared json encoder.
var JSONServerlessInitEncoder Encoder = &jsonServerlessInitEncoder{}
JSONServerlessInitEncoder is a custom encoder used by serverless-init (Google Cloud Run, Azure Container Apps, etc.) for improved performance.
var PassthroughEncoder Encoder = &passthroughEncoder{}
PassthroughEncoder is an encoder that preserves the rendered log line in GetContent() unchanged. Use this when the consumer reads GetContent() directly (e.g. the observer) to avoid wrapping the content in a JSON transport envelope.
var ProtoEncoder Encoder = &protoEncoder{}
ProtoEncoder is a shared proto encoder.
var RawEncoder Encoder = &rawEncoder{}
RawEncoder is a shared raw encoder.
func NewJSONEncoder ¶
NewJSONEncoder returns a JSON encoder configured to optionally use container-provided timestamps.
func NewProtoEncoder ¶
NewProtoEncoder returns a proto encoder configured to optionally use container-provided timestamps.
func NewRawEncoder ¶
NewRawEncoder returns a raw encoder configured to optionally use container-provided timestamps.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
A Processor updates messages from an inputChan and pushes in an outputChan.
func New ¶
func New(config pkgconfigmodel.Reader, inputChan, outputChan chan *message.Message, processingRules []*config.ProcessingRule, tagFilters *tagfilter.Filters, encoder Encoder, diagnosticMessageReceiver diagnostic.MessageReceiver, hostname hostnameinterface.Component, pipelineMonitor metrics.PipelineMonitor, instanceID string) *Processor
New returns an initialized Processor with config support for failover notifications.
func (*Processor) Flush ¶
Flush processes synchronously the messages that this processor has to process. Mainly (only?) used by the Serverless Agent.
func (*Processor) GetHostname ¶
GetHostname returns the hostname to applied the given log message
type SyncProcessor ¶ added in v0.86.0
type SyncProcessor struct {
// contains filtered or unexported fields
}
SyncProcessor applies processing rules to messages, renders and encodes them in the calling goroutine, the same way Processor does in its own goroutine. It serves callers that need the outcome of every message. It does not tag messages for Multi-Region Failover, and it is safe for concurrent use.
func NewSyncProcessor ¶ added in v0.86.0
func NewSyncProcessor(processingRules []*config.ProcessingRule, encoder Encoder, hostname hostnameinterface.Component) *SyncProcessor
NewSyncProcessor returns a SyncProcessor.
type ValidUtf8Bytes ¶
type ValidUtf8Bytes []byte
func (ValidUtf8Bytes) MarshalText ¶
func (msg ValidUtf8Bytes) MarshalText() (text []byte, err error)
func (ValidUtf8Bytes) String ¶
func (msg ValidUtf8Bytes) String() string
func (*ValidUtf8Bytes) UnmarshalText ¶
func (msg *ValidUtf8Bytes) UnmarshalText(text []byte) error