notifications

package
v1.7.21 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 27 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 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 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