observing

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package observing defines the transport-neutral event intake facade.

Integrations turn webhook deliveries, chat messages, mail, and polling results into Observation values. They do not need to know how an optional event implementation deduplicates, correlates, or schedules triage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Name          string
	Authenticated bool
}

Actor is the party an observation says caused it. Authenticated is kept next to the name so an allow-list can never accidentally trust a name that was merely copied from an unverified payload.

func AuthenticatedActor

func AuthenticatedActor(name string) *Actor

AuthenticatedActor constructs a verified actor, or nil for a blank name.

func ClaimedActor

func ClaimedActor(name string) *Actor

ClaimedActor constructs an explicitly unverified actor.

func (*Actor) AuthenticatedName

func (a *Actor) AuthenticatedName() string

AuthenticatedName returns a name suitable for security decisions.

func (*Actor) String

func (a *Actor) String() string

type EventIntake

type EventIntake interface {
	Observe(Observation) error
}

EventIntake receives normalized or raw observations. Implementations should validate at their boundary and return errors rather than silently dropping malformed deliveries.

type EventIntakes

type EventIntakes []EventIntake

EventIntakes fans one observation out to multiple independent consumers. Each intake gets the same value, and an error from one does not prevent the others from observing it. The returned error is an aggregate with enough context to identify every failed consumer.

func (EventIntakes) Observe

func (all EventIntakes) Observe(observation Observation) error

Observe fans out to all configured intakes.

type Observation

type Observation struct {
	Source         string
	DeliveryID     string
	Kind           string
	CorrelationKey string
	Title          string
	Summary        string
	PayloadJSON    string
	ObservedAt     time.Time
	Route          Route
	Actor          *Actor
}

Observation is one external event in a transport-neutral form.

func (Observation) Normalize

func (o Observation) Normalize(now time.Time) (Observation, error)

Normalize fills transport-neutral defaults and trims policy keys. It does not invent a delivery or correlation id.

func (Observation) Validate

func (o Observation) Validate() error

Validate checks the identity fields required for durable deduplication and deterministic correlation.

type Route

type Route struct {
	ChatID   string
	ChatType string
	GroupID  string
	TenantID string
}

Route says where an event-related run may talk and which shared scopes it belongs to. An empty route is valid for machine-only observations.

var NoRoute Route

NoRoute is the zero route, named for call sites that want to be explicit.

func (Route) IsEmpty

func (r Route) IsEmpty() bool

IsEmpty reports whether the route has no destination chat.

Jump to

Keyboard shortcuts

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