Documentation
¶
Overview ¶
Package telemetry provides logging, metrics, and health.
Package telemetry provides structured logging, Prometheus metrics, and health checks so the gateway itself is observable from day one.
Index ¶
- Constants
- func NewLogger(level slog.Level, jsonOut bool) *slog.Logger
- func RequestID(ctx context.Context) string
- func RequestIDMiddleware(next http.Handler) http.Handler
- type Check
- type Health
- type Metrics
- func (m *Metrics) AddRecordingBytes(n int)
- func (m *Metrics) Handler() http.Handler
- func (m *Metrics) IncAuthzFailure()
- func (m *Metrics) IncSecretAccess()
- func (m *Metrics) ObserveAction(risk, result string, d time.Duration)
- func (m *Metrics) RecordingFailed()
- func (m *Metrics) RecordingFinished()
- func (m *Metrics) RecordingStarted()
- func (m *Metrics) Registry() *prometheus.Registry
- func (m *Metrics) SetChannels(n int)
- func (m *Metrics) SetSessions(n int)
- func (m *Metrics) WSClosed()
- func (m *Metrics) WSOpened()
Constants ¶
const RequestIDHeader = "X-Request-Id"
RequestIDHeader carries a correlation id across the request boundary.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Health ¶
type Health struct {
// contains filtered or unexported fields
}
Health aggregates named liveness/readiness checks behind a status endpoint.
func (*Health) Handler ¶
func (h *Health) Handler() http.HandlerFunc
Handler runs every check and reports overall status. Any failing check yields HTTP 503 so a load balancer can route around an unhealthy instance.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics holds the gateway's Prometheus collectors on a private registry.
func NewMetrics ¶
func NewMetrics() *Metrics
NewMetrics registers the collectors on a fresh registry.
func (*Metrics) AddRecordingBytes ¶
AddRecordingBytes counts bytes written to recordings.
func (*Metrics) IncAuthzFailure ¶
func (m *Metrics) IncAuthzFailure()
IncAuthzFailure counts a denied authorization.
func (*Metrics) IncSecretAccess ¶
func (m *Metrics) IncSecretAccess()
IncSecretAccess counts a secret decryption.
func (*Metrics) ObserveAction ¶
ObserveAction records a handler's latency labelled by risk + result.
func (*Metrics) RecordingFailed ¶
func (m *Metrics) RecordingFailed()
RecordingFailed counts a recording that failed to capture.
func (*Metrics) RecordingFinished ¶
func (m *Metrics) RecordingFinished()
func (*Metrics) RecordingStarted ¶
func (m *Metrics) RecordingStarted()
RecordingStarted / RecordingFinished track active recordings.
func (*Metrics) Registry ¶
func (m *Metrics) Registry() *prometheus.Registry
Registry exposes the underlying registry (for tests or extra collectors).
func (*Metrics) SetChannels ¶
func (*Metrics) SetSessions ¶
SetSessions / SetChannels reflect the live registry counts.