Documentation
¶
Index ¶
Constants ¶
View Source
const ( OpGet = "get" OpSet = "set" OpDelete = "delete" OpGetOrSet = "getorset" OpCompareAndSet = "cas" OpHealth = "ping" )
Cache operation names
Variables ¶
This section is empty.
Functions ¶
func IsInitialized ¶
func IsInitialized() bool
IsInitialized returns true if cache metrics have been initialized.
func RecordCacheOperation ¶
func RecordCacheOperation(ctx context.Context, operation string, duration time.Duration, hit bool, err error, namespace string)
RecordCacheOperation records cache operation metrics. This should be called after each cache operation.
Parameters:
- ctx: context for metric recording
- operation: operation name (get, set, delete, cas, etc.)
- duration: operation duration
- hit: whether this was a cache hit (for Get operations)
- err: error if operation failed
- namespace: optional tenant identifier
func RegisterManagerMetrics ¶
func RegisterManagerMetrics(statsProvider func() ManagerMetricsStats, poolName string) func()
RegisterManagerMetrics registers observable metrics for cache manager. The statsProvider function is called during each metrics collection cycle. Returns a cleanup function to unregister the metrics.
Metrics registered:
- cache.manager.active_caches: Current number of active cache instances
- cache.manager.total_created: Total caches created since manager start
- cache.manager.evictions: Total evictions due to LRU policy
- cache.manager.idle_cleanups: Total cleanups due to idle timeout
- cache.manager.errors: Total initialization and close errors
func ResetForTesting ¶
func ResetForTesting()
ResetForTesting resets the metric state for testing purposes.
Types ¶
Click to show internal directories.
Click to hide internal directories.