alerta

package
v1.7.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Resource    string      `json:"resource"`    // warehouse-upload-aborted
	Event       string      `json:"event"`       // <tags_list>
	Environment Environment `json:"environment"` // [PRODUCTION,DEVELOPMENT,PROXYMODE,CARBONCOPY]
	Severity    Severity    `json:"severity"`    // warning,critical,normal // Get the full list from https://docs.alerta.io/api/alert.html#severity-table
	Text        string      `json:"text"`        // <event> is critical
	Timeout     int         `json:"timeout"`     // 86400
	TagList     []string    `json:"tags"`        // {priority=P1,destID=27CHciD6leAhurSyFAeN4dp14qZ,destType=RS,namespace=hosted,cluster=rudder}
}

type AlertSender

type AlertSender interface {
	SendAlert(ctx context.Context, resource string, opts SendAlertOpts) error
}

func NewClient

func NewClient(baseURL string, fns ...OptFn) AlertSender

type Client

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

func (*Client) SendAlert

func (c *Client) SendAlert(ctx context.Context, resource string, opts SendAlertOpts) error

type Environment

type Environment string
const (
	PRODUCTION  Environment = "PRODUCTION"
	DEVELOPMENT Environment = "DEVELOPMENT"
	PROXYMODE   Environment = "PROXYMODE"
	CARBONCOPY  Environment = "CARBONCOPY"
)

type NOOP

type NOOP struct{}

NOOP alerta implementation that does nothing

func (*NOOP) SendAlert

func (*NOOP) SendAlert(context.Context, string, SendAlertOpts) error

type OptFn

type OptFn func(*Client)

func WithAlertTimeout

func WithAlertTimeout(timeout int) OptFn

func WithConfig

func WithConfig(config *config.Config) OptFn

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) OptFn

func WithKubeNamespace

func WithKubeNamespace(namespace string) OptFn

func WithMaxRetries

func WithMaxRetries(retries int) OptFn

func WithTimeout

func WithTimeout(timeout time.Duration) OptFn

type Priority

type Priority string
const (
	PriorityP1 Priority = "P1"
	PriorityP2 Priority = "P2"
	PriorityP3 Priority = "P3"
)

type SendAlertOpts

type SendAlertOpts struct {
	Tags        Tags
	Text        string
	Severity    Severity
	Priority    Priority
	Environment Environment
}

type Severity

type Severity string
const (
	SeverityCritical Severity = "critical"
	SeverityWarning  Severity = "warning"
	SeverityNormal   Severity = "normal"
	SeverityOk       Severity = "ok"
)

type Tags

type Tags map[string]string

Jump to

Keyboard shortcuts

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