Documentation
¶
Overview ¶
Package observability provides comprehensive monitoring, tracing, and logging for Nebula
Index ¶
- func GetLogger() *zap.Logger
- func GetMeter() metric.Meter
- func GetTracer() trace.Tracer
- func Initialize(config ObservabilityConfig) error
- func RecordDuration(metricName string, duration time.Duration, labels map[string]string)
- func RecordGauge(metricName string, value float64, labels map[string]string)
- func Shutdown(ctx context.Context) error
- func TracingMiddleware(serviceName string) func(http.Handler) http.Handler
- type ConnectorMetrics
- type ConnectorTracer
- func (ct *ConnectorTracer) StartSpan(ctx context.Context, operation string) (context.Context, *Span)
- func (ct *ConnectorTracer) TraceBatch(ctx context.Context, batchSize int, operation string, fn func() error) error
- func (ct *ConnectorTracer) TraceRecord(ctx context.Context, recordID string, operation string, fn func() error) error
- type ContextLogger
- func (cl *ContextLogger) Debug(msg string, fields ...zap.Field)
- func (cl *ContextLogger) Error(msg string, fields ...zap.Field)
- func (cl *ContextLogger) Fatal(msg string, fields ...zap.Field)
- func (cl *ContextLogger) Info(msg string, fields ...zap.Field)
- func (cl *ContextLogger) Warn(msg string, fields ...zap.Field)
- func (cl *ContextLogger) WithOperation(operation string) *OperationLogger
- type DistributedTracer
- type ErrorReporter
- type LoggingConfig
- type MetricsCollector
- func (mc *MetricsCollector) RecordBatchSize(operation string, size int)
- func (mc *MetricsCollector) RecordDuration(operation string, duration time.Duration, status string)
- func (mc *MetricsCollector) RecordError(operation string, errorType string)
- func (mc *MetricsCollector) RecordRecordsProcessed(operation string, count int, status string)
- func (mc *MetricsCollector) RecordRetry(operation string)
- func (mc *MetricsCollector) RecordThroughput(operation string, recordsPerSecond float64)
- func (mc *MetricsCollector) SetActiveConnections(count int)
- type MetricsConfig
- type ObservabilityConfig
- type OperationLogger
- func (ol *OperationLogger) Debug(msg string, fields ...zap.Field)
- func (ol *OperationLogger) Error(msg string, fields ...zap.Field)
- func (ol *OperationLogger) Fatal(msg string, fields ...zap.Field)
- func (ol *OperationLogger) Info(msg string, fields ...zap.Field)
- func (ol *OperationLogger) LogComplete(msg string, fields ...zap.Field)
- func (ol *OperationLogger) LogError(msg string, err error, fields ...zap.Field)
- func (ol *OperationLogger) LogProgress(msg string, progress float64, fields ...zap.Field)
- func (ol *OperationLogger) LogStart(msg string, fields ...zap.Field)
- func (ol *OperationLogger) Warn(msg string, fields ...zap.Field)
- type PerformanceLogger
- func (pl *PerformanceLogger) LogLatency(operation string, latency time.Duration, threshold time.Duration)
- func (pl *PerformanceLogger) LogMemoryUsage(component string, allocated int64, threshold int64)
- func (pl *PerformanceLogger) LogThroughput(operation string, recordsPerSecond float64, threshold float64)
- type PerformanceStats
- type PerformanceTracker
- type PipelineMetrics
- type RecordMetrics
- type SecurityLogger
- type Span
- type StructuredLogger
- func (sl *StructuredLogger) Debug(msg string, fields ...zap.Field)
- func (sl *StructuredLogger) Error(msg string, fields ...zap.Field)
- func (sl *StructuredLogger) Fatal(msg string, fields ...zap.Field)
- func (sl *StructuredLogger) Info(msg string, fields ...zap.Field)
- func (sl *StructuredLogger) Warn(msg string, fields ...zap.Field)
- func (sl *StructuredLogger) WithContext(ctx context.Context) *ContextLogger
- func (sl *StructuredLogger) WithOperation(operation string) *OperationLogger
- type TracingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
func Initialize(config ObservabilityConfig) error
Initialize sets up the observability framework
func RecordDuration ¶
RecordDuration records a general duration metric (used by tracing.go)
func RecordGauge ¶
RecordGauge records a general gauge metric (used by tracing.go)
Types ¶
type ConnectorMetrics ¶
type ConnectorMetrics struct {
Collector *MetricsCollector
Tracer *ConnectorTracer
Logger *zap.Logger
}
ConnectorMetrics provides a unified interface for connector metrics
func NewConnectorMetrics ¶
func NewConnectorMetrics(connectorType, connectorName string) *ConnectorMetrics
NewConnectorMetrics creates a unified metrics interface for a connector
func (*ConnectorMetrics) TrackOperation ¶
func (cm *ConnectorMetrics) TrackOperation(ctx context.Context, operation string, fn func() error) error
TrackOperation provides a convenient way to track an operation with metrics and tracing
type ConnectorTracer ¶
type ConnectorTracer struct {
// contains filtered or unexported fields
}
ConnectorTracer provides connector-specific tracing utilities
func NewConnectorTracer ¶
func NewConnectorTracer(connectorType, connectorName string) *ConnectorTracer
NewConnectorTracer creates a new connector tracer
func (*ConnectorTracer) StartSpan ¶
func (ct *ConnectorTracer) StartSpan(ctx context.Context, operation string) (context.Context, *Span)
StartSpan starts a connector-specific span
func (*ConnectorTracer) TraceBatch ¶
func (ct *ConnectorTracer) TraceBatch(ctx context.Context, batchSize int, operation string, fn func() error) error
TraceBatch traces a batch processing operation
func (*ConnectorTracer) TraceRecord ¶
func (ct *ConnectorTracer) TraceRecord(ctx context.Context, recordID string, operation string, fn func() error) error
TraceRecord traces a record processing operation
type ContextLogger ¶
type ContextLogger struct {
// contains filtered or unexported fields
}
ContextLogger provides logging with tracing context
func (*ContextLogger) Debug ¶
func (cl *ContextLogger) Debug(msg string, fields ...zap.Field)
Debug logs a debug message with context
func (*ContextLogger) Error ¶
func (cl *ContextLogger) Error(msg string, fields ...zap.Field)
Error logs an error message with context
func (*ContextLogger) Fatal ¶
func (cl *ContextLogger) Fatal(msg string, fields ...zap.Field)
Fatal logs a fatal message with context and exits
func (*ContextLogger) Info ¶
func (cl *ContextLogger) Info(msg string, fields ...zap.Field)
Info logs an info message with context
func (*ContextLogger) Warn ¶
func (cl *ContextLogger) Warn(msg string, fields ...zap.Field)
Warn logs a warning message with context
func (*ContextLogger) WithOperation ¶
func (cl *ContextLogger) WithOperation(operation string) *OperationLogger
WithOperation adds operation context
type DistributedTracer ¶
type DistributedTracer struct {
// contains filtered or unexported fields
}
DistributedTracer handles cross-service tracing
func NewDistributedTracer ¶
func NewDistributedTracer() *DistributedTracer
NewDistributedTracer creates a new distributed tracer
func (*DistributedTracer) ExtractContext ¶
func (dt *DistributedTracer) ExtractContext(ctx context.Context, headers map[string]string) context.Context
ExtractContext extracts tracing context from headers
func (*DistributedTracer) InjectContext ¶
func (dt *DistributedTracer) InjectContext(ctx context.Context, headers map[string]string)
InjectContext injects tracing context into headers
type ErrorReporter ¶
type ErrorReporter struct {
// contains filtered or unexported fields
}
ErrorReporter provides centralized error reporting
func NewErrorReporter ¶
func NewErrorReporter() *ErrorReporter
NewErrorReporter creates a new error reporter
func (*ErrorReporter) ReportError ¶
func (er *ErrorReporter) ReportError(ctx context.Context, err error, component string, operation string, metadata map[string]interface{})
ReportError reports an error with context
type LoggingConfig ¶
type LoggingConfig struct {
Level zapcore.Level
Format string // "json", "console"
OutputPaths []string
ErrorPaths []string
Sampling *zap.SamplingConfig
Development bool
}
LoggingConfig contains logging configuration
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector provides high-performance metrics collection
func NewMetricsCollector ¶
func NewMetricsCollector(connectorType, connectorName string) *MetricsCollector
NewMetricsCollector creates a new metrics collector for a connector
func (*MetricsCollector) RecordBatchSize ¶
func (mc *MetricsCollector) RecordBatchSize(operation string, size int)
RecordBatchSize records the size of a processed batch
func (*MetricsCollector) RecordDuration ¶
func (mc *MetricsCollector) RecordDuration(operation string, duration time.Duration, status string)
RecordDuration records a duration metric with labels
func (*MetricsCollector) RecordError ¶
func (mc *MetricsCollector) RecordError(operation string, errorType string)
RecordError increments the error counter
func (*MetricsCollector) RecordRecordsProcessed ¶
func (mc *MetricsCollector) RecordRecordsProcessed(operation string, count int, status string)
RecordRecordsProcessed increments the records processed counter
func (*MetricsCollector) RecordRetry ¶
func (mc *MetricsCollector) RecordRetry(operation string)
RecordRetry increments the retry counter
func (*MetricsCollector) RecordThroughput ¶
func (mc *MetricsCollector) RecordThroughput(operation string, recordsPerSecond float64)
RecordThroughput records a throughput metric
func (*MetricsCollector) SetActiveConnections ¶
func (mc *MetricsCollector) SetActiveConnections(count int)
SetActiveConnections sets the number of active connections
type MetricsConfig ¶
type MetricsConfig struct {
Namespace string
Subsystem string
PrometheusPush bool
PushGateway string
PushInterval time.Duration
HistogramBounds []float64
}
MetricsConfig contains metrics configuration
type ObservabilityConfig ¶
type ObservabilityConfig struct {
Tracing TracingConfig
Metrics MetricsConfig
Logging LoggingConfig
}
ObservabilityConfig contains all observability configuration
func DefaultConfig ¶
func DefaultConfig() ObservabilityConfig
DefaultConfig returns a default observability configuration
type OperationLogger ¶
type OperationLogger struct {
// contains filtered or unexported fields
}
OperationLogger provides operation-specific logging
func (*OperationLogger) Debug ¶
func (ol *OperationLogger) Debug(msg string, fields ...zap.Field)
Debug logs a debug message for the operation
func (*OperationLogger) Error ¶
func (ol *OperationLogger) Error(msg string, fields ...zap.Field)
Error logs an error message for the operation
func (*OperationLogger) Fatal ¶
func (ol *OperationLogger) Fatal(msg string, fields ...zap.Field)
Fatal logs a fatal message for the operation and exits
func (*OperationLogger) Info ¶
func (ol *OperationLogger) Info(msg string, fields ...zap.Field)
Info logs an info message for the operation
func (*OperationLogger) LogComplete ¶
func (ol *OperationLogger) LogComplete(msg string, fields ...zap.Field)
LogComplete logs the completion of an operation
func (*OperationLogger) LogError ¶
func (ol *OperationLogger) LogError(msg string, err error, fields ...zap.Field)
LogError logs an operation error
func (*OperationLogger) LogProgress ¶
func (ol *OperationLogger) LogProgress(msg string, progress float64, fields ...zap.Field)
LogProgress logs operation progress
type PerformanceLogger ¶
type PerformanceLogger struct {
// contains filtered or unexported fields
}
PerformanceLogger provides specialized logging for performance monitoring
func NewPerformanceLogger ¶
func NewPerformanceLogger() *PerformanceLogger
NewPerformanceLogger creates a new performance logger
func (*PerformanceLogger) LogLatency ¶
func (pl *PerformanceLogger) LogLatency(operation string, latency time.Duration, threshold time.Duration)
LogLatency logs latency metrics
func (*PerformanceLogger) LogMemoryUsage ¶
func (pl *PerformanceLogger) LogMemoryUsage(component string, allocated int64, threshold int64)
LogMemoryUsage logs memory usage metrics
func (*PerformanceLogger) LogThroughput ¶
func (pl *PerformanceLogger) LogThroughput(operation string, recordsPerSecond float64, threshold float64)
LogThroughput logs throughput metrics
type PerformanceStats ¶
type PerformanceStats struct {
Operation string
Duration time.Duration
RecordsProcessed int64
Throughput float64
Errors int64
Retries int64
ErrorRate float64
}
PerformanceStats contains performance statistics
func (PerformanceStats) LogStats ¶
func (ps PerformanceStats) LogStats(logger *zap.Logger)
LogStats logs the performance statistics
type PerformanceTracker ¶
type PerformanceTracker struct {
// contains filtered or unexported fields
}
PerformanceTracker tracks performance metrics over time
func NewPerformanceTracker ¶
func NewPerformanceTracker(collector *MetricsCollector, operation string) *PerformanceTracker
NewPerformanceTracker creates a new performance tracker
func (*PerformanceTracker) GetCurrentThroughput ¶
func (pt *PerformanceTracker) GetCurrentThroughput() float64
GetCurrentThroughput calculates and returns current throughput
func (*PerformanceTracker) GetStats ¶
func (pt *PerformanceTracker) GetStats() PerformanceStats
GetStats returns current performance statistics
func (*PerformanceTracker) RecordError ¶
func (pt *PerformanceTracker) RecordError(errorType string)
RecordError increments the error count
func (*PerformanceTracker) RecordProcessed ¶
func (pt *PerformanceTracker) RecordProcessed(count int)
RecordProcessed increments the processed record count
func (*PerformanceTracker) RecordRetry ¶
func (pt *PerformanceTracker) RecordRetry()
RecordRetry increments the retry count
type PipelineMetrics ¶
type PipelineMetrics struct {
Collector *MetricsCollector
Logger *zap.Logger
// contains filtered or unexported fields
}
PipelineMetrics provides metrics for pipeline operations
func NewPipelineMetrics ¶
func NewPipelineMetrics(pipelineName string) *PipelineMetrics
NewPipelineMetrics creates a new pipeline metrics tracker
func (*PipelineMetrics) GetStats ¶
func (pm *PipelineMetrics) GetStats() map[string]interface{}
GetStats returns current pipeline statistics
func (*PipelineMetrics) RecordError ¶
func (pm *PipelineMetrics) RecordError(operation, errorType string)
RecordError increments the error counter
func (*PipelineMetrics) RecordExtracted ¶
func (pm *PipelineMetrics) RecordExtracted()
RecordExtracted increments the extracted records counter
func (*PipelineMetrics) RecordTransformed ¶
func (pm *PipelineMetrics) RecordTransformed()
RecordTransformed increments the transformed records counter
func (*PipelineMetrics) RecordsLoaded ¶
func (pm *PipelineMetrics) RecordsLoaded(count int)
RecordsLoaded increments the loaded records counter
type RecordMetrics ¶
type RecordMetrics struct {
// contains filtered or unexported fields
}
RecordMetrics provides a convenient interface for common logging patterns
func NewRecordMetrics ¶
func NewRecordMetrics(logger *OperationLogger) *RecordMetrics
NewRecordMetrics creates a new record metrics logger
func (*RecordMetrics) LogProgress ¶
func (rm *RecordMetrics) LogProgress()
LogProgress logs current progress
func (*RecordMetrics) RecordError ¶
func (rm *RecordMetrics) RecordError()
RecordError records an error
func (*RecordMetrics) RecordProcessed ¶
func (rm *RecordMetrics) RecordProcessed(count int, bytes int64)
RecordProcessed records processed records and optionally logs progress
func (*RecordMetrics) SetLogInterval ¶
func (rm *RecordMetrics) SetLogInterval(interval time.Duration)
SetLogInterval sets the interval for progress logging
type SecurityLogger ¶
type SecurityLogger struct {
// contains filtered or unexported fields
}
SecurityLogger provides specialized logging for security events
func NewSecurityLogger ¶
func NewSecurityLogger() *SecurityLogger
NewSecurityLogger creates a new security logger
func (*SecurityLogger) LogAuthEvent ¶
func (sl *SecurityLogger) LogAuthEvent(event string, user string, success bool, details map[string]interface{})
LogAuthEvent logs authentication events
func (*SecurityLogger) LogSecurityViolation ¶
func (sl *SecurityLogger) LogSecurityViolation(violation string, severity string, details map[string]interface{})
LogSecurityViolation logs security violations
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span represents a tracing span with performance optimizations
func (*Span) SetAttribute ¶
SetAttribute adds an attribute to the span (batched for performance)
type StructuredLogger ¶
type StructuredLogger struct {
// contains filtered or unexported fields
}
StructuredLogger provides enhanced structured logging with tracing integration
func NewStructuredLogger ¶
func NewStructuredLogger(connectorType, connectorName string) *StructuredLogger
NewStructuredLogger creates a new structured logger for a connector
func (*StructuredLogger) Debug ¶
func (sl *StructuredLogger) Debug(msg string, fields ...zap.Field)
Debug logs a debug message
func (*StructuredLogger) Error ¶
func (sl *StructuredLogger) Error(msg string, fields ...zap.Field)
Error logs an error message
func (*StructuredLogger) Fatal ¶
func (sl *StructuredLogger) Fatal(msg string, fields ...zap.Field)
Fatal logs a fatal message and exits
func (*StructuredLogger) Info ¶
func (sl *StructuredLogger) Info(msg string, fields ...zap.Field)
Info logs an info message
func (*StructuredLogger) Warn ¶
func (sl *StructuredLogger) Warn(msg string, fields ...zap.Field)
Warn logs a warning message
func (*StructuredLogger) WithContext ¶
func (sl *StructuredLogger) WithContext(ctx context.Context) *ContextLogger
WithContext adds tracing context to log fields
func (*StructuredLogger) WithOperation ¶
func (sl *StructuredLogger) WithOperation(operation string) *OperationLogger
WithOperation adds operation context to the logger
type TracingConfig ¶
type TracingConfig struct {
ServiceName string
ServiceVersion string
Environment string
SamplingRate float64
ExporterType string // "jaeger", "zipkin", "otlp"
ExporterURL string
BatchTimeout time.Duration
MaxExportBatch int
MaxQueueSize int
}
TracingConfig contains tracing configuration