events

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingFields = errors.New("missing_fields")

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Timestamp string          `json:"timestamp"`
	TraceID   string          `json:"trace_id,omitempty"`
	Source    string          `json:"source"`
	EventType string          `json:"event_type"`
	Payload   json.RawMessage `json:"payload"`
}

Envelope is the shared Sentinel event transport contract.

func NewEnvelope

func NewEnvelope(source, eventType string, payload any, now time.Time) (Envelope, error)

NewEnvelope builds a transport envelope from a structured payload.

func (*Envelope) EnsureTimestamp

func (e *Envelope) EnsureTimestamp(now time.Time)

EnsureTimestamp fills an empty timestamp with the provided time.

func (*Envelope) SetTraceID

func (e *Envelope) SetTraceID(traceID string)

SetTraceID records the trace ID that can be used to link the stored event row back to the distributed trace.

func (Envelope) TimestampTime

func (e Envelope) TimestampTime(now time.Time) time.Time

TimestampTime parses the transport timestamp, falling back to now on malformed input.

func (Envelope) Validate

func (e Envelope) Validate() error

Validate checks the required event envelope fields.

Jump to

Keyboard shortcuts

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