Documentation ¶
Index ¶
- Constants
- Variables
- func GetActiveReceiversMap(r *dispatch.Route) map[string]struct{}
- func GetDecryptedValueFnForTesting(_ context.Context, sjd map[string][]byte, key string, fallback string) string
- func GetReceivers(receivers []*nfstatus.Receiver) []models.Receiver
- func NoopDecrypt(_ context.Context, sjd map[string][]byte, key string, fallback string) string
- func ProcessIntegrationError(config *GrafanaIntegrationConfig, err error) error
- type APIReceiver
- type Alert
- type AlertGroup
- type AlertGroups
- type AlertValidationError
- type ClusterPeer
- type ConfigReceiver
- type Configuration
- type DispatcherLimits
- type FakeConfig
- func (f *FakeConfig) DispatcherLimits() DispatcherLimits
- func (f *FakeConfig) Hash() [16]byte
- func (f *FakeConfig) InhibitRules() []*InhibitRule
- func (f *FakeConfig) MuteTimeIntervals() []MuteTimeInterval
- func (f *FakeConfig) Raw() []byte
- func (f *FakeConfig) ReceiverIntegrations() (map[string][]Integration, error)
- func (f *FakeConfig) RoutingTree() *Route
- func (f *FakeConfig) Templates() *templates.Template
- type GetDecryptedValueFn
- type GettableAlert
- type GettableAlerts
- type GettableSilence
- type GettableSilences
- type GrafanaAlertmanager
- func (am *GrafanaAlertmanager) ApplyConfig(cfg Configuration) (err error)
- func (am *GrafanaAlertmanager) ConfigHash() [16]byte
- func (am *GrafanaAlertmanager) CreateSilence(ps *PostableSilence) (string, error)
- func (am *GrafanaAlertmanager) DeleteSilence(silenceID string) error
- func (am *GrafanaAlertmanager) ExternalURL() string
- func (am *GrafanaAlertmanager) GetAlertGroups(active, silenced, inhibited bool, filter []string, receivers string) (AlertGroups, error)
- func (am *GrafanaAlertmanager) GetAlerts(active, silenced, inhibited bool, filter []string, receivers string) (GettableAlerts, error)
- func (am *GrafanaAlertmanager) GetReceivers() []models.Receiver
- func (am *GrafanaAlertmanager) GetSilence(silenceID string) (GettableSilence, error)
- func (am *GrafanaAlertmanager) GetStatus() []byte
- func (am *GrafanaAlertmanager) GetTemplate() (*template.Template, error)
- func (am *GrafanaAlertmanager) ListSilences(filter []string) (GettableSilences, error)
- func (am *GrafanaAlertmanager) PutAlerts(postableAlerts amv2.PostableAlerts) error
- func (am *GrafanaAlertmanager) Ready() bool
- func (am *GrafanaAlertmanager) SilenceState() (SilenceState, error)
- func (am *GrafanaAlertmanager) StopAndWait()
- func (am *GrafanaAlertmanager) TestReceivers(ctx context.Context, c TestReceiversConfigBodyParams) (*TestReceiversResult, int, error)
- func (am *GrafanaAlertmanager) TestTemplate(ctx context.Context, c TestTemplatesConfigBodyParams) (*TestTemplatesResults, error)
- func (am *GrafanaAlertmanager) UpsertSilence(ps *PostableSilence) (string, error)
- func (am *GrafanaAlertmanager) WithLock(fn func())
- func (am *GrafanaAlertmanager) WithReadLock(fn func())
- type GrafanaAlertmanagerConfig
- type GrafanaAlertmanagerMetrics
- type GrafanaIntegrationConfig
- type GrafanaIntegrations
- type GrafanaReceiverConfig
- type InhibitRule
- type Integration
- type IntegrationTimeoutError
- type IntegrationValidationError
- type Limits
- type MaintenanceOptions
- type MuteTimeInterval
- type NilChannel
- type NilPeer
- type Notifier
- type NotifierConfig
- type NotifierConfigTest
- type NotifyReceiver
- type PostableAlert
- type PostableAlerts
- type PostableSilence
- type Receiver
- type Route
- type Silence
- type SilenceState
- type State
- type TemplateErrorKind
- type TestIntegrationConfigResult
- type TestReceiverResult
- type TestReceiversConfigAlertParams
- type TestReceiversConfigBodyParams
- type TestReceiversResult
- type TestTemplatesConfigBodyParams
- type TestTemplatesErrorResult
- type TestTemplatesResult
- type TestTemplatesResults
- type TimeInterval
Constants ¶
const ( DefaultReceiverName = "TestReceiver" DefaultGroupLabel = "group_label" DefaultGroupLabelValue = "group_label_value" )
const ActiveStateLabelValue = "active"
const InactiveStateLabelValue = "inactive"
Variables ¶
var ( ErrGetAlertsInternal = fmt.Errorf("unable to retrieve alerts(s) due to an internal error") ErrGetAlertsBadPayload = fmt.Errorf("unable to retrieve alerts") ErrGetAlertGroupsBadPayload = fmt.Errorf("unable to retrieve alerts groups") )
var ( ErrGetSilencesInternal = fmt.Errorf("unable to retrieve silence(s) due to an internal error") ErrDeleteSilenceInternal = fmt.Errorf("unable to delete silence due to an internal error") ErrCreateSilenceBadPayload = fmt.Errorf("unable to create silence") ErrListSilencesBadPayload = fmt.Errorf("unable to list silences") ErrSilenceNotFound = silence.ErrNotFound )
var AllKnownConfigsForTesting = map[string]NotifierConfigTest{ "prometheus-alertmanager": { NotifierType: "prometheus-alertmanager", Config: alertmanager.FullValidConfigForTesting, Secrets: alertmanager.FullValidSecretsForTesting, }, "dingding": {NotifierType: "dingding", Config: dinding.FullValidConfigForTesting, }, "discord": {NotifierType: "discord", Config: discord.FullValidConfigForTesting, }, "email": {NotifierType: "email", Config: email.FullValidConfigForTesting, }, "googlechat": {NotifierType: "googlechat", Config: googlechat.FullValidConfigForTesting, Secrets: googlechat.FullValidSecretsForTesting, }, "kafka": {NotifierType: "kafka", Config: kafka.FullValidConfigForTesting, Secrets: kafka.FullValidSecretsForTesting, }, "line": {NotifierType: "line", Config: line.FullValidConfigForTesting, Secrets: line.FullValidSecretsForTesting, }, "mqtt": {NotifierType: "mqtt", Config: mqtt.FullValidConfigForTesting, Secrets: mqtt.FullValidSecretsForTesting, }, "opsgenie": {NotifierType: "opsgenie", Config: opsgenie.FullValidConfigForTesting, Secrets: opsgenie.FullValidSecretsForTesting, }, "pagerduty": {NotifierType: "pagerduty", Config: pagerduty.FullValidConfigForTesting, Secrets: pagerduty.FullValidSecretsForTesting, }, "pushover": {NotifierType: "pushover", Config: pushover.FullValidConfigForTesting, Secrets: pushover.FullValidSecretsForTesting, }, "sensugo": {NotifierType: "sensugo", Config: sensugo.FullValidConfigForTesting, Secrets: sensugo.FullValidSecretsForTesting, }, "slack": {NotifierType: "slack", Config: slack.FullValidConfigForTesting, Secrets: slack.FullValidSecretsForTesting, }, "sns": {NotifierType: "sns", Config: sns.FullValidConfigForTesting, }, "teams": {NotifierType: "teams", Config: teams.FullValidConfigForTesting, }, "telegram": {NotifierType: "telegram", Config: telegram.FullValidConfigForTesting, Secrets: telegram.FullValidSecretsForTesting, }, "threema": {NotifierType: "threema", Config: threema.FullValidConfigForTesting, Secrets: threema.FullValidSecretsForTesting, }, "victorops": {NotifierType: "victorops", Config: victorops.FullValidConfigForTesting, }, "webhook": {NotifierType: "webhook", Config: webhook.FullValidConfigForTesting, Secrets: webhook.FullValidSecretsForTesting, }, "wecom": {NotifierType: "wecom", Config: wecom.FullValidConfigForTesting, Secrets: wecom.FullValidSecretsForTesting, }, "webex": {NotifierType: "webex", Config: webex.FullValidConfigForTesting, Secrets: webex.FullValidSecretsForTesting, }, }
var (
ErrNoReceivers = errors.New("no receivers")
)
var NewIntegration = nfstatus.NewIntegration
var OpenAPIAlertsToAlerts = v2.OpenAPIAlertsToAlerts
Functions ¶
func GetActiveReceiversMap ¶
GetActiveReceiversMap returns all receivers that are in use by a route.
func GetReceivers ¶
GetReceivers converts the internal receiver status into the API response.
func NoopDecrypt ¶
NoopDecrypt is a GetDecryptedValueFn that returns a value without decrypting it.
func ProcessIntegrationError ¶
func ProcessIntegrationError(config *GrafanaIntegrationConfig, err error) error
Types ¶
type APIReceiver ¶
type APIReceiver struct { ConfigReceiver `yaml:",inline"` GrafanaIntegrations `yaml:",inline"` }
func PostableAPIReceiverToAPIReceiver ¶
func PostableAPIReceiverToAPIReceiver(r *definition.PostableApiReceiver) *APIReceiver
type AlertGroup ¶
type AlertGroup = amv2.AlertGroup
type AlertGroups ¶
type AlertGroups = amv2.AlertGroups
type AlertValidationError ¶
type AlertValidationError struct { Alerts amv2.PostableAlerts Errors []error // Errors[i] refers to Alerts[i]. }
AlertValidationError is the error capturing the validation errors faced on the alerts.
func PostableAlertsToAlertmanagerAlerts ¶
func PostableAlertsToAlertmanagerAlerts(postableAlerts amv2.PostableAlerts, now time.Time) ([]*types.Alert, *AlertValidationError)
PostableAlertsToAlertmanagerAlerts converts the PostableAlerts to a slice of *types.Alert. It sets `StartsAt` and `EndsAt`, ignores empty and namespace UID labels, and captures validation errors for each skipped alert.
func (AlertValidationError) Error ¶
func (e AlertValidationError) Error() string
type ClusterPeer ¶
type ClusterPeer interface { AddState(string, cluster.State, prometheus.Registerer) cluster.ClusterChannel Position() int WaitReady(context.Context) error }
type ConfigReceiver ¶
type Configuration ¶
type Configuration interface { DispatcherLimits() DispatcherLimits InhibitRules() []InhibitRule TimeIntervals() []TimeInterval // Deprecated: MuteTimeIntervals are deprecated in Alertmanager and will be removed in future versions. MuteTimeIntervals() []MuteTimeInterval Receivers() []*APIReceiver BuildReceiverIntegrationsFunc() func(next *APIReceiver, tmpl *templates.Template) ([]*Integration, error) RoutingTree() *Route Templates() []templates.TemplateDefinition Hash() [16]byte Raw() []byte }
Configuration is an interface for accessing Alertmanager configuration.
type DispatcherLimits ¶
type FakeConfig ¶
type FakeConfig struct { }
func (*FakeConfig) DispatcherLimits ¶
func (f *FakeConfig) DispatcherLimits() DispatcherLimits
func (*FakeConfig) Hash ¶
func (f *FakeConfig) Hash() [16]byte
func (*FakeConfig) InhibitRules ¶
func (f *FakeConfig) InhibitRules() []*InhibitRule
func (*FakeConfig) MuteTimeIntervals ¶
func (f *FakeConfig) MuteTimeIntervals() []MuteTimeInterval
func (*FakeConfig) Raw ¶
func (f *FakeConfig) Raw() []byte
func (*FakeConfig) ReceiverIntegrations ¶
func (f *FakeConfig) ReceiverIntegrations() (map[string][]Integration, error)
func (*FakeConfig) RoutingTree ¶
func (f *FakeConfig) RoutingTree() *Route
func (*FakeConfig) Templates ¶
func (f *FakeConfig) Templates() *templates.Template
type GetDecryptedValueFn ¶
type GetDecryptedValueFn func(ctx context.Context, sjd map[string][]byte, key string, fallback string) string
GetDecryptedValueFn is a function that returns the decrypted value of the given key. If the key is not present, then it returns the fallback value.
type GettableAlert ¶
type GettableAlert = amv2.GettableAlert
type GettableAlerts ¶
type GettableAlerts = amv2.GettableAlerts
type GettableSilence ¶
type GettableSilence = amv2.GettableSilence
type GettableSilences ¶
type GettableSilences = amv2.GettableSilences
type GrafanaAlertmanager ¶
type GrafanaAlertmanager struct { Metrics *GrafanaAlertmanagerMetrics // contains filtered or unexported fields }
func NewGrafanaAlertmanager ¶
func NewGrafanaAlertmanager(tenantKey string, tenantID int64, config *GrafanaAlertmanagerConfig, peer ClusterPeer, logger log.Logger, m *GrafanaAlertmanagerMetrics) (*GrafanaAlertmanager, error)
NewGrafanaAlertmanager creates a new Grafana-specific Alertmanager.
func (*GrafanaAlertmanager) ApplyConfig ¶
func (am *GrafanaAlertmanager) ApplyConfig(cfg Configuration) (err error)
ApplyConfig applies a new configuration by re-initializing all components using the configuration provided. It is not safe to call concurrently.
func (*GrafanaAlertmanager) ConfigHash ¶
func (am *GrafanaAlertmanager) ConfigHash() [16]byte
ConfigHash returns the hash of the current running configuration. It is not safe to call without a lock.
func (*GrafanaAlertmanager) CreateSilence ¶
func (am *GrafanaAlertmanager) CreateSilence(ps *PostableSilence) (string, error)
CreateSilence persists the provided silence and returns the silence ID if successful.
func (*GrafanaAlertmanager) DeleteSilence ¶
func (am *GrafanaAlertmanager) DeleteSilence(silenceID string) error
DeleteSilence looks for and expires the silence by the provided silenceID. It returns ErrSilenceNotFound if the silence is not present.
func (*GrafanaAlertmanager) ExternalURL ¶
func (am *GrafanaAlertmanager) ExternalURL() string
func (*GrafanaAlertmanager) GetAlertGroups ¶
func (am *GrafanaAlertmanager) GetAlertGroups(active, silenced, inhibited bool, filter []string, receivers string) (AlertGroups, error)
func (*GrafanaAlertmanager) GetAlerts ¶
func (am *GrafanaAlertmanager) GetAlerts(active, silenced, inhibited bool, filter []string, receivers string) (GettableAlerts, error)
func (*GrafanaAlertmanager) GetReceivers ¶
func (am *GrafanaAlertmanager) GetReceivers() []models.Receiver
GetReceivers returns the receivers configured as part of the current configuration. It is safe to call concurrently.
func (*GrafanaAlertmanager) GetSilence ¶
func (am *GrafanaAlertmanager) GetSilence(silenceID string) (GettableSilence, error)
GetSilence retrieves a silence by the provided silenceID. It returns ErrSilenceNotFound if the silence is not present.
func (*GrafanaAlertmanager) GetStatus ¶
func (am *GrafanaAlertmanager) GetStatus() []byte
TODO(gotjosh): I don't think this is right, make sure you evaluate it.
func (*GrafanaAlertmanager) GetTemplate ¶
func (am *GrafanaAlertmanager) GetTemplate() (*template.Template, error)
func (*GrafanaAlertmanager) ListSilences ¶
func (am *GrafanaAlertmanager) ListSilences(filter []string) (GettableSilences, error)
ListSilences retrieves a list of stored silences. It supports a set of labels as filters.
func (*GrafanaAlertmanager) PutAlerts ¶
func (am *GrafanaAlertmanager) PutAlerts(postableAlerts amv2.PostableAlerts) error
PutAlerts receives the alerts and then sends them through the corresponding route based on whenever the alert has a receiver embedded or not
func (*GrafanaAlertmanager) Ready ¶
func (am *GrafanaAlertmanager) Ready() bool
func (*GrafanaAlertmanager) SilenceState ¶
func (am *GrafanaAlertmanager) SilenceState() (SilenceState, error)
func (*GrafanaAlertmanager) StopAndWait ¶
func (am *GrafanaAlertmanager) StopAndWait()
func (*GrafanaAlertmanager) TestReceivers ¶
func (am *GrafanaAlertmanager) TestReceivers(ctx context.Context, c TestReceiversConfigBodyParams) (*TestReceiversResult, int, error)
func (*GrafanaAlertmanager) TestTemplate ¶
func (am *GrafanaAlertmanager) TestTemplate(ctx context.Context, c TestTemplatesConfigBodyParams) (*TestTemplatesResults, error)
TestTemplate tests the given template string against the given alerts. Existing templates are used to provide context for the test. If an existing template of the same filename as the one being tested is found, it will not be used as context.
func (*GrafanaAlertmanager) UpsertSilence ¶
func (am *GrafanaAlertmanager) UpsertSilence(ps *PostableSilence) (string, error)
UpsertSilence allows for the creation of a silence with a pre-set ID.
func (*GrafanaAlertmanager) WithLock ¶
func (am *GrafanaAlertmanager) WithLock(fn func())
func (*GrafanaAlertmanager) WithReadLock ¶
func (am *GrafanaAlertmanager) WithReadLock(fn func())
type GrafanaAlertmanagerConfig ¶
type GrafanaAlertmanagerConfig struct { ExternalURL string AlertStoreCallback mem.AlertStoreCallback PeerTimeout time.Duration Silences MaintenanceOptions Nflog MaintenanceOptions Limits Limits }
func (*GrafanaAlertmanagerConfig) Validate ¶
func (c *GrafanaAlertmanagerConfig) Validate() error
type GrafanaAlertmanagerMetrics ¶
type GrafanaAlertmanagerMetrics struct { Registerer prometheus.Registerer *metrics.Alerts // contains filtered or unexported fields }
func NewGrafanaAlertmanagerMetrics ¶
func NewGrafanaAlertmanagerMetrics(r prometheus.Registerer, l log.Logger) *GrafanaAlertmanagerMetrics
NewGrafanaAlertmanagerMetrics creates a set of metrics for the Alertmanager.
type GrafanaIntegrationConfig ¶
type GrafanaIntegrationConfig struct { UID string `json:"uid" yaml:"uid"` Name string `json:"name" yaml:"name"` Type string `json:"type" yaml:"type"` DisableResolveMessage bool `json:"disableResolveMessage" yaml:"disableResolveMessage"` Settings json.RawMessage `json:"settings" yaml:"settings"` SecureSettings map[string]string `json:"secureSettings" yaml:"secureSettings"` }
type GrafanaIntegrations ¶
type GrafanaIntegrations struct {
Integrations []*GrafanaIntegrationConfig `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
}
type GrafanaReceiverConfig ¶
type GrafanaReceiverConfig struct { Name string AlertmanagerConfigs []*NotifierConfig[alertmanager.Config] DingdingConfigs []*NotifierConfig[dinding.Config] DiscordConfigs []*NotifierConfig[discord.Config] EmailConfigs []*NotifierConfig[email.Config] GooglechatConfigs []*NotifierConfig[googlechat.Config] KafkaConfigs []*NotifierConfig[kafka.Config] LineConfigs []*NotifierConfig[line.Config] OpsgenieConfigs []*NotifierConfig[opsgenie.Config] MqttConfigs []*NotifierConfig[mqtt.Config] PagerdutyConfigs []*NotifierConfig[pagerduty.Config] OnCallConfigs []*NotifierConfig[oncall.Config] PushoverConfigs []*NotifierConfig[pushover.Config] SensugoConfigs []*NotifierConfig[sensugo.Config] SlackConfigs []*NotifierConfig[slack.Config] SNSConfigs []*NotifierConfig[sns.Config] TeamsConfigs []*NotifierConfig[teams.Config] TelegramConfigs []*NotifierConfig[telegram.Config] ThreemaConfigs []*NotifierConfig[threema.Config] VictoropsConfigs []*NotifierConfig[victorops.Config] WebhookConfigs []*NotifierConfig[webhook.Config] WecomConfigs []*NotifierConfig[wecom.Config] WebexConfigs []*NotifierConfig[webex.Config] }
GrafanaReceiverConfig represents a parsed and validated APIReceiver
func BuildReceiverConfiguration ¶
func BuildReceiverConfiguration(ctx context.Context, api *APIReceiver, decrypt GetDecryptedValueFn) (GrafanaReceiverConfig, error)
BuildReceiverConfiguration parses, decrypts and validates the APIReceiver.
type InhibitRule ¶
type InhibitRule = config.InhibitRule
type Integration ¶
type Integration = nfstatus.Integration
func BuildReceiverIntegrations ¶
func BuildReceiverIntegrations( receiver GrafanaReceiverConfig, tmpl *templates.Template, img images.Provider, logger logging.LoggerFactory, newWebhookSender func(n receivers.Metadata) (receivers.WebhookSender, error), newEmailSender func(n receivers.Metadata) (receivers.EmailSender, error), orgID int64, version string, ) ([]*Integration, error)
BuildReceiverIntegrations creates integrations for each configured notification channel in GrafanaReceiverConfig. It returns a slice of Integration objects, one for each notification channel, along with any errors that occurred.
type IntegrationTimeoutError ¶
type IntegrationTimeoutError struct { Integration *GrafanaIntegrationConfig Err error }
func (IntegrationTimeoutError) Error ¶
func (e IntegrationTimeoutError) Error() string
type IntegrationValidationError ¶
type IntegrationValidationError struct { Err error Integration *GrafanaIntegrationConfig }
func (IntegrationValidationError) Error ¶
func (e IntegrationValidationError) Error() string
func (IntegrationValidationError) Unwrap ¶
func (e IntegrationValidationError) Unwrap() error
type MaintenanceOptions ¶
type MaintenanceOptions interface { // InitialState returns the initial snapshot of the artefacts under maintenance. This will be loaded when the Alertmanager starts. InitialState() string // Retention represents for how long should we keep the artefacts under maintenance. Retention() time.Duration // MaintenanceFrequency represents how often should we execute the maintenance. MaintenanceFrequency() time.Duration // MaintenanceFunc returns the function to execute as part of the maintenance process. This will usually take a snaphot of the artefacts under maintenance. // It returns the size of the state in bytes or an error if the maintenance fails. MaintenanceFunc(state State) (int64, error) }
MaintenanceOptions represent the configuration options available for executing maintenance of Silences and the Notification log that the Alertmanager uses.
type MuteTimeInterval ¶
type MuteTimeInterval = config.MuteTimeInterval
type NilChannel ¶
type NilChannel struct{}
func (*NilChannel) Broadcast ¶
func (c *NilChannel) Broadcast([]byte)
type NilPeer ¶
type NilPeer struct{}
NilPeer and NilChannel implements the Alertmanager clustering interface.
func (*NilPeer) AddState ¶
func (p *NilPeer) AddState(string, cluster.State, prometheus.Registerer) cluster.ClusterChannel
type NotifierConfig ¶
NotifierConfig represents parsed GrafanaIntegrationConfig.
type NotifierConfigTest ¶
func (NotifierConfigTest) GetRawNotifierConfig ¶
func (n NotifierConfigTest) GetRawNotifierConfig(name string) *GrafanaIntegrationConfig
type NotifyReceiver ¶
type PostableAlert ¶
type PostableAlert = amv2.PostableAlert
type PostableAlerts ¶
type PostableAlerts = amv2.PostableAlerts
type PostableSilence ¶
type PostableSilence = amv2.PostableSilence
type SilenceState ¶
type SilenceState map[string]*silencepb.MeshSilence
SilenceState copied from state in prometheus-alertmanager/silence/silence.go.
func DecodeState ¶
func DecodeState(r io.Reader) (SilenceState, error)
DecodeState copied from decodeState in prometheus-alertmanager/silence/silence.go.
func (SilenceState) MarshalBinary ¶
func (s SilenceState) MarshalBinary() ([]byte, error)
type State ¶
State represents any of the two 'states' of the alertmanager. Notification log or Silences. MarshalBinary returns the binary representation of this internal state based on the protobuf.
type TemplateErrorKind ¶
type TemplateErrorKind string
const ( InvalidTemplate TemplateErrorKind = "invalid_template" ExecutionError TemplateErrorKind = "execution_error" )
type TestReceiverResult ¶
type TestReceiverResult struct { Name string `json:"name"` Configs []TestIntegrationConfigResult `json:"configs"` }
type TestReceiversConfigBodyParams ¶
type TestReceiversConfigBodyParams struct { Alert *TestReceiversConfigAlertParams `yaml:"alert,omitempty" json:"alert,omitempty"` Receivers []*APIReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"` }
type TestReceiversResult ¶
type TestReceiversResult struct { Alert types.Alert `json:"alert"` Receivers []TestReceiverResult `json:"receivers"` NotifedAt time.Time `json:"notifiedAt"` }
func TestReceivers ¶
func TestReceivers( ctx context.Context, c TestReceiversConfigBodyParams, tmpls []string, buildIntegrationsFunc func(*APIReceiver, *template.Template) ([]*nfstatus.Integration, error), externalURL string) (*TestReceiversResult, int, error)
type TestTemplatesConfigBodyParams ¶
type TestTemplatesConfigBodyParams struct { // Alerts to use as data when testing the template. Alerts []*PostableAlert // Template string to test. Template string // Name of the template. Name string }
type TestTemplatesErrorResult ¶
type TestTemplatesErrorResult struct { // Name of the associated template for this error. Will be empty if the Kind is "invalid_template". Name string `json:"name"` // Kind of template error that occurred. Kind TemplateErrorKind `json:"kind"` // Error cause. Error string `json:"error"` }
type TestTemplatesResult ¶
type TestTemplatesResults ¶
type TestTemplatesResults struct { Results []TestTemplatesResult `json:"results"` Errors []TestTemplatesErrorResult `json:"errors"` }
func TestTemplate ¶
func TestTemplate(ctx context.Context, c TestTemplatesConfigBodyParams, tmpls []templates.TemplateDefinition, externalURL string, logger log.Logger) (*TestTemplatesResults, error)
type TimeInterval ¶
type TimeInterval = config.TimeInterval