Documentation
¶
Index ¶
- type Aggregator
- func (a *Aggregator) Add(tenantID uuid.UUID, kind Kind, n int64)
- func (a *Aggregator) AddLogs(tenantID uuid.UUID, n int64)
- func (a *Aggregator) AddOtel(tenantID uuid.UUID, n int64)
- func (a *Aggregator) AddStreamDelivered(tenantID uuid.UUID, n int64)
- func (a *Aggregator) AddStreamPublished(tenantID uuid.UUID, n int64)
- func (a *Aggregator) Shutdown() error
- func (a *Aggregator) Start()
- type FlushFunc
- type Kind
- type TenantBytes
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 ¶
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) AddStreamDelivered ¶ added in v0.118.0
func (a *Aggregator) AddStreamDelivered(tenantID uuid.UUID, n int64)
AddStreamDelivered increments the tenant's stream payload bytes sent to subscribers. Safe on a nil receiver.
func (*Aggregator) AddStreamPublished ¶ added in v0.118.0
func (a *Aggregator) AddStreamPublished(tenantID uuid.UUID, n int64)
AddStreamPublished increments the tenant's stored stream payload bytes. 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 → bytes since the last flush. A non-nil error is logged and the snapshot is dropped (best-effort undercount).