observability

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 3 Imported by: 0

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

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

func (o *CountingObserver) RecordMigration(_, _ string, _ int64, _ time.Duration, _ error)

RecordMigration implements [stats.SQLObserver].

func (*CountingObserver) RecordPublish

func (o *CountingObserver) RecordPublish(_ string, success bool, _ time.Duration)

RecordPublish implements [stats.Observer].

func (*CountingObserver) RecordRequest

func (o *CountingObserver) RecordRequest(_ string, _ string, status int, _ time.Duration)

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].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL