Documentation
¶
Index ¶
- type JSONLogger
- func (l *JSONLogger) Debug(ctx context.Context, message string, fields map[string]interface{})
- func (l *JSONLogger) Error(ctx context.Context, message string, err error, fields map[string]interface{})
- func (l *JSONLogger) Info(ctx context.Context, message string, fields map[string]interface{})
- func (l *JSONLogger) Warn(ctx context.Context, message string, fields map[string]interface{})
- type Logger
- type Metrics
- type NoopSpan
- type NoopTracer
- type PrometheusMetrics
- func (m *PrometheusMetrics) RecordErrorCount(ctx context.Context, errorType string)
- func (m *PrometheusMetrics) RecordIndexCount(ctx context.Context, status string)
- func (m *PrometheusMetrics) RecordIndexLatency(ctx context.Context, duration time.Duration)
- func (m *PrometheusMetrics) RecordQueryCount(ctx context.Context, status string)
- func (m *PrometheusMetrics) RecordQueryLatency(ctx context.Context, duration time.Duration)
- func (m *PrometheusMetrics) Register() error
- type Span
- type SpanContext
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONLogger ¶
type JSONLogger struct {
// contains filtered or unexported fields
}
JSONLogger implements structured logging in JSON format
func (*JSONLogger) Debug ¶
func (l *JSONLogger) Debug(ctx context.Context, message string, fields map[string]interface{})
Debug logs a debug message
func (*JSONLogger) Error ¶
func (l *JSONLogger) Error(ctx context.Context, message string, err error, fields map[string]interface{})
Error logs an error message
type Logger ¶
type Logger interface {
// Info logs an info message
Info(ctx context.Context, message string, fields map[string]interface{})
// Error logs an error message
Error(ctx context.Context, message string, err error, fields map[string]interface{})
// Debug logs a debug message
Debug(ctx context.Context, message string, fields map[string]interface{})
// Warn logs a warning message
Warn(ctx context.Context, message string, fields map[string]interface{})
}
Logger defines the interface for structured logging
type Metrics ¶
type Metrics interface {
// RecordQueryLatency records the latency of a query
RecordQueryLatency(ctx context.Context, duration time.Duration)
// RecordIndexLatency records the latency of an index operation
RecordIndexLatency(ctx context.Context, duration time.Duration)
// RecordQueryCount records the number of queries
RecordQueryCount(ctx context.Context, status string)
// RecordIndexCount records the number of index operations
RecordIndexCount(ctx context.Context, status string)
// RecordErrorCount records the number of errors
RecordErrorCount(ctx context.Context, errorType string)
// Register registers the metrics with Prometheus
Register() error
}
Metrics defines the interface for metrics collection
type NoopSpan ¶
type NoopSpan struct{}
NoopSpan implements a no-op span
func (*NoopSpan) SetAttribute ¶
SetAttribute sets an attribute on the span
type NoopTracer ¶
type NoopTracer struct{}
NoopTracer implements a no-op tracer
type PrometheusMetrics ¶
type PrometheusMetrics struct {
// contains filtered or unexported fields
}
PrometheusMetrics implements metrics collection using Prometheus
func NewPrometheusMetrics ¶
func NewPrometheusMetrics() *PrometheusMetrics
NewPrometheusMetrics creates a new Prometheus metrics collector
func (*PrometheusMetrics) RecordErrorCount ¶
func (m *PrometheusMetrics) RecordErrorCount(ctx context.Context, errorType string)
RecordErrorCount records the number of errors
func (*PrometheusMetrics) RecordIndexCount ¶
func (m *PrometheusMetrics) RecordIndexCount(ctx context.Context, status string)
RecordIndexCount records the number of index operations
func (*PrometheusMetrics) RecordIndexLatency ¶
func (m *PrometheusMetrics) RecordIndexLatency(ctx context.Context, duration time.Duration)
RecordIndexLatency records the latency of an index operation
func (*PrometheusMetrics) RecordQueryCount ¶
func (m *PrometheusMetrics) RecordQueryCount(ctx context.Context, status string)
RecordQueryCount records the number of queries
func (*PrometheusMetrics) RecordQueryLatency ¶
func (m *PrometheusMetrics) RecordQueryLatency(ctx context.Context, duration time.Duration)
RecordQueryLatency records the latency of a query
func (*PrometheusMetrics) Register ¶
func (m *PrometheusMetrics) Register() error
Register registers the metrics with Prometheus
type Span ¶
type Span interface {
// End ends the span
End()
// SetAttribute sets an attribute on the span
SetAttribute(key string, value interface{})
// SetError sets an error on the span
SetError(err error)
}
Span defines the interface for a tracing span
type SpanContext ¶
SpanContext represents the context of a span