Documentation
¶
Index ¶
- func ObserveWithTimer(histogram prometheus.Observer, timer *Timer)
- type Metrics
- func (m *Metrics) RecordAWSAPICall(service, operation, status string, duration time.Duration)
- func (m *Metrics) RecordAWSAPIError(service, operation, errorCategory string)
- func (m *Metrics) RecordAWSThrottling()
- func (m *Metrics) RecordCircuitBreakerOperation(operationType, result string)
- func (m *Metrics) RecordCircuitBreakerState(operationType string, state int)
- func (m *Metrics) RecordCleanupError(cleanupType, errorCategory string)
- func (m *Metrics) RecordCleanupOperation(cleanupType, status string, duration time.Duration)
- func (m *Metrics) RecordCoordinationConflict()
- func (m *Metrics) RecordCoordinationWaitTime(duration time.Duration)
- func (m *Metrics) RecordDPDKBindingError(errorType, node string)
- func (m *Metrics) RecordDPDKOperation(operation, status, node string)
- func (m *Metrics) RecordDPDKRollback()
- func (m *Metrics) RecordENIError(operation, errorType, node string)
- func (m *Metrics) RecordENIOperation(operation, status, node string, duration time.Duration)
- func (m *Metrics) RecordStaleCleanup()
- func (m *Metrics) UpdateENIAttachments(count int)
- func (m *Metrics) UpdateENIDetachments(count int)
- func (m *Metrics) UpdateResourceLocks(count int)
- type OperationContext
- func (oc *OperationContext) Duration() time.Duration
- func (oc *OperationContext) LogFields() []interface{}
- func (oc *OperationContext) WithAttachment(attachment networkingv1alpha1.ENIAttachment) *OperationContext
- func (oc *OperationContext) WithMetadata(key string, value interface{}) *OperationContext
- func (oc *OperationContext) WithNodeENI(nodeENI *networkingv1alpha1.NodeENI) *OperationContext
- type StructuredLogger
- func (sl *StructuredLogger) LogAWSAPICall(ctx context.Context, service, operation string, duration time.Duration, ...)
- func (sl *StructuredLogger) LogCircuitBreakerEvent(ctx context.Context, operationType string, oldState, newState int, ...)
- func (sl *StructuredLogger) LogCoordinationEvent(ctx context.Context, eventType string, resourceIDs []string, ...)
- func (sl *StructuredLogger) LogDPDKRollback(ctx context.Context, opCtx *OperationContext, reason string, ...)
- func (sl *StructuredLogger) LogOperationError(ctx context.Context, opCtx *OperationContext, err error, message string)
- func (sl *StructuredLogger) LogOperationStart(ctx context.Context, opCtx *OperationContext, message string)
- func (sl *StructuredLogger) LogOperationSuccess(ctx context.Context, opCtx *OperationContext, message string)
- func (sl *StructuredLogger) LogOperationWarning(ctx context.Context, opCtx *OperationContext, message string)
- func (sl *StructuredLogger) LogResourceMetrics(ctx context.Context, attachmentCount, detachmentCount, lockCount int)
- func (sl *StructuredLogger) LogStaleResourceDetection(ctx context.Context, resourceType, resourceID string, reason string, ...)
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObserveWithTimer ¶
func ObserveWithTimer(histogram prometheus.Observer, timer *Timer)
ObserveWithTimer is a helper to observe a histogram with a timer
Types ¶
type Metrics ¶
type Metrics struct {
// ENI operation metrics
ENIOperationsTotal *prometheus.CounterVec
ENIOperationDuration *prometheus.HistogramVec
ENIOperationErrors *prometheus.CounterVec
ENIAttachmentsTotal prometheus.Gauge
ENIDetachmentsTotal prometheus.Gauge
// Cleanup operation metrics
CleanupOperationsTotal *prometheus.CounterVec
CleanupDuration *prometheus.HistogramVec
CleanupErrors *prometheus.CounterVec
StaleCleanupsTotal prometheus.Counter
// Circuit breaker metrics
CircuitBreakerState *prometheus.GaugeVec
CircuitBreakerOperations *prometheus.CounterVec
// Coordination metrics
ResourceLocks prometheus.Gauge
CoordinationConflicts prometheus.Counter
CoordinationWaitTime prometheus.Histogram
// DPDK operation metrics
DPDKOperationsTotal *prometheus.CounterVec
DPDKRollbacksTotal prometheus.Counter
DPDKBindingErrors *prometheus.CounterVec
// AWS API metrics
AWSAPICallsTotal *prometheus.CounterVec
AWSAPICallDuration *prometheus.HistogramVec
AWSAPIErrors *prometheus.CounterVec
AWSThrottlingEvents prometheus.Counter
}
Metrics holds all the Prometheus metrics for the controller
func NewMetrics ¶
func NewMetrics() *Metrics
NewMetrics creates and registers all metrics (singleton pattern)
func (*Metrics) RecordAWSAPICall ¶
RecordAWSAPICall records metrics for an AWS API call
func (*Metrics) RecordAWSAPIError ¶
RecordAWSAPIError records an AWS API error
func (*Metrics) RecordAWSThrottling ¶
func (m *Metrics) RecordAWSThrottling()
RecordAWSThrottling records an AWS throttling event
func (*Metrics) RecordCircuitBreakerOperation ¶
RecordCircuitBreakerOperation records a circuit breaker operation
func (*Metrics) RecordCircuitBreakerState ¶
RecordCircuitBreakerState records the current state of a circuit breaker
func (*Metrics) RecordCleanupError ¶
RecordCleanupError records a cleanup error
func (*Metrics) RecordCleanupOperation ¶
RecordCleanupOperation records metrics for a cleanup operation
func (*Metrics) RecordCoordinationConflict ¶
func (m *Metrics) RecordCoordinationConflict()
RecordCoordinationConflict records a coordination conflict
func (*Metrics) RecordCoordinationWaitTime ¶
RecordCoordinationWaitTime records time spent waiting for coordination
func (*Metrics) RecordDPDKBindingError ¶
RecordDPDKBindingError records a DPDK binding error
func (*Metrics) RecordDPDKOperation ¶
RecordDPDKOperation records metrics for a DPDK operation
func (*Metrics) RecordDPDKRollback ¶
func (m *Metrics) RecordDPDKRollback()
RecordDPDKRollback records a DPDK rollback
func (*Metrics) RecordENIError ¶
RecordENIError records an ENI operation error
func (*Metrics) RecordENIOperation ¶
RecordENIOperation records metrics for an ENI operation
func (*Metrics) RecordStaleCleanup ¶
func (m *Metrics) RecordStaleCleanup()
RecordStaleCleanup records a stale resource cleanup
func (*Metrics) UpdateENIAttachments ¶
UpdateENIAttachments updates the current number of ENI attachments
func (*Metrics) UpdateENIDetachments ¶
UpdateENIDetachments updates the current number of ENI detachments
func (*Metrics) UpdateResourceLocks ¶
UpdateResourceLocks updates the current number of resource locks
type OperationContext ¶
type OperationContext struct {
OperationID string
OperationType string
NodeENI string
NodeID string
ENIID string
InstanceID string
StartTime time.Time
Metadata map[string]interface{}
}
OperationContext holds context information for an operation
func NewOperationContext ¶
func NewOperationContext(operationType string) *OperationContext
NewOperationContext creates a new operation context
func (*OperationContext) Duration ¶
func (oc *OperationContext) Duration() time.Duration
Duration returns the elapsed time since the operation started
func (*OperationContext) LogFields ¶
func (oc *OperationContext) LogFields() []interface{}
LogFields returns structured log fields for this context
func (*OperationContext) WithAttachment ¶
func (oc *OperationContext) WithAttachment(attachment networkingv1alpha1.ENIAttachment) *OperationContext
WithAttachment adds attachment information to the context
func (*OperationContext) WithMetadata ¶
func (oc *OperationContext) WithMetadata(key string, value interface{}) *OperationContext
WithMetadata adds metadata to the context
func (*OperationContext) WithNodeENI ¶
func (oc *OperationContext) WithNodeENI(nodeENI *networkingv1alpha1.NodeENI) *OperationContext
WithNodeENI adds NodeENI information to the context
type StructuredLogger ¶
type StructuredLogger struct {
// contains filtered or unexported fields
}
StructuredLogger provides structured logging with consistent fields
func NewStructuredLogger ¶
func NewStructuredLogger(logger logr.Logger, metrics *Metrics) *StructuredLogger
NewStructuredLogger creates a new structured logger
func (*StructuredLogger) LogAWSAPICall ¶
func (sl *StructuredLogger) LogAWSAPICall(ctx context.Context, service, operation string, duration time.Duration, err error)
LogAWSAPICall logs an AWS API call with timing
func (*StructuredLogger) LogCircuitBreakerEvent ¶
func (sl *StructuredLogger) LogCircuitBreakerEvent(ctx context.Context, operationType string, oldState, newState int, reason string)
LogCircuitBreakerEvent logs circuit breaker state changes
func (*StructuredLogger) LogCoordinationEvent ¶
func (sl *StructuredLogger) LogCoordinationEvent(ctx context.Context, eventType string, resourceIDs []string, operationID string, details map[string]interface{})
LogCoordinationEvent logs coordination-related events
func (*StructuredLogger) LogDPDKRollback ¶
func (sl *StructuredLogger) LogDPDKRollback(ctx context.Context, opCtx *OperationContext, reason string, rollbackSuccess bool)
LogDPDKRollback logs DPDK rollback events
func (*StructuredLogger) LogOperationError ¶
func (sl *StructuredLogger) LogOperationError(ctx context.Context, opCtx *OperationContext, err error, message string)
LogOperationError logs an error during an operation
func (*StructuredLogger) LogOperationStart ¶
func (sl *StructuredLogger) LogOperationStart(ctx context.Context, opCtx *OperationContext, message string)
LogOperationStart logs the start of an operation
func (*StructuredLogger) LogOperationSuccess ¶
func (sl *StructuredLogger) LogOperationSuccess(ctx context.Context, opCtx *OperationContext, message string)
LogOperationSuccess logs successful completion of an operation
func (*StructuredLogger) LogOperationWarning ¶
func (sl *StructuredLogger) LogOperationWarning(ctx context.Context, opCtx *OperationContext, message string)
LogOperationWarning logs a warning during an operation
func (*StructuredLogger) LogResourceMetrics ¶
func (sl *StructuredLogger) LogResourceMetrics(ctx context.Context, attachmentCount, detachmentCount, lockCount int)
LogResourceMetrics logs current resource metrics
func (*StructuredLogger) LogStaleResourceDetection ¶
func (sl *StructuredLogger) LogStaleResourceDetection(ctx context.Context, resourceType, resourceID string, reason string, action string)
LogStaleResourceDetection logs stale resource detection events