metrics

package module
v0.64.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogsExpvars contains metrics for the logs agent.
	LogsExpvars *expvar.Map
	// LogsDecoded is the total number of decoded logs
	LogsDecoded = expvar.Int{}
	// TlmLogsDecoded is the total number of decoded logs
	TlmLogsDecoded = telemetry.NewCounter("logs", "decoded",
		nil, "Total number of decoded logs")
	// LogsProcessed is the total number of processed logs.
	LogsProcessed = expvar.Int{}
	// TlmLogsProcessed is the total number of processed logs.
	TlmLogsProcessed = telemetry.NewCounter("logs", "processed",
		nil, "Total number of processed logs")

	// LogsSent is the total number of sent logs.
	LogsSent = expvar.Int{}
	// TlmLogsSent is the total number of sent logs.
	TlmLogsSent = telemetry.NewCounter("logs", "sent",
		nil, "Total number of sent logs")
	// DestinationErrors is the total number of network errors.
	DestinationErrors = expvar.Int{}
	// TlmDestinationErrors is the total number of network errors.
	TlmDestinationErrors = telemetry.NewCounter("logs", "network_errors",
		nil, "Total number of network errors")
	// DestinationLogsDropped is the total number of logs dropped per Destination
	DestinationLogsDropped = expvar.Map{}
	// TlmLogsDropped is the total number of logs dropped per Destination
	TlmLogsDropped = telemetry.NewCounter("logs", "dropped",
		[]string{"destination"}, "Total number of logs dropped per Destination")
	// BytesSent is the total number of sent bytes before encoding if any
	BytesSent = expvar.Int{}
	// TlmBytesSent is the total number of sent bytes before encoding if any
	TlmBytesSent = telemetry.NewCounter("logs", "bytes_sent",
		nil, "Total number of bytes send before encoding if any")
	// RetryCount is the total number of times we have retried payloads that failed to send
	RetryCount = expvar.Int{}
	// TlmRetryCountis the total number of times we have retried payloads that failed to send
	TlmRetryCount = telemetry.NewCounter("logs", "retry_count",
		nil, "Total number of retried paylaods")
	// RetryTimeSpent is the total time spent retrying payloads that failed to send
	RetryTimeSpent = expvar.Int{}
	// EncodedBytesSent is the total number of sent bytes after encoding if any
	EncodedBytesSent = expvar.Int{}
	// TlmEncodedBytesSent is the total number of sent bytes after encoding if any
	TlmEncodedBytesSent = telemetry.NewCounter("logs", "encoded_bytes_sent",
		nil, "Total number of sent bytes after encoding if any")
	// BytesMissed is the number of bytes lost before they could be consumed by the agent, such as after a log rotation
	BytesMissed = expvar.Int{}
	// TlmBytesMissed is the number of bytes lost before they could be consumed by the agent, such as after log rotation
	TlmBytesMissed = telemetry.NewCounter("logs", "bytes_missed",
		nil, "Total number of bytes lost before they could be consumed by the agent, such as after log rotation")
	// SenderLatency the last reported latency value from the http sender (ms)
	SenderLatency = expvar.Int{}
	// TlmSenderLatency a histogram of http sender latency (ms)
	TlmSenderLatency = telemetry.NewHistogram("logs", "sender_latency",
		nil, "Histogram of http sender latency in ms", []float64{10, 25, 50, 75, 100, 250, 500, 1000, 10000})
	// DestinationExpVars a map of sender utilization metrics for each http destination
	DestinationExpVars = expvar.Map{}
	// TODO: Add LogsCollected for the total number of collected logs.
	//nolint:revive // TODO(AML) Fix revive linter
	DestinationHttpRespByStatusAndUrl = expvar.Map{}
	//nolint:revive // TODO(AML) Fix revive linter
	TlmDestinationHttpRespByStatusAndUrl = telemetry.NewCounter("logs", "destination_http_resp", []string{"status_code", "url"}, "Count of http responses by status code and destination url")

	// TlmAutoMultilineAggregatorFlush Count of each line flushed from the auto mulitline aggregator.
	TlmAutoMultilineAggregatorFlush = telemetry.NewCounter("logs", "auto_multi_line_aggregator_flush", []string{"truncated", "line_type"}, "Count of each line flushed from the auto mulitline aggregator")

	// TlmLogsDiscardedFromSDSBuffer how many messages were dropped when waiting for an SDS configuration because the buffer is full
	TlmLogsDiscardedFromSDSBuffer = telemetry.NewCounter("logs", "sds__dropped_from_buffer", nil, "Count of messages dropped from the buffer while waiting for an SDS configuration")

	// TlmUtilizationRatio is the utilization ratio of a component.
	// Utilization ratio is calculated as the ratio of time spent in use to the total time.
	// This metric is internally sampled and exposed as an ewma in order to produce a useable value.
	TlmUtilizationRatio = telemetry.NewGauge("logs_component_utilization", "ratio", []string{"name", "instance"}, "Gauge of the utilization ratio of a component")
	// TlmUtilizationItems is the capacity of a component by number of elements
	// Both the number of items and the number of bytes are aggregated and exposed as a ewma.
	TlmUtilizationItems = telemetry.NewGauge("logs_component_utilization", "items", []string{"name", "instance"}, "Gauge of the number of items currently held in a component and it's bufferes")
	// TlmUtilizationBytes is the capacity of a component by number of bytes
	TlmUtilizationBytes = telemetry.NewGauge("logs_component_utilization", "bytes", []string{"name", "instance"}, "Gauge of the number of bytes currently held in a component and it's bufferes")
)

Functions

This section is empty.

Types

type CapacityMonitor added in v0.61.0

