core

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// Operation counters
	ReadsTotal     atomic.Int64
	WritesTotal    atomic.Int64
	DeletesTotal   atomic.Int64
	ListsTotal     atomic.Int64
	CASTotal       atomic.Int64
	RotationsTotal atomic.Int64

	// Error counters
	ReadErrors    atomic.Int64
	WriteErrors   atomic.Int64
	DecryptErrors atomic.Int64
	EncryptErrors atomic.Int64

	// Performance metrics
	AvgReadLatency  atomic.Int64 // nanoseconds
	AvgWriteLatency atomic.Int64 // nanoseconds

	// Current state
	ActiveOperations atomic.Int64
	QueueDepth       atomic.Int64

	// Cache metrics (if caching layer added later)
	CacheHits   atomic.Int64
	CacheMisses atomic.Int64
}

Metrics provides real-time operational metrics for the store. This is separate from Stats() which provides persistent storage metrics.

func (*Metrics) DecrementActive

func (m *Metrics) DecrementActive()

DecrementActive decrements the active operations counter.

func (*Metrics) IncrementActive

func (m *Metrics) IncrementActive()

IncrementActive increments the active operations counter.

func (*Metrics) IncrementCAS

func (m *Metrics) IncrementCAS()

IncrementCAS increments the compare-and-swap counter.

func (*Metrics) IncrementCacheHit

func (m *Metrics) IncrementCacheHit()

IncrementCacheHit increments the cache hit counter.

func (*Metrics) IncrementCacheMiss

func (m *Metrics) IncrementCacheMiss()

IncrementCacheMiss increments the cache miss counter.

func (*Metrics) IncrementDecryptError

func (m *Metrics) IncrementDecryptError()

IncrementDecryptError increments the decrypt error counter.

func (*Metrics) IncrementDelete

func (m *Metrics) IncrementDelete()

IncrementDelete increments the delete counter.

func (*Metrics) IncrementEncryptError

func (m *Metrics) IncrementEncryptError()

IncrementEncryptError increments the encrypt error counter.

func (*Metrics) IncrementList

func (m *Metrics) IncrementList()

IncrementList increments the list counter.

func (*Metrics) IncrementRead

func (m *Metrics) IncrementRead()

IncrementRead increments the read counter.

func (*Metrics) IncrementReadError

func (m *Metrics) IncrementReadError()

IncrementReadError increments the read error counter.

func (*Metrics) IncrementRotation

func (m *Metrics) IncrementRotation()

IncrementRotation increments the rotation counter.

func (*Metrics) IncrementWrite

func (m *Metrics) IncrementWrite()

IncrementWrite increments the write counter.

func (*Metrics) IncrementWriteError

func (m *Metrics) IncrementWriteError()

IncrementWriteError increments the write error counter.

func (*Metrics) RecordReadLatency

func (m *Metrics) RecordReadLatency(latency time.Duration)

RecordReadLatency records a read operation latency.

func (*Metrics) RecordWriteLatency

func (m *Metrics) RecordWriteLatency(latency time.Duration)

RecordWriteLatency records a write operation latency.

func (*Metrics) Snapshot

func (m *Metrics) Snapshot() MetricsSnapshot

Snapshot returns a point-in-time copy of all metrics.

type MetricsSnapshot

type MetricsSnapshot struct {
	// Operation counters
	ReadsTotal     int64 `json:"reads_total"`
	WritesTotal    int64 `json:"writes_total"`
	DeletesTotal   int64 `json:"deletes_total"`
	ListsTotal     int64 `json:"lists_total"`
	CASTotal       int64 `json:"cas_total"`
	RotationsTotal int64 `json:"rotations_total"`

	// Error counters
	ReadErrors    int64 `json:"read_errors"`
	WriteErrors   int64 `json:"write_errors"`
	DecryptErrors int64 `json:"decrypt_errors"`
	EncryptErrors int64 `json:"encrypt_errors"`

	// Performance metrics
	AvgReadLatency  time.Duration `json:"avg_read_latency_ns"`
	AvgWriteLatency time.Duration `json:"avg_write_latency_ns"`

	// Current state
	ActiveOperations int64 `json:"active_operations"`
	QueueDepth       int64 `json:"queue_depth"`

	// Cache metrics
	CacheHits   int64 `json:"cache_hits"`
	CacheMisses int64 `json:"cache_misses"`
}

MetricsSnapshot is a point-in-time copy of metrics.

Jump to

Keyboard shortcuts

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