Documentation
¶
Overview ¶
Package observability holds the cross-cutting observer for the sensor service. One CountingObserver instance is fanned out (stats.NewFanout) with a LoggingObserver in main() and stored once in the context — every adapter (HTTP, MQTT, SQL, file, stream) resolves it automatically when its Options.Observer is nil.
Index ¶
- type CountingObserver
- func (o *CountingObserver) Print()
- func (o *CountingObserver) RecordMigration(_, _ string, _ int64, _ time.Duration, _ error)
- func (o *CountingObserver) RecordPublish(_ string, success bool, _ time.Duration)
- func (o *CountingObserver) RecordRequest(_ string, _ string, status int, _ time.Duration)
- func (o *CountingObserver) RecordStreamItem(_ string, success bool, _ time.Duration)
- func (o *CountingObserver) RecordSubscribe(_ string, success bool, _ time.Duration)
- func (o *CountingObserver) RecordValidation(_, _ string, _ time.Duration, _ error)
- func (o *CountingObserver) RecordValidationError(location, _, _ string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountingObserver ¶
type CountingObserver struct {
// contains filtered or unexported fields
}
CountingObserver is an in-memory [stats.Observer] + [stats.SQLObserver] + [stats.StreamObserver]. In production replace the maps and counters with Prometheus CounterVecs or OpenTelemetry instruments — the interface methods are identical.
func NewCountingObserver ¶
func NewCountingObserver() *CountingObserver
NewCountingObserver returns a ready-to-use CountingObserver.
func (*CountingObserver) Print ¶
func (o *CountingObserver) Print()
Print writes the counters summary to stdout.
func (*CountingObserver) RecordMigration ¶
RecordMigration implements [stats.SQLObserver].
func (*CountingObserver) RecordPublish ¶
func (o *CountingObserver) RecordPublish(_ string, success bool, _ time.Duration)
RecordPublish implements [stats.Observer].
func (*CountingObserver) RecordRequest ¶
RecordRequest implements [stats.Observer].
func (*CountingObserver) RecordStreamItem ¶
func (o *CountingObserver) RecordStreamItem(_ string, success bool, _ time.Duration)
RecordStreamItem implements [stats.StreamObserver].
func (*CountingObserver) RecordSubscribe ¶
func (o *CountingObserver) RecordSubscribe(_ string, success bool, _ time.Duration)
RecordSubscribe implements [stats.Observer].
func (*CountingObserver) RecordValidation ¶
func (o *CountingObserver) RecordValidation(_, _ string, _ time.Duration, _ error)
RecordValidation implements [stats.SQLObserver].
func (*CountingObserver) RecordValidationError ¶
func (o *CountingObserver) RecordValidationError(location, _, _ string)
RecordValidationError implements [stats.Observer].