o11yusage

package
v0.105.20-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator batches per-tenant, per-kind byte counts and flushes them on an interval, the same pattern as analytics.Aggregator. Add is the non-blocking hot path. A nil FlushFunc disables the ticker.

func NewAggregator

func NewAggregator(l *zerolog.Logger, interval time.Duration, fn FlushFunc) *Aggregator

NewAggregator returns an aggregator. If fn is nil, Start is a no-op.

func (*Aggregator) Add

func (a *Aggregator) Add(tenantID uuid.UUID, kind Kind, n int64)

Add increments the tenant's counter for kind. Safe on a nil receiver.

func (*Aggregator) AddLogs

func (a *Aggregator) AddLogs(tenantID uuid.UUID, n int64)

AddLogs increments the tenant's log-ingest counter. Safe on a nil receiver.

func (*Aggregator) AddOtel

func (a *Aggregator) AddOtel(tenantID uuid.UUID, n int64)

AddOtel increments the tenant's OTLP-ingest counter. Safe on a nil receiver.

func (*Aggregator) Shutdown

func (a *Aggregator) Shutdown() error

Shutdown stops the ticker and flushes remaining counters once.

func (*Aggregator) Start

func (a *Aggregator) Start()

Start runs the flush ticker. Safe on a nil receiver or when no flush func is set.

type FlushFunc

type FlushFunc func(tenants map[uuid.UUID]TenantBytes) error

FlushFunc receives a snapshot of tenant → log/otel bytes since the last flush. A non-nil error is logged and the snapshot is dropped (best-effort undercount).

type Kind

type Kind string

Kind is a separately buffered ingest source. Both kinds flush together but stay distinct through to Autumn event names.

const (
	KindLogs Kind = "logs"
	KindOtel Kind = "otel"
)

type TenantBytes

type TenantBytes struct {
	Logs int64 `json:"logs,omitempty"`
	Otel int64 `json:"otel,omitempty"`
}

TenantBytes is one tenant's buffered ingest since the last flush.

Jump to

Keyboard shortcuts

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