telemetry

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer[T any] struct {
	// contains filtered or unexported fields
}

Buffer is a thread-safe ring buffer with overflow policies.

func NewBuffer

func NewBuffer[T any](category ratelimit.Category, capacity int, overflowPolicy OverflowPolicy, batchSize int, timeout time.Duration) *Buffer[T]

func (*Buffer[T]) AcceptedCount

func (b *Buffer[T]) AcceptedCount() int64

func (*Buffer[T]) Capacity

func (b *Buffer[T]) Capacity() int

func (*Buffer[T]) Category

func (b *Buffer[T]) Category() ratelimit.Category

func (*Buffer[T]) Clear

func (b *Buffer[T]) Clear()

func (*Buffer[T]) Drain

func (b *Buffer[T]) Drain() []T

func (*Buffer[T]) DropRate

func (b *Buffer[T]) DropRate() float64

func (*Buffer[T]) DroppedCount

func (b *Buffer[T]) DroppedCount() int64

func (*Buffer[T]) GetMetrics

func (b *Buffer[T]) GetMetrics() BufferMetrics

func (*Buffer[T]) IsEmpty

func (b *Buffer[T]) IsEmpty() bool

func (*Buffer[T]) IsFull

func (b *Buffer[T]) IsFull() bool

func (*Buffer[T]) IsReadyToFlush

func (b *Buffer[T]) IsReadyToFlush() bool

func (*Buffer[T]) MarkFlushed

func (b *Buffer[T]) MarkFlushed()

func (*Buffer[T]) Offer

func (b *Buffer[T]) Offer(item T) bool

func (*Buffer[T]) OfferedCount

func (b *Buffer[T]) OfferedCount() int64

func (*Buffer[T]) Peek

func (b *Buffer[T]) Peek() (T, bool)

func (*Buffer[T]) Poll

func (b *Buffer[T]) Poll() (T, bool)

func (*Buffer[T]) PollBatch

func (b *Buffer[T]) PollBatch(maxItems int) []T

func (*Buffer[T]) PollIfReady

func (b *Buffer[T]) PollIfReady() []T

func (*Buffer[T]) Priority

func (b *Buffer[T]) Priority() ratelimit.Priority

func (*Buffer[T]) SetDroppedCallback

func (b *Buffer[T]) SetDroppedCallback(callback func(item T, reason string))

func (*Buffer[T]) Size

func (b *Buffer[T]) Size() int

func (*Buffer[T]) Utilization

func (b *Buffer[T]) Utilization() float64

type BufferMetrics

type BufferMetrics struct {
	Category      ratelimit.Category `json:"category"`
	Priority      ratelimit.Priority `json:"priority"`
	Capacity      int                `json:"capacity"`
	Size          int                `json:"size"`
	Utilization   float64            `json:"utilization"`
	OfferedCount  int64              `json:"offered_count"`
	DroppedCount  int64              `json:"dropped_count"`
	AcceptedCount int64              `json:"accepted_count"`
	DropRate      float64            `json:"drop_rate"`
	LastUpdated   time.Time          `json:"last_updated"`
}

type OverflowPolicy

type OverflowPolicy int

OverflowPolicy defines how the ring buffer handles overflow.

const (
	OverflowPolicyDropOldest OverflowPolicy = iota
	OverflowPolicyDropNewest
)

func (OverflowPolicy) String

func (op OverflowPolicy) String() string

Jump to

Keyboard shortcuts

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