eventing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertEventType   MdaiEventType = "alert"
	VarEventType     MdaiEventType = "var"
	TriggerEventType MdaiEventType = "trigger.vars"

	AlertConsumerGroupName   MdaiEventConsumerGroup = "alert-consumer-group"
	VarsConsumerGroupName    MdaiEventConsumerGroup = "vars-consumer-group"
	TriggerConsumerGroupName MdaiEventConsumerGroup = "trigger-consumers"

	ManualVariablesEventSource  = "manual_variables_api"
	PrometheusAlertsEventSource = "prometheus"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerInvoker

type HandlerInvoker func(event MdaiEvent) error

HandlerInvoker is a function type that processes MdaiEvents.

type MdaiEvent

type MdaiEvent struct {
	ID             string    `json:"id,omitempty"`
	Name           string    `json:"name"`    // e.g. "alert_firing"
	Version        int       `json:"version"` // schema version
	Timestamp      time.Time `json:"timestamp,omitempty"`
	Payload        string    `json:"payload"`
	Source         string    `json:"source"`    // used in subject, could not be empty
	SourceID       string    `json:"source_id"` // ex alert fingerprint
	CorrelationID  string    `json:"correlation_id,omitempty"`
	HubName        string    `json:"hub_name"`
	RecursionDepth int       `json:"recursion_depth,omitempty"` // recursion depth limit for events
}

MdaiEvent represents an event in the system.

func NewMdaiEvent

func NewMdaiEvent(hubName string, varName string, varType string, action string, payload any) (*MdaiEvent, error)

func (*MdaiEvent) ApplyDefaults

func (mdaiEvent *MdaiEvent) ApplyDefaults()

func (*MdaiEvent) MarshalLogObject

func (mdaiEvent *MdaiEvent) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject signature requires it to return an error, but there's no way the code will generate one.

func (*MdaiEvent) Validate

func (mdaiEvent *MdaiEvent) Validate() error

type MdaiEventConsumerGroup

type MdaiEventConsumerGroup string

func (MdaiEventConsumerGroup) String

func (consumerGroup MdaiEventConsumerGroup) String() string

type MdaiEventSubject

type MdaiEventSubject struct {
	// The specific MDAI Event stream this event belongs. Joined to Path with "."
	Type MdaiEventType
	// The path after the stream. Joined to preceding Type with "."
	Path string
}

func NewMdaiEventSubject

func NewMdaiEventSubject(stream MdaiEventType, path string) MdaiEventSubject

func (MdaiEventSubject) PrefixedString

func (subject MdaiEventSubject) PrefixedString(prefix string) string

func (MdaiEventSubject) String

func (subject MdaiEventSubject) String() string

type MdaiEventType

type MdaiEventType string

func (MdaiEventType) String

func (eventType MdaiEventType) String() string

type VariablesActionPayload

type VariablesActionPayload struct {
	VariableRef string `json:"variableRef"`
	DataType    string `json:"dataType"`
	Operation   string `json:"operation"`
	Data        any    `json:"data"`
}

VariablesActionPayload represents a payload for static variables actions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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