driver

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package driver defines the interface for monitoring service implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlarmConfig

type AlarmConfig struct {
	Name                    string
	Namespace               string
	MetricName              string
	Dimensions              map[string]string
	ComparisonOperator      string // "GreaterThanThreshold", "LessThanThreshold", etc.
	Threshold               float64
	Period                  int
	EvaluationPeriods       int
	Stat                    string
	AlarmActions            []string // channel IDs to notify on ALARM
	OKActions               []string // channel IDs to notify on OK
	InsufficientDataActions []string // channel IDs to notify on INSUFFICIENT_DATA
}

AlarmConfig describes an alarm to create.

type AlarmHistoryEntry added in v1.4.0

type AlarmHistoryEntry struct {
	AlarmName string
	Timestamp time.Time
	OldState  string
	NewState  string
	Reason    string
}

AlarmHistoryEntry describes a state change or action in alarm history.

type AlarmInfo

type AlarmInfo struct {
	Name               string
	Namespace          string
	MetricName         string
	State              string // "OK", "ALARM", "INSUFFICIENT_DATA"
	ComparisonOperator string
	Threshold          float64
}

AlarmInfo describes an alarm.

type GetMetricInput

type GetMetricInput struct {
	Namespace  string
	MetricName string
	Dimensions map[string]string
	StartTime  time.Time
	EndTime    time.Time
	Period     int    // seconds
	Stat       string // "Average", "Sum", "Minimum", "Maximum", "SampleCount"
}

GetMetricInput configures a metric retrieval operation.

type MetricDataResult

type MetricDataResult struct {
	Timestamps []time.Time
	Values     []float64
}

MetricDataResult is a set of metric data points.

type MetricDatum

type MetricDatum struct {
	Namespace  string
	MetricName string
	Value      float64
	Unit       string
	Dimensions map[string]string
	Timestamp  time.Time
}

MetricDatum is a single metric data point.

type Monitoring

type Monitoring interface {
	PutMetricData(ctx context.Context, data []MetricDatum) error
	GetMetricData(ctx context.Context, input GetMetricInput) (*MetricDataResult, error)
	ListMetrics(ctx context.Context, namespace string) ([]string, error)

	CreateAlarm(ctx context.Context, config AlarmConfig) error
	DeleteAlarm(ctx context.Context, name string) error
	DescribeAlarms(ctx context.Context, names []string) ([]AlarmInfo, error)
	SetAlarmState(ctx context.Context, name, state, reason string) error

	// Notification Channels
	CreateNotificationChannel(ctx context.Context, config NotificationChannelConfig) (*NotificationChannelInfo, error)
	DeleteNotificationChannel(ctx context.Context, id string) error
	GetNotificationChannel(ctx context.Context, id string) (*NotificationChannelInfo, error)
	ListNotificationChannels(ctx context.Context) ([]NotificationChannelInfo, error)

	// Alarm History
	GetAlarmHistory(ctx context.Context, alarmName string, limit int) ([]AlarmHistoryEntry, error)
}

Monitoring is the interface that monitoring provider implementations must satisfy.

type NotificationChannelConfig added in v1.4.0

type NotificationChannelConfig struct {
	Name     string
	Type     string // "email", "webhook", "queue", "function"
	Endpoint string
	Tags     map[string]string
}

NotificationChannelConfig describes a notification channel.

type NotificationChannelInfo added in v1.4.0

type NotificationChannelInfo struct {
	ID       string
	Name     string
	Type     string
	Endpoint string
	Tags     map[string]string
}

NotificationChannelInfo describes a notification channel.

Jump to

Keyboard shortcuts

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