Documentation
¶
Index ¶
- func SetProvider(p Provider)
- type NoOpProvider
- func (n *NoOpProvider) DecRequestsInFlight()
- func (n *NoOpProvider) Handler() http.Handler
- func (n *NoOpProvider) IncRequestsInFlight()
- func (n *NoOpProvider) RecordCacheHit(provider string)
- func (n *NoOpProvider) RecordCacheMiss(provider string)
- func (n *NoOpProvider) RecordDBQuery(operation, table string, duration time.Duration, err error)
- func (n *NoOpProvider) RecordEventProcessed(source, eventType, status string, duration time.Duration)
- func (n *NoOpProvider) RecordEventPublished(source, eventType string)
- func (n *NoOpProvider) RecordHTTPRequest(method, path, status string, duration time.Duration)
- func (n *NoOpProvider) RecordPanic(methodName string)
- func (n *NoOpProvider) UpdateCacheSize(provider string, size int64)
- func (n *NoOpProvider) UpdateEventQueueSize(size int64)
- type PrometheusProvider
- func (p *PrometheusProvider) DecRequestsInFlight()
- func (p *PrometheusProvider) Handler() http.Handler
- func (p *PrometheusProvider) IncRequestsInFlight()
- func (p *PrometheusProvider) Middleware(next http.Handler) http.Handler
- func (p *PrometheusProvider) RecordCacheHit(provider string)
- func (p *PrometheusProvider) RecordCacheMiss(provider string)
- func (p *PrometheusProvider) RecordDBQuery(operation, table string, duration time.Duration, err error)
- func (p *PrometheusProvider) RecordHTTPRequest(method, path, status string, duration time.Duration)
- func (p *PrometheusProvider) RecordPanic(methodName string)
- func (p *PrometheusProvider) UpdateCacheSize(provider string, size int64)
- type Provider
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NoOpProvider ¶
type NoOpProvider struct{}
NoOpProvider is a no-op implementation of Provider
func (*NoOpProvider) DecRequestsInFlight ¶
func (n *NoOpProvider) DecRequestsInFlight()
func (*NoOpProvider) Handler ¶
func (n *NoOpProvider) Handler() http.Handler
func (*NoOpProvider) IncRequestsInFlight ¶
func (n *NoOpProvider) IncRequestsInFlight()
func (*NoOpProvider) RecordCacheHit ¶
func (n *NoOpProvider) RecordCacheHit(provider string)
func (*NoOpProvider) RecordCacheMiss ¶
func (n *NoOpProvider) RecordCacheMiss(provider string)
func (*NoOpProvider) RecordDBQuery ¶
func (n *NoOpProvider) RecordDBQuery(operation, table string, duration time.Duration, err error)
func (*NoOpProvider) RecordEventProcessed ¶ added in v0.0.107
func (n *NoOpProvider) RecordEventProcessed(source, eventType, status string, duration time.Duration)
func (*NoOpProvider) RecordEventPublished ¶ added in v0.0.107
func (n *NoOpProvider) RecordEventPublished(source, eventType string)
func (*NoOpProvider) RecordHTTPRequest ¶
func (n *NoOpProvider) RecordHTTPRequest(method, path, status string, duration time.Duration)
func (*NoOpProvider) RecordPanic ¶ added in v0.0.122
func (n *NoOpProvider) RecordPanic(methodName string)
func (*NoOpProvider) UpdateCacheSize ¶
func (n *NoOpProvider) UpdateCacheSize(provider string, size int64)
func (*NoOpProvider) UpdateEventQueueSize ¶ added in v0.0.107
func (n *NoOpProvider) UpdateEventQueueSize(size int64)
type PrometheusProvider ¶
type PrometheusProvider struct {
// contains filtered or unexported fields
}
PrometheusProvider implements the Provider interface using Prometheus
func NewPrometheusProvider ¶
func NewPrometheusProvider() *PrometheusProvider
NewPrometheusProvider creates a new Prometheus metrics provider
func (*PrometheusProvider) DecRequestsInFlight ¶
func (p *PrometheusProvider) DecRequestsInFlight()
DecRequestsInFlight implements Provider interface
func (*PrometheusProvider) Handler ¶
func (p *PrometheusProvider) Handler() http.Handler
Handler implements Provider interface
func (*PrometheusProvider) IncRequestsInFlight ¶
func (p *PrometheusProvider) IncRequestsInFlight()
IncRequestsInFlight implements Provider interface
func (*PrometheusProvider) Middleware ¶
func (p *PrometheusProvider) Middleware(next http.Handler) http.Handler
Middleware returns an HTTP middleware that collects metrics
func (*PrometheusProvider) RecordCacheHit ¶
func (p *PrometheusProvider) RecordCacheHit(provider string)
RecordCacheHit implements Provider interface
func (*PrometheusProvider) RecordCacheMiss ¶
func (p *PrometheusProvider) RecordCacheMiss(provider string)
RecordCacheMiss implements Provider interface
func (*PrometheusProvider) RecordDBQuery ¶
func (p *PrometheusProvider) RecordDBQuery(operation, table string, duration time.Duration, err error)
RecordDBQuery implements Provider interface
func (*PrometheusProvider) RecordHTTPRequest ¶
func (p *PrometheusProvider) RecordHTTPRequest(method, path, status string, duration time.Duration)
RecordHTTPRequest implements Provider interface
func (*PrometheusProvider) RecordPanic ¶ added in v0.0.122
func (p *PrometheusProvider) RecordPanic(methodName string)
RecordPanic implements the Provider interface
func (*PrometheusProvider) UpdateCacheSize ¶
func (p *PrometheusProvider) UpdateCacheSize(provider string, size int64)
UpdateCacheSize implements Provider interface
type Provider ¶
type Provider interface {
// RecordHTTPRequest records metrics for an HTTP request
RecordHTTPRequest(method, path, status string, duration time.Duration)
// IncRequestsInFlight increments the in-flight requests counter
IncRequestsInFlight()
// DecRequestsInFlight decrements the in-flight requests counter
DecRequestsInFlight()
// RecordDBQuery records metrics for a database query
RecordDBQuery(operation, table string, duration time.Duration, err error)
// RecordCacheHit records a cache hit
RecordCacheHit(provider string)
// RecordCacheMiss records a cache miss
RecordCacheMiss(provider string)
// UpdateCacheSize updates the cache size metric
UpdateCacheSize(provider string, size int64)
// RecordEventPublished records an event publication
RecordEventPublished(source, eventType string)
// RecordEventProcessed records an event processing with its status
RecordEventProcessed(source, eventType, status string, duration time.Duration)
// UpdateEventQueueSize updates the event queue size metric
UpdateEventQueueSize(size int64)
// RecordPanic records a panic event
RecordPanic(methodName string)
// Handler returns an HTTP handler for exposing metrics (e.g., /metrics endpoint)
Handler() http.Handler
}
Provider defines the interface for metric collection
type ResponseWriter ¶
type ResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
ResponseWriter wraps http.ResponseWriter to capture status code
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter) *ResponseWriter
func (*ResponseWriter) WriteHeader ¶
func (rw *ResponseWriter) WriteHeader(code int)