type CapacityMonitor struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CapacityMonitor samples the average capacity of a component over a given interval. Capacity is calculated as the difference between the ingress and egress of a payload. Because data moves very quickly through components, we need to sample and aggregate this value over time.

func NewCapacityMonitor added in v0.61.0

func NewCapacityMonitor(name, instance string) *CapacityMonitor

NewCapacityMonitor creates a new CapacityMonitor

func (*CapacityMonitor) AddEgress added in v0.61.0

func (i *CapacityMonitor) AddEgress(pl MeasurablePayload)

AddEgress records the egress of a payload

func (*CapacityMonitor) AddIngress added in v0.61.0

func (i *CapacityMonitor) AddIngress(pl MeasurablePayload)

AddIngress records the ingress of a payload

type MeasurablePayload added in v0.61.0

type MeasurablePayload interface {
	Size() int64
	Count() int64
}

MeasurablePayload represents a payload that can be measured in bytes and count

type NoopPipelineMonitor added in v0.61.0

type NoopPipelineMonitor struct {
	// contains filtered or unexported fields
}

NoopPipelineMonitor is a no-op implementation of PipelineMonitor. Some instances of logs components do not need to report capacity metrics and should use this implementation.

func NewNoopPipelineMonitor added in v0.61.0

func NewNoopPipelineMonitor(id string) *NoopPipelineMonitor

NewNoopPipelineMonitor creates a new no-op pipeline monitor

func (*NoopPipelineMonitor) ID added in v0.61.0

func (n *NoopPipelineMonitor) ID() string

ID returns the instance id of the monitor

func (*NoopPipelineMonitor) MakeUtilizationMonitor added in v0.61.0

func (n *NoopPipelineMonitor) MakeUtilizationMonitor(_ string) UtilizationMonitor

MakeUtilizationMonitor returns a no-op utilization monitor.

func (*NoopPipelineMonitor) ReportComponentEgress added in v0.61.0

func (n *NoopPipelineMonitor) ReportComponentEgress(_ MeasurablePayload, _ string)

ReportComponentEgress does nothing.

func (*NoopPipelineMonitor) ReportComponentIngress added in v0.61.0

func (n *NoopPipelineMonitor) ReportComponentIngress(_ MeasurablePayload, _ string)

ReportComponentIngress does nothing.

type NoopUtilizationMonitor added in v0.61.0

type NoopUtilizationMonitor struct{}

NoopUtilizationMonitor is a no-op implementation of UtilizationMonitor.

func (*NoopUtilizationMonitor) Start added in v0.61.0

func (n *NoopUtilizationMonitor) Start()

Start does nothing.

func (*NoopUtilizationMonitor) Stop added in v0.61.0

func (n *NoopUtilizationMonitor) Stop()

Stop does nothing.

type PipelineMonitor added in v0.61.0

type PipelineMonitor interface {
	ID() string
	ReportComponentIngress(size MeasurablePayload, name string)
	ReportComponentEgress(size MeasurablePayload, name string)
	MakeUtilizationMonitor(name string) UtilizationMonitor
}

PipelineMonitor is an interface for monitoring the capacity of a pipeline. Pipeline monitors are used to measure both capacity and utilization of components.

type TelemetryPipelineMonitor added in v0.61.0

type TelemetryPipelineMonitor struct {
	// contains filtered or unexported fields
}

TelemetryPipelineMonitor is a PipelineMonitor that reports capacity metrics to telemetry

func NewTelemetryPipelineMonitor added in v0.61.0

func NewTelemetryPipelineMonitor(instanceID string) *TelemetryPipelineMonitor

NewTelemetryPipelineMonitor creates a new pipeline monitort that reports capacity and utiilization metrics as telemetry

func (*TelemetryPipelineMonitor) ID added in v0.61.0

ID returns the instance id of the monitor

func (*TelemetryPipelineMonitor) MakeUtilizationMonitor added in v0.61.0

func (c *TelemetryPipelineMonitor) MakeUtilizationMonitor(name string) UtilizationMonitor

MakeUtilizationMonitor creates a new utilization monitor for a component.

func (*TelemetryPipelineMonitor) ReportComponentEgress added in v0.61.0

func (c *TelemetryPipelineMonitor) ReportComponentEgress(pl MeasurablePayload, name string)

ReportComponentEgress reports the egress of a payload from a component.

func (*TelemetryPipelineMonitor) ReportComponentIngress added in v0.61.0

func (c *TelemetryPipelineMonitor) ReportComponentIngress(pl MeasurablePayload, name string)

ReportComponentIngress reports the ingress of a payload to a component.

type TelemetryUtilizationMonitor added in v0.61.0

type TelemetryUtilizationMonitor struct {
	// contains filtered or unexported fields
}

TelemetryUtilizationMonitor is a UtilizationMonitor that reports utilization metrics as telemetry.

func NewTelemetryUtilizationMonitor added in v0.61.0

func NewTelemetryUtilizationMonitor(name, instance string) *TelemetryUtilizationMonitor

NewTelemetryUtilizationMonitor creates a new TelemetryUtilizationMonitor.

func (*TelemetryUtilizationMonitor) Start added in v0.61.0

func (u *TelemetryUtilizationMonitor) Start()

Start tracks a start event in the utilization tracker.

func (*TelemetryUtilizationMonitor) Stop added in v0.61.0

func (u *TelemetryUtilizationMonitor) Stop()

Stop tracks a finish event in the utilization tracker.

type UtilizationMonitor added in v0.61.0

type UtilizationMonitor interface {
	Start()
	Stop()
}

UtilizationMonitor is an interface for monitoring the utilization of a component.

Jump to

Keyboard shortcuts

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