metrics

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package metrics counts what the engine does, without any metrics library: the embedding application exports the snapshot however it likes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

type M struct {
	Commands       atomic.Int64
	Conflicts      atomic.Int64
	EventsAppended atomic.Int64
	DeadLetters    atomic.Int64
	JobsDispatched atomic.Int64
	CacheHits      atomic.Int64
	Timers         atomic.Int64
	Archived       atomic.Int64
	Deleted        atomic.Int64
	// LatencyNanos accumulates command handling time (decide + append).
	LatencyNanos atomic.Int64
}

M holds the counters of one engine.

func (*M) Snapshot

func (m *M) Snapshot() Snapshot

Snapshot returns the current values.

type Snapshot

type Snapshot struct {
	Commands       int64 `json:"commands"`
	Conflicts      int64 `json:"conflicts"`
	EventsAppended int64 `json:"events_appended"`
	DeadLetters    int64 `json:"dead_letters"`
	JobsDispatched int64 `json:"jobs_dispatched"`
	CacheHits      int64 `json:"cache_hits"`
	Timers         int64 `json:"timers"`
	Archived       int64 `json:"archived"`
	Deleted        int64 `json:"deleted"`
	LatencyNanos   int64 `json:"latency_nanos"`
	// ProjectionLag is the number of events not yet processed by the
	// dispatcher (filled by the engine on request).
	ProjectionLag uint64 `json:"projection_lag"`
	// DispatchStall is the longest time any dispatcher partition with pending
	// events has gone without acknowledging one; DispatchStalls has it per
	// partition. The dispatcher retries transient failures forever, so this
	// is the signal to alert on (e.g. above one minute).
	DispatchStall  time.Duration         `json:"dispatch_stall"`
	DispatchStalls map[int]time.Duration `json:"dispatch_stalls,omitempty"`
}

Snapshot is a point-in-time copy of the counters.

Jump to

Keyboard shortcuts

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