observability

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package observability defines bounded library observation events without binding protocol code to a telemetry implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Observe

func Observe(ctx context.Context, sink Sink, event Event)

Observe contains sink panics and rejects invalid inputs.

Types

type Algorithm

type Algorithm uint8

Algorithm identifies a closed signature algorithm family.

const (
	// AlgorithmNone indicates that no algorithm fact applies.
	AlgorithmNone Algorithm = iota + 1
	// AlgorithmRSA identifies RSA-SHA256.
	AlgorithmRSA
	// AlgorithmEd25519 identifies Ed25519-SHA256.
	AlgorithmEd25519
	// AlgorithmUnknown identifies a bounded unsupported family.
	AlgorithmUnknown
	// AlgorithmMLDSA44 identifies pure ML-DSA-44. It is appended after
	// AlgorithmUnknown so existing numeric values stay stable.
	AlgorithmMLDSA44
)

type Bucket

type Bucket uint8

Bucket identifies a bounded duration, size, or count bucket.

const (
	// BucketNone indicates that the optional bucket is disabled or unavailable.
	BucketNone Bucket = iota + 1
	// BucketSmall identifies the smallest bounded class.
	BucketSmall
	// BucketMedium identifies the middle bounded class.
	BucketMedium
	// BucketLarge identifies the largest bounded class.
	BucketLarge
	// BucketOverflow identifies values above the largest regular class.
	BucketOverflow
)

type CacheResult

type CacheResult uint8

CacheResult identifies one bounded cache outcome.

const (
	// CacheNotUsed indicates that no cache fact applies.
	CacheNotUsed CacheResult = iota + 1
	// CacheHit identifies a cache hit.
	CacheHit
	// CacheMiss identifies a cache miss.
	CacheMiss
)

type ErrorClass

type ErrorClass uint8

ErrorClass identifies a bounded failure class without carrying an error.

const (
	// ErrorNone indicates that no error class applies.
	ErrorNone ErrorClass = iota + 1
	// ErrorCanceled identifies caller cancellation.
	ErrorCanceled
	// ErrorDeadline identifies deadline exhaustion.
	ErrorDeadline
	// ErrorTemporary identifies a classified temporary dependency failure.
	ErrorTemporary
	// ErrorPermanent identifies a classified permanent dependency failure.
	ErrorPermanent
	// ErrorInternal identifies a contained invariant failure.
	ErrorInternal
)

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event is one immutable validated library observation.

func NewEvent

func NewEvent(kind Kind, operation Operation, result Result, reason Reason, errorClass ErrorClass, algorithm Algorithm, cache CacheResult, duration, message, recipients, signatures, chain Bucket) (Event, bool)

NewEvent constructs one exact event after validating every closed fact.

func (Event) Algorithm

func (e Event) Algorithm() Algorithm

Algorithm returns the closed algorithm family.

func (Event) CacheResult

func (e Event) CacheResult() CacheResult

CacheResult returns the bounded cache outcome.

func (Event) ChainLengthBucket

func (e Event) ChainLengthBucket() Bucket

ChainLengthBucket returns the optional chain-length class.

func (Event) DurationBucket

func (e Event) DurationBucket() Bucket

DurationBucket returns the bounded duration class.

func (Event) ErrorClass

func (e Event) ErrorClass() ErrorClass

ErrorClass returns the closed error class.

func (Event) Format

func (Event) Format(state fmt.State, _ rune)

Format prevents formatting from traversing event state.

func (Event) GoString

func (Event) GoString() string

GoString returns a constant representation without event facts.

func (Event) Kind

func (e Event) Kind() Kind

Kind returns the closed event kind.

func (Event) MessageSizeBucket

func (e Event) MessageSizeBucket() Bucket

MessageSizeBucket returns the optional message-size class.

func (Event) Operation

func (e Event) Operation() Operation

Operation returns the closed operation family.

func (Event) Reason

func (e Event) Reason() Reason

Reason returns the closed reason class.

func (Event) RecipientCountBucket

func (e Event) RecipientCountBucket() Bucket

RecipientCountBucket returns the optional recipient-count class.

func (Event) Result

func (e Event) Result() Result

Result returns the closed result class.

func (Event) SignatureCountBucket

func (e Event) SignatureCountBucket() Bucket

SignatureCountBucket returns the optional signature-count class.

func (Event) String

func (Event) String() string

String returns a constant representation without event facts.

func (Event) Valid

func (e Event) Valid() bool

Valid reports whether all event facts belong to the exact closed grammar.

type Kind

type Kind uint8

Kind identifies one library-owned observation point.

const (
	// KindVerifyCompleted records a completed verification operation.
	KindVerifyCompleted Kind = iota + 1
	// KindDNSLookupCompleted records a completed DNS public-key lookup.
	KindDNSLookupCompleted
)

type NoopSink

type NoopSink struct{}

NoopSink discards observations.

func (NoopSink) Observe

func (NoopSink) Observe(context.Context, Event)

Observe discards one bounded event.

type Operation

type Operation uint8

Operation identifies the closed operation family.

const (
	// OperationVerify identifies DKIM2 verification.
	OperationVerify Operation = iota + 1
	// OperationDNSLookup identifies DNS public-key lookup.
	OperationDNSLookup
)

type Reason

type Reason uint8

Reason identifies a bounded non-error outcome reason.

const (
	// ReasonNone indicates that no reason class applies.
	ReasonNone Reason = iota + 1
	// ReasonProtocol identifies a protocol-defined negative outcome.
	ReasonProtocol
	// ReasonPolicy identifies a local policy outcome.
	ReasonPolicy
	// ReasonUnavailable identifies required unavailable state.
	ReasonUnavailable
)

type Result

type Result uint8

Result identifies a bounded operational result class.

const (
	// ResultSuccess identifies a successful completed operation.
	ResultSuccess Result = iota + 1
	// ResultFailure identifies a completed protocol or provider failure.
	ResultFailure
	// ResultTemporary identifies a bounded temporary failure.
	ResultTemporary
	// ResultInternal identifies a contained internal failure.
	ResultInternal
)

type Sink

type Sink interface {
	Observe(context.Context, Event)
}

Sink receives immutable bounded observations.

Jump to

Keyboard shortcuts

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