notifications

package
v1.7.24 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartEvaluator

func StartEvaluator(ctx context.Context)

Types

type Adapter

type Adapter interface {
	Type() string
	Send(ctx context.Context, msg Message) error
	Validate() error
}

func NewAdapter

func NewAdapter(channelType string, configJSON json.RawMessage) (Adapter, error)

type EmailAdapter

type EmailAdapter struct {
	Recipients []string `json:"recipients"`
}

func (*EmailAdapter) Send

func (a *EmailAdapter) Send(ctx context.Context, msg Message) error

func (*EmailAdapter) Type

func (a *EmailAdapter) Type() string

func (*EmailAdapter) Validate

func (a *EmailAdapter) Validate() error

type EvalResult

type EvalResult struct {
	Fired    bool
	Message  Message
	Messages []Message
}

type ExceptionDetails

type ExceptionDetails struct {
	Id         string
	Hash       string
	ErrorType  string
	StackTrace string
	Attributes map[string]string
	AppVersion string
	ServerName string
	RecordedAt time.Time
}

type GitHubAdapter

type GitHubAdapter struct {
	Token  string   `json:"token"`
	Owner  string   `json:"owner"`
	Repo   string   `json:"repo"`
	Labels []string `json:"labels,omitempty"`
}

func (*GitHubAdapter) Send

func (a *GitHubAdapter) Send(ctx context.Context, msg Message) error

func (*GitHubAdapter) Type

func (a *GitHubAdapter) Type() string

func (*GitHubAdapter) Validate

func (a *GitHubAdapter) Validate() error

type Message

type Message struct {
	Subject  string
	Body     string
	HTMLBody string
	Severity Severity
	RuleType string
	RuleName string
	URL      string
	Endpoint string
}

type PushoverAdapter added in v1.7.22

type PushoverAdapter struct {
	UserKey  string `json:"userKey"`
	AppToken string `json:"appToken"`
	Device   string `json:"device,omitempty"`
	Priority int    `json:"priority,omitempty"`
	Retry    int    `json:"retry,omitempty"`
	Expire   int    `json:"expire,omitempty"`
	Sound    string `json:"sound,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	HTML     bool   `json:"html,omitempty"`
	Callback string `json:"callback,omitempty"`
}

func (*PushoverAdapter) Send added in v1.7.22

func (a *PushoverAdapter) Send(ctx context.Context, msg Message) error

func (*PushoverAdapter) Type added in v1.7.22

func (a *PushoverAdapter) Type() string

func (*PushoverAdapter) Validate added in v1.7.22

func (a *PushoverAdapter) Validate() error

type RuleEvaluator

type RuleEvaluator func(ctx context.Context, rule *models.NotificationRule, projectId uuid.UUID) (*EvalResult, error)

type Severity

type Severity string
const (
	SeverityInfo     Severity = "info"
	SeverityWarning  Severity = "warning"
	SeverityCritical Severity = "critical"
)

type SlackAdapter

type SlackAdapter struct {
	WebhookURL string `json:"webhookUrl"`
	Channel    string `json:"channel,omitempty"`
	Username   string `json:"username,omitempty"`
}

func (*SlackAdapter) Send

func (a *SlackAdapter) Send(ctx context.Context, msg Message) error

func (*SlackAdapter) Type

func (a *SlackAdapter) Type() string

func (*SlackAdapter) Validate

func (a *SlackAdapter) Validate() error

type TelegramAdapter added in v1.7.24

type TelegramAdapter struct {
	BotToken string `json:"botToken"`
	ChatId   string `json:"chatId"`
}

func (*TelegramAdapter) Send added in v1.7.24

func (a *TelegramAdapter) Send(ctx context.Context, msg Message) error

func (*TelegramAdapter) Type added in v1.7.24

func (a *TelegramAdapter) Type() string

func (*TelegramAdapter) Validate added in v1.7.24

func (a *TelegramAdapter) Validate() error

type WebhookAdapter

type WebhookAdapter struct {
	URL     string            `json:"url"`
	Method  string            `json:"method,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
	Secret  string            `json:"secret,omitempty"`
}

func (*WebhookAdapter) Send

func (a *WebhookAdapter) Send(ctx context.Context, msg Message) error

func (*WebhookAdapter) Type

func (a *WebhookAdapter) Type() string

func (*WebhookAdapter) Validate

func (a *WebhookAdapter) Validate() error

Jump to

Keyboard shortcuts

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