Documentation
¶
Index ¶
- func ClientAttributes(clientID string, metadata map[string]string) []attribute.KeyValue
- func ContextWithSpan(ctx context.Context, span trace.Span) context.Context
- func Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context
- func HTTPMiddleware(metrics *Metrics, tracer *Tracer) func(http.Handler) http.Handler
- func Inject(ctx context.Context, carrier propagation.TextMapCarrier)
- func MessageAttributes(messageID, queue, msgType string, priority int) []attribute.KeyValue
- func MetricsHandler() http.Handler
- func QueueAttributes(queueName string, queueType string) []attribute.KeyValue
- func RecordError(span trace.Span, err error)
- func RequestLogger(metrics *Metrics) func(http.Handler) http.Handler
- func SetOK(span trace.Span)
- func SpanFromContext(ctx context.Context) trace.Span
- func WithContext(ctx context.Context, m *Metrics) context.Context
- func WithTracer(ctx context.Context, tracer *Tracer) context.Context
- type Metrics
- func (m *Metrics) RecordDequeue(queue, priority string)
- func (m *Metrics) RecordEnqueue(queue, priority string)
- func (m *Metrics) RecordError(errorType, operation string)
- func (m *Metrics) RecordGRPCRequest(method, status string, duration time.Duration)
- func (m *Metrics) RecordHTTPRequest(method, endpoint, status string, duration time.Duration, reqSize, respSize int)
- func (m *Metrics) RecordMessageProcessed(queue, msgType, status string, duration time.Duration)
- func (m *Metrics) RecordMessageSize(queue, msgType string, size int)
- func (m *Metrics) RecordStoreOperation(operation string, success bool, duration time.Duration)
- func (m *Metrics) UpdateClientConnections(clientType string, delta int)
- func (m *Metrics) UpdateGRPCStreams(method string, delta int)
- func (m *Metrics) UpdateQueueDepth(queue string, priority string, depth int)
- type Timer
- type Tracer
- type TracingConfig
- type TracingPropagator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientAttributes ¶
ClientAttributes returns common client attributes for tracing
func ContextWithSpan ¶
ContextWithSpan returns a new context with the given span
func Extract ¶
func Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context
Extract extracts trace context from carrier
func HTTPMiddleware ¶
HTTPMiddleware provides HTTP metrics and tracing middleware
func Inject ¶
func Inject(ctx context.Context, carrier propagation.TextMapCarrier)
Inject injects trace context into carrier
func MessageAttributes ¶
MessageAttributes returns common message attributes for tracing
func MetricsHandler ¶
MetricsHandler returns an HTTP handler for Prometheus metrics
func QueueAttributes ¶
QueueAttributes returns common queue attributes for tracing
func RecordError ¶
RecordError records an error on the span
func RequestLogger ¶
RequestLogger provides request logging with metrics
func SpanFromContext ¶
SpanFromContext returns the current span from context
func WithContext ¶
WithContext adds metrics to context
Types ¶
type Metrics ¶
type Metrics struct {
// Message metrics
MessagesProcessed *prometheus.CounterVec
MessageDuration *prometheus.HistogramVec
MessagesInFlight *prometheus.GaugeVec
MessageSize *prometheus.HistogramVec
// Queue metrics
QueueDepth *prometheus.GaugeVec
QueueCapacity *prometheus.GaugeVec
EnqueueRate *prometheus.CounterVec
DequeueRate *prometheus.CounterVec
// Client metrics
ClientConnections *prometheus.GaugeVec
ClientHeartbeats *prometheus.CounterVec
ClientSubscriptions *prometheus.GaugeVec
// Error metrics
ErrorsTotal *prometheus.CounterVec
RetryAttempts *prometheus.CounterVec
DeadLetterMessages *prometheus.CounterVec
// Store metrics
StoreOperations *prometheus.CounterVec
StoreLatency *prometheus.HistogramVec
StoreSize prometheus.Gauge
// System metrics
WorkerPoolSize *prometheus.GaugeVec
ActiveWorkers *prometheus.GaugeVec
BatchSize *prometheus.HistogramVec
// gRPC metrics (if enabled)
GRPCRequests *prometheus.CounterVec
GRPCDuration *prometheus.HistogramVec
GRPCStreamActive *prometheus.GaugeVec
// HTTP metrics
HTTPRequests *prometheus.CounterVec
HTTPDuration *prometheus.HistogramVec
HTTPRequestSize *prometheus.HistogramVec
HTTPResponseSize *prometheus.HistogramVec
}
Metrics holds all AMQ metrics
func FromContext ¶
FromContext retrieves metrics from context
func NewMetrics ¶
NewMetrics creates a new metrics instance
func (*Metrics) RecordDequeue ¶
RecordDequeue records message dequeue
func (*Metrics) RecordEnqueue ¶
RecordEnqueue records message enqueue
func (*Metrics) RecordError ¶
RecordError records an error
func (*Metrics) RecordGRPCRequest ¶
RecordGRPCRequest records a gRPC request
func (*Metrics) RecordHTTPRequest ¶
func (m *Metrics) RecordHTTPRequest(method, endpoint, status string, duration time.Duration, reqSize, respSize int)
RecordHTTPRequest records an HTTP request
func (*Metrics) RecordMessageProcessed ¶
RecordMessageProcessed records a processed message
func (*Metrics) RecordMessageSize ¶
RecordMessageSize records message size
func (*Metrics) RecordStoreOperation ¶
RecordStoreOperation records a store operation
func (*Metrics) UpdateClientConnections ¶
UpdateClientConnections updates client connection count
func (*Metrics) UpdateGRPCStreams ¶
UpdateGRPCStreams updates active gRPC stream count
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer provides a convenient way to time operations
func (*Timer) ObserveDuration ¶
ObserveDuration records the duration since timer creation
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer wraps OpenTelemetry tracer
func NewTracer ¶
func NewTracer(config TracingConfig) (*Tracer, error)
NewTracer creates a new tracer instance
func TracerFromContext ¶
TracerFromContext retrieves tracer from context
type TracingConfig ¶
type TracingConfig struct {
Enabled bool
Endpoint string
ServiceName string
SamplingRate float64
Insecure bool
}
TracingConfig holds tracing configuration
func DefaultTracingConfig ¶
func DefaultTracingConfig() TracingConfig
DefaultTracingConfig returns default tracing configuration
type TracingPropagator ¶
type TracingPropagator struct {
// contains filtered or unexported fields
}
TracingPropagator provides HTTP trace propagation
func NewTracingPropagator ¶
func NewTracingPropagator(tracer *Tracer) *TracingPropagator
NewTracingPropagator creates a new tracing propagator
func (*TracingPropagator) Extract ¶
func (tp *TracingPropagator) Extract(r *http.Request) *http.Request
Extract extracts trace context from HTTP headers
func (*TracingPropagator) Inject ¶
func (tp *TracingPropagator) Inject(r *http.Request)
Inject injects trace context into HTTP headers