Documentation
¶
Index ¶
- type CacheCollector
- func (c *CacheCollector) Del(ctx context.Context, keys ...string) *redis.IntCmd
- func (c *CacheCollector) Get(ctx context.Context, key string) *redis.StringCmd
- func (c *CacheCollector) GetClient() *redis.Client
- func (c *CacheCollector) HDel(ctx context.Context, key string, fields ...string) *redis.IntCmd
- func (c *CacheCollector) HGet(ctx context.Context, key, field string) *redis.StringCmd
- func (c *CacheCollector) HSet(ctx context.Context, key string, values ...any) *redis.IntCmd
- func (c *CacheCollector) Ping(ctx context.Context) *redis.StatusCmd
- func (c *CacheCollector) PoolStats() *redis.PoolStats
- func (c *CacheCollector) Set(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd
- type CacheMetricsCollector
- type Collector
- type DataCollector
- func (c *DataCollector) Close() error
- func (c *DataCollector) DBConnections(count int)
- func (c *DataCollector) DBQuery(duration time.Duration, err error)
- func (c *DataCollector) DBTransaction(err error)
- func (c *DataCollector) GetStats() map[string]any
- func (c *DataCollector) HealthCheck(component string, healthy bool)
- func (c *DataCollector) MQConsume(system string, err error)
- func (c *DataCollector) MQPublish(system string, err error)
- func (c *DataCollector) MongoOperation(operation string, err error)
- func (c *DataCollector) RedisCommand(command string, err error)
- func (c *DataCollector) RedisConnections(count int)
- func (c *DataCollector) SearchIndex(engine, operation string)
- func (c *DataCollector) SearchQuery(engine string, err error)
- type ExtensionCollector
- type ExtensionCollectorAdapter
- func (a *ExtensionCollectorAdapter) DBConnections(count int)
- func (a *ExtensionCollectorAdapter) DBQuery(duration time.Duration, err error)
- func (a *ExtensionCollectorAdapter) DBTransaction(err error)
- func (a *ExtensionCollectorAdapter) HealthCheck(component string, healthy bool)
- func (a *ExtensionCollectorAdapter) MQConsume(system string, err error)
- func (a *ExtensionCollectorAdapter) MQPublish(system string, err error)
- func (a *ExtensionCollectorAdapter) MongoOperation(operation string, err error)
- func (a *ExtensionCollectorAdapter) RedisCommand(command string, err error)
- func (a *ExtensionCollectorAdapter) RedisConnections(count int)
- func (a *ExtensionCollectorAdapter) SearchIndex(engine, operation string)
- func (a *ExtensionCollectorAdapter) SearchQuery(engine string, err error)
- type HealthChecker
- type HealthMonitor
- type Labels
- type MemoryStorage
- type Metric
- type NoOpCollector
- func (NoOpCollector) DBConnections(int)
- func (NoOpCollector) DBQuery(time.Duration, error)
- func (NoOpCollector) DBTransaction(error)
- func (NoOpCollector) HealthCheck(string, bool)
- func (NoOpCollector) MQConsume(string, error)
- func (NoOpCollector) MQPublish(string, error)
- func (NoOpCollector) MongoOperation(string, error)
- func (NoOpCollector) RedisCommand(string, error)
- func (NoOpCollector) RedisConnections(int)
- func (NoOpCollector) SearchIndex(string, string)
- func (NoOpCollector) SearchQuery(string, error)
- type QueryRequest
- type RedisStorage
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheCollector ¶
type CacheCollector struct {
// contains filtered or unexported fields
}
CacheCollector wraps Redis client with metrics
func NewCacheCollector ¶
func NewCacheCollector(client *redis.Client, collector CacheMetricsCollector) *CacheCollector
NewCacheCollector creates a cache collector wrapper
func (*CacheCollector) GetClient ¶
func (c *CacheCollector) GetClient() *redis.Client
GetClient returns the underlying Redis client
func (*CacheCollector) Ping ¶
func (c *CacheCollector) Ping(ctx context.Context) *redis.StatusCmd
Ping wraps Redis PING with metrics
func (*CacheCollector) PoolStats ¶
func (c *CacheCollector) PoolStats() *redis.PoolStats
PoolStats returns pool statistics and updates metrics
type CacheMetricsCollector ¶
CacheMetricsCollector for Redis cache operations
type Collector ¶
type Collector interface {
DBQuery(duration time.Duration, err error)
DBTransaction(err error)
DBConnections(count int)
RedisCommand(command string, err error)
RedisConnections(count int)
MongoOperation(operation string, err error)
SearchQuery(engine string, err error)
SearchIndex(engine, operation string)
MQPublish(system string, err error)
MQConsume(system string, err error)
HealthCheck(component string, healthy bool)
}
Collector interface for data layer metrics
type DataCollector ¶
type DataCollector struct {
// contains filtered or unexported fields
}
DataCollector collects data layer metrics
func NewDataCollector ¶
func NewDataCollector(batchSize int) *DataCollector
NewDataCollector creates a new data collector with memory storage
func NewDataCollectorWithRedis ¶
func NewDataCollectorWithRedis(client *redis.Client, keyPrefix string, retention time.Duration, batchSize int) *DataCollector
NewDataCollectorWithRedis creates a new data collector with Redis storage
func (*DataCollector) Close ¶
func (c *DataCollector) Close() error
Close closes the collector and flushes remaining metrics
func (*DataCollector) DBConnections ¶
func (c *DataCollector) DBConnections(count int)
DBConnections records database connection count
func (*DataCollector) DBQuery ¶
func (c *DataCollector) DBQuery(duration time.Duration, err error)
DBQuery records database query metrics
func (*DataCollector) DBTransaction ¶
func (c *DataCollector) DBTransaction(err error)
DBTransaction records database transaction metrics
func (*DataCollector) GetStats ¶
func (c *DataCollector) GetStats() map[string]any
GetStats returns current statistics
func (*DataCollector) HealthCheck ¶
func (c *DataCollector) HealthCheck(component string, healthy bool)
HealthCheck records health check metrics
func (*DataCollector) MQConsume ¶
func (c *DataCollector) MQConsume(system string, err error)
MQConsume records message queue consume metrics
func (*DataCollector) MQPublish ¶
func (c *DataCollector) MQPublish(system string, err error)
MQPublish records message queue publish metrics
func (*DataCollector) MongoOperation ¶
func (c *DataCollector) MongoOperation(operation string, err error)
MongoOperation records MongoDB operation metrics
func (*DataCollector) RedisCommand ¶
func (c *DataCollector) RedisCommand(command string, err error)
RedisCommand records Redis command metrics
func (*DataCollector) RedisConnections ¶
func (c *DataCollector) RedisConnections(count int)
RedisConnections records Redis connection count
func (*DataCollector) SearchIndex ¶
func (c *DataCollector) SearchIndex(engine, operation string)
SearchIndex records search index operation metrics
func (*DataCollector) SearchQuery ¶
func (c *DataCollector) SearchQuery(engine string, err error)
SearchQuery records search query metrics
type ExtensionCollector ¶
type ExtensionCollector interface {
DBQuery(duration time.Duration, err error)
DBTransaction(err error)
DBConnections(count int)
RedisCommand(command string, err error)
RedisConnections(count int)
MongoOperation(operation string, err error)
SearchQuery(engine string, err error)
SearchIndex(engine, operation string)
MQPublish(system string, err error)
MQConsume(system string, err error)
HealthCheck(component string, healthy bool)
}
ExtensionCollector interface from extension layer
type ExtensionCollectorAdapter ¶
type ExtensionCollectorAdapter struct {
// contains filtered or unexported fields
}
ExtensionCollectorAdapter adapts extension metrics collector to data layer interface
func NewExtensionCollectorAdapter ¶
func NewExtensionCollectorAdapter(collector ExtensionCollector) *ExtensionCollectorAdapter
NewExtensionCollectorAdapter creates adapter for extension collector
func (*ExtensionCollectorAdapter) DBConnections ¶
func (a *ExtensionCollectorAdapter) DBConnections(count int)
func (*ExtensionCollectorAdapter) DBQuery ¶
func (a *ExtensionCollectorAdapter) DBQuery(duration time.Duration, err error)
Implement data layer Collector interface
func (*ExtensionCollectorAdapter) DBTransaction ¶
func (a *ExtensionCollectorAdapter) DBTransaction(err error)
func (*ExtensionCollectorAdapter) HealthCheck ¶
func (a *ExtensionCollectorAdapter) HealthCheck(component string, healthy bool)
func (*ExtensionCollectorAdapter) MQConsume ¶
func (a *ExtensionCollectorAdapter) MQConsume(system string, err error)
func (*ExtensionCollectorAdapter) MQPublish ¶
func (a *ExtensionCollectorAdapter) MQPublish(system string, err error)
func (*ExtensionCollectorAdapter) MongoOperation ¶
func (a *ExtensionCollectorAdapter) MongoOperation(operation string, err error)
func (*ExtensionCollectorAdapter) RedisCommand ¶
func (a *ExtensionCollectorAdapter) RedisCommand(command string, err error)
func (*ExtensionCollectorAdapter) RedisConnections ¶
func (a *ExtensionCollectorAdapter) RedisConnections(count int)
func (*ExtensionCollectorAdapter) SearchIndex ¶
func (a *ExtensionCollectorAdapter) SearchIndex(engine, operation string)
func (*ExtensionCollectorAdapter) SearchQuery ¶
func (a *ExtensionCollectorAdapter) SearchQuery(engine string, err error)
type HealthChecker ¶
HealthChecker interface for health checking
type HealthMonitor ¶
type HealthMonitor struct {
// contains filtered or unexported fields
}
HealthMonitor monitors data layer component health
func NewHealthMonitor ¶
func NewHealthMonitor(collector Collector) *HealthMonitor
NewHealthMonitor creates a new health monitor
func (*HealthMonitor) CheckAll ¶
func (h *HealthMonitor) CheckAll(ctx context.Context) map[string]bool
CheckAll performs health check on all registered components
func (*HealthMonitor) CheckComponent ¶
func (h *HealthMonitor) CheckComponent(ctx context.Context, name string) bool
CheckComponent checks a specific component
func (*HealthMonitor) RegisterComponent ¶
func (h *HealthMonitor) RegisterComponent(checker HealthChecker)
RegisterComponent registers a component for health monitoring
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage stores metrics in memory
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage creates a new memory storage
func (*MemoryStorage) Query ¶
func (m *MemoryStorage) Query(query QueryRequest) ([]Metric, error)
Query queries metrics from memory
func (*MemoryStorage) Store ¶
func (m *MemoryStorage) Store(metrics []Metric) error
Store stores metrics in memory
type Metric ¶
type Metric struct {
Type string `json:"type"`
Value int64 `json:"value"`
Labels Labels `json:"labels"`
Timestamp time.Time `json:"timestamp"`
}
Metric represents a data layer metric
type NoOpCollector ¶
type NoOpCollector struct{}
NoOpCollector implements Collector with no-op methods
func (NoOpCollector) DBConnections ¶
func (NoOpCollector) DBConnections(int)
func (NoOpCollector) DBTransaction ¶
func (NoOpCollector) DBTransaction(error)
func (NoOpCollector) HealthCheck ¶
func (NoOpCollector) HealthCheck(string, bool)
func (NoOpCollector) MQConsume ¶
func (NoOpCollector) MQConsume(string, error)
func (NoOpCollector) MQPublish ¶
func (NoOpCollector) MQPublish(string, error)
func (NoOpCollector) MongoOperation ¶
func (NoOpCollector) MongoOperation(string, error)
func (NoOpCollector) RedisCommand ¶
func (NoOpCollector) RedisCommand(string, error)
func (NoOpCollector) RedisConnections ¶
func (NoOpCollector) RedisConnections(int)
func (NoOpCollector) SearchIndex ¶
func (NoOpCollector) SearchIndex(string, string)
func (NoOpCollector) SearchQuery ¶
func (NoOpCollector) SearchQuery(string, error)
type QueryRequest ¶
type QueryRequest struct {
Type string `json:"type"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Labels Labels `json:"labels"`
Limit int `json:"limit"`
}
QueryRequest for querying metrics
type RedisStorage ¶
type RedisStorage struct {
// contains filtered or unexported fields
}
RedisStorage stores metrics in Redis
func NewRedisStorage ¶
NewRedisStorage creates a new Redis storage
func (*RedisStorage) Query ¶
func (r *RedisStorage) Query(query QueryRequest) ([]Metric, error)
Query queries metrics from Redis
func (*RedisStorage) Store ¶
func (r *RedisStorage) Store(metrics []Metric) error
Store stores metrics in Redis