worker

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEmptyTraceData added in v0.1.2

func GenerateEmptyTraceData() ([]byte, error)

GenerateEmptyTraceData generates an empty trace export request

func GenerateInvalidData added in v0.1.2

func GenerateInvalidData() []byte

GenerateInvalidData generates invalid protobuf data for error testing

func GenerateLargeTraceData added in v0.1.2

func GenerateLargeTraceData(count int) ([]byte, error)

GenerateLargeTraceData generates a large OTLP trace payload for stress testing

func GenerateValidLogsData added in v0.1.2

func GenerateValidLogsData() ([]byte, error)

GenerateValidLogsData generates valid OTLP logs protobuf bytes

func GenerateValidMetricsData added in v0.1.2

func GenerateValidMetricsData() ([]byte, error)

GenerateValidMetricsData generates valid OTLP metrics protobuf bytes with sum, gauge, and histogram

func GenerateValidTraceData added in v0.1.2

func GenerateValidTraceData() ([]byte, error)

GenerateValidTraceData generates valid OTLP trace protobuf bytes

Types

type Pool

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

Pool represents a worker pool

func NewPool

func NewPool(queueSize, workerCount int, submitTimeout time.Duration, writer TelemetryWriter, agentService services.AgentService, logger *zap.Logger) *Pool

NewPool creates a new worker pool with configurable workers

func (*Pool) QueueDepth

func (p *Pool) QueueDepth() int

QueueDepth returns the current queue depth

func (*Pool) Start

func (p *Pool) Start()

Start starts the worker pool

func (*Pool) Stop

func (p *Pool) Stop(timeout time.Duration) error

Stop gracefully stops the worker pool

func (*Pool) Submit

func (p *Pool) Submit(item WorkItem) error

Submit submits a work item to the queue

type TelemetryWriter

type TelemetryWriter interface {
	WriteTraces(ctx context.Context, traces []otlp.TraceData) error
	WriteMetrics(ctx context.Context, sums []otlp.MetricSumData, gauges []otlp.MetricGaugeData, histograms []otlp.MetricHistogramData) error
	WriteLogs(ctx context.Context, logs []otlp.LogData) error
}

TelemetryWriter defines the interface for writing telemetry data

type WorkItem

type WorkItem struct {
	Type      WorkItemType
	RawData   []byte // Raw protobuf bytes
	Timestamp time.Time
}

WorkItem represents a single unit of work with raw OTLP bytes

type WorkItemType

type WorkItemType int

WorkItemType represents the type of work item

const (
	WorkItemTypeTraces WorkItemType = iota
	WorkItemTypeMetrics
	WorkItemTypeLogs
)

Jump to

Keyboard shortcuts

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