opevents

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicAlertConsecutiveFailure   = "alert.destination.consecutive_failure"
	TopicAlertDestinationDisabled  = "alert.destination.disabled"
	TopicAlertExhaustedRetries     = "alert.attempt.exhausted_retries"
	TopicTenantSubscriptionUpdated = "tenant.subscription.updated"
)

Topic constants for operator events.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSSQSSinkConfig

type AWSSQSSinkConfig struct {
	QueueURL        string
	AccessKeyID     string `json:"-"`
	SecretAccessKey string `json:"-"`
	Region          string
	Endpoint        string // optional, for local dev
}

type Config

type Config struct {
	Topics []string

	// Sink configs — at most one should be set. Presence determines sink type.
	HTTP      *HTTPSinkConfig
	AWSSQS    *AWSSQSSinkConfig
	GCPPubSub *GCPPubSubSinkConfig
	RabbitMQ  *RabbitMQSinkConfig
}

Config holds the configuration for the operator events system. yaml/env tags live in internal/config; this is the domain-level struct.

type Emitter

type Emitter interface {
	Emit(ctx context.Context, topic string, tenantID string, data any) error
}

Emitter is the interface for emitting operator events.

func NewEmitter

func NewEmitter(sink Sink, deploymentID string, topics []string) Emitter

NewEmitter creates an Emitter that filters by topics, builds the envelope, and delegates to the provided Sink. If topics contains "*", all topics are accepted. If topics is empty, a noop emitter is returned.

type GCPPubSubSinkConfig

type GCPPubSubSinkConfig struct {
	ProjectID                 string
	TopicID                   string
	ServiceAccountCredentials string `json:"-"`
}

type HTTPSink

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

HTTPSink sends operator events via HTTP POST with optional HMAC-SHA256 signing.

func NewHTTPSink

func NewHTTPSink(url, signingSecret string) *HTTPSink

NewHTTPSink creates an HTTP sink. If signingSecret is non-empty, each request body is signed with HMAC-SHA256 and the signature is sent in the X-Outpost-Signature header.

func (*HTTPSink) Close

func (s *HTTPSink) Close() error

func (*HTTPSink) Init

func (s *HTTPSink) Init(ctx context.Context) error

func (*HTTPSink) Send

func (s *HTTPSink) Send(ctx context.Context, event *OperatorEvent) error

type HTTPSinkConfig

type HTTPSinkConfig struct {
	URL           string
	SigningSecret string `json:"-"`
}

type MQSink

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

MQSink sends operator events to a message queue via mqs.Queue.

func NewMQSink

func NewMQSink(queue mqs.Queue) *MQSink

NewMQSink creates a sink that publishes events to the given queue.

func (*MQSink) Close

func (s *MQSink) Close() error

func (*MQSink) Init

func (s *MQSink) Init(ctx context.Context) error

func (*MQSink) Send

func (s *MQSink) Send(ctx context.Context, event *OperatorEvent) error

type NoopSink

type NoopSink struct{}

NoopSink is a sink that discards all events. Used when no sink is configured.

func (*NoopSink) Close

func (s *NoopSink) Close() error

func (*NoopSink) Init

func (s *NoopSink) Init(ctx context.Context) error

func (*NoopSink) Send

func (s *NoopSink) Send(ctx context.Context, event *OperatorEvent) error

type OperatorEvent

type OperatorEvent struct {
	ID           string          `json:"id"`
	Topic        string          `json:"topic"`
	Time         time.Time       `json:"time"`
	DeploymentID string          `json:"deployment_id,omitempty"`
	TenantID     string          `json:"tenant_id,omitempty"`
	Data         json.RawMessage `json:"data"`
}

OperatorEvent is the envelope for all operator events emitted by Outpost.

type RabbitMQSinkConfig

type RabbitMQSinkConfig struct {
	ServerURL string
	Exchange  string
}

type Sink

type Sink interface {
	Init(ctx context.Context) error
	Send(ctx context.Context, event *OperatorEvent) error
	Close() error
}

Sink is the interface for delivering operator events to an external system.

func NewSink

func NewSink(cfg Config, logger *logging.Logger) (Sink, error)

NewSink returns the appropriate Sink based on config. Returns NoopSink if no sink is configured. If topics are specified but no sink is configured, it logs a warning and returns NoopSink (operator events will be dropped).

Jump to

Keyboard shortcuts

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