prometheus

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeNone   = "none"
	AuthTypeBasic  = "basic"
	AuthTypeBearer = "bearer"

	AlertStateAny      = "any"
	AlertStateFiring   = "firing"
	AlertStateResolved = "resolved"
	AlertStatePending  = "pending"
	AlertStateInactive = "inactive"

	PrometheusAlertPayloadType = "prometheus.alert"
)
View Source
const MaxResponseSize = 1 * 1024 * 1024 // 1MB
View Source
const ResourceTypeSilence = "silence"

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertmanagerAlert

type AlertmanagerAlert struct {
	Status       string            `json:"status"`
	Labels       map[string]string `json:"labels"`
	Annotations  map[string]string `json:"annotations"`
	StartsAt     string            `json:"startsAt"`
	EndsAt       string            `json:"endsAt"`
	GeneratorURL string            `json:"generatorURL"`
	Fingerprint  string            `json:"fingerprint"`
}

type AlertmanagerSilence added in v0.10.0

type AlertmanagerSilence struct {
	ID        string                    `json:"id"`
	Status    AlertmanagerSilenceStatus `json:"status"`
	Matchers  []Matcher                 `json:"matchers"`
	StartsAt  string                    `json:"startsAt"`
	EndsAt    string                    `json:"endsAt"`
	CreatedBy string                    `json:"createdBy"`
	Comment   string                    `json:"comment"`
	UpdatedAt string                    `json:"updatedAt"`
}

type AlertmanagerSilenceStatus added in v0.10.0

type AlertmanagerSilenceStatus struct {
	State string `json:"state"`
}

type AlertmanagerWebhookPayload

type AlertmanagerWebhookPayload struct {
	Version           string              `json:"version"`
	GroupKey          string              `json:"groupKey"`
	Status            string              `json:"status"`
	Receiver          string              `json:"receiver"`
	GroupLabels       map[string]string   `json:"groupLabels"`
	CommonLabels      map[string]string   `json:"commonLabels"`
	CommonAnnotations map[string]string   `json:"commonAnnotations"`
	ExternalURL       string              `json:"externalURL"`
	TruncatedAlerts   int                 `json:"truncatedAlerts"`
	Alerts            []AlertmanagerAlert `json:"alerts"`
}

type Client

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

func NewClient

func NewClient(httpContext core.HTTPContext, integration core.IntegrationContext) (*Client, error)

func (*Client) CreateSilence added in v0.10.0

func (c *Client) CreateSilence(silence SilencePayload) (string, error)

func (*Client) ExpireSilence added in v0.10.0

func (c *Client) ExpireSilence(silenceID string) error

func (*Client) GetAlertsFromPrometheus

func (c *Client) GetAlertsFromPrometheus() ([]PrometheusAlert, error)

func (*Client) GetSilence added in v0.10.0

func (c *Client) GetSilence(silenceID string) (AlertmanagerSilence, error)

func (*Client) ListSilences added in v0.10.0

func (c *Client) ListSilences() ([]AlertmanagerSilence, error)

func (*Client) Query

func (c *Client) Query(query string) (map[string]any, error)

func (*Client) QueryRange added in v0.10.0

func (c *Client) QueryRange(query, start, end, step string) (map[string]any, error)

type Configuration

type Configuration struct {
	BaseURL            string `json:"baseURL" mapstructure:"baseURL"`
	AlertmanagerURL    string `json:"alertmanagerURL,omitempty" mapstructure:"alertmanagerURL"`
	AuthType           string `json:"authType" mapstructure:"authType"`
	Username           string `json:"username,omitempty" mapstructure:"username"`
	Password           string `json:"password,omitempty" mapstructure:"password"`
	BearerToken        string `json:"bearerToken,omitempty" mapstructure:"bearerToken"`
	WebhookBearerToken string `json:"webhookBearerToken,omitempty" mapstructure:"webhookBearerToken"`
}

type CreateSilence added in v0.10.0

type CreateSilence struct{}

func (*CreateSilence) Actions added in v0.10.0

func (c *CreateSilence) Actions() []core.Action

func (*CreateSilence) Cancel added in v0.10.0

func (c *CreateSilence) Cancel(ctx core.ExecutionContext) error

func (*CreateSilence) Cleanup added in v0.10.0

func (c *CreateSilence) Cleanup(ctx core.SetupContext) error

func (*CreateSilence) Color added in v0.10.0

func (c *CreateSilence) Color() string

func (*CreateSilence) Configuration added in v0.10.0

func (c *CreateSilence) Configuration() []configuration.Field

func (*CreateSilence) Description added in v0.10.0

func (c *CreateSilence) Description() string

func (*CreateSilence) Documentation added in v0.10.0

func (c *CreateSilence) Documentation() string

func (*CreateSilence) ExampleOutput added in v0.10.0

func (c *CreateSilence) ExampleOutput() map[string]any

func (*CreateSilence) Execute added in v0.10.0

func (c *CreateSilence) Execute(ctx core.ExecutionContext) error

func (*CreateSilence) HandleAction added in v0.10.0

func (c *CreateSilence) HandleAction(ctx core.ActionContext) error

func (*CreateSilence) HandleWebhook added in v0.10.0

func (c *CreateSilence) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*CreateSilence) Icon added in v0.10.0

func (c *CreateSilence) Icon() string

func (*CreateSilence) Label added in v0.10.0

func (c *CreateSilence) Label() string

func (*CreateSilence) Name added in v0.10.0

func (c *CreateSilence) Name() string

func (*CreateSilence) OutputChannels added in v0.10.0

func (c *CreateSilence) OutputChannels(configuration any) []core.OutputChannel

func (*CreateSilence) ProcessQueueItem added in v0.10.0

func (c *CreateSilence) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateSilence) Setup added in v0.10.0

func (c *CreateSilence) Setup(ctx core.SetupContext) error

type CreateSilenceConfiguration added in v0.10.0

type CreateSilenceConfiguration struct {
	Matchers  []MatcherConfiguration `json:"matchers" mapstructure:"matchers"`
	Duration  string                 `json:"duration" mapstructure:"duration"`
	CreatedBy string                 `json:"createdBy" mapstructure:"createdBy"`
	Comment   string                 `json:"comment" mapstructure:"comment"`
}

type CreateSilenceNodeMetadata added in v0.10.0

type CreateSilenceNodeMetadata struct {
	SilenceID string `json:"silenceID"`
}

type ExpireSilence added in v0.10.0

type ExpireSilence struct{}

func (*ExpireSilence) Actions added in v0.10.0

func (c *ExpireSilence) Actions() []core.Action

func (*ExpireSilence) Cancel added in v0.10.0

func (c *ExpireSilence) Cancel(ctx core.ExecutionContext) error

func (*ExpireSilence) Cleanup added in v0.10.0

func (c *ExpireSilence) Cleanup(ctx core.SetupContext) error

func (*ExpireSilence) Color added in v0.10.0

func (c *ExpireSilence) Color() string

func (*ExpireSilence) Configuration added in v0.10.0

func (c *ExpireSilence) Configuration() []configuration.Field

func (*ExpireSilence) Description added in v0.10.0

func (c *ExpireSilence) Description() string

func (*ExpireSilence) Documentation added in v0.10.0

func (c *ExpireSilence) Documentation() string

func (*ExpireSilence) ExampleOutput added in v0.10.0

func (c *ExpireSilence) ExampleOutput() map[string]any

func (*ExpireSilence) Execute added in v0.10.0

func (c *ExpireSilence) Execute(ctx core.ExecutionContext) error

func (*ExpireSilence) HandleAction added in v0.10.0

func (c *ExpireSilence) HandleAction(ctx core.ActionContext) error

func (*ExpireSilence) HandleWebhook added in v0.10.0

func (c *ExpireSilence) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*ExpireSilence) Icon added in v0.10.0

func (c *ExpireSilence) Icon() string

func (*ExpireSilence) Label added in v0.10.0

func (c *ExpireSilence) Label() string

func (*ExpireSilence) Name added in v0.10.0

func (c *ExpireSilence) Name() string

func (*ExpireSilence) OutputChannels added in v0.10.0

func (c *ExpireSilence) OutputChannels(configuration any) []core.OutputChannel

func (*ExpireSilence) ProcessQueueItem added in v0.10.0

func (c *ExpireSilence) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*ExpireSilence) Setup added in v0.10.0

func (c *ExpireSilence) Setup(ctx core.SetupContext) error

type ExpireSilenceConfiguration added in v0.10.0

type ExpireSilenceConfiguration struct {
	Silence string `json:"silence" mapstructure:"silence"`
}

type ExpireSilenceNodeMetadata added in v0.10.0

type ExpireSilenceNodeMetadata struct {
	SilenceID string `json:"silenceID"`
}

type GetAlert

type GetAlert struct{}

func (*GetAlert) Actions

func (c *GetAlert) Actions() []core.Action

func (*GetAlert) Cancel

func (c *GetAlert) Cancel(ctx core.ExecutionContext) error

func (*GetAlert) Cleanup

func (c *GetAlert) Cleanup(ctx core.SetupContext) error

func (*GetAlert) Color

func (c *GetAlert) Color() string

func (*GetAlert) Configuration

func (c *GetAlert) Configuration() []configuration.Field

func (*GetAlert) Description

func (c *GetAlert) Description() string

func (*GetAlert) Documentation

func (c *GetAlert) Documentation() string

func (*GetAlert) ExampleOutput

func (c *GetAlert) ExampleOutput() map[string]any

func (*GetAlert) Execute

func (c *GetAlert) Execute(ctx core.ExecutionContext) error

func (*GetAlert) HandleAction

func (c *GetAlert) HandleAction(ctx core.ActionContext) error

func (*GetAlert) HandleWebhook

func (c *GetAlert) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*GetAlert) Icon

func (c *GetAlert) Icon() string

func (*GetAlert) Label

func (c *GetAlert) Label() string

func (*GetAlert) Name

func (c *GetAlert) Name() string

func (*GetAlert) OutputChannels

func (c *GetAlert) OutputChannels(configuration any) []core.OutputChannel

func (*GetAlert) ProcessQueueItem

func (c *GetAlert) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetAlert) Setup

func (c *GetAlert) Setup(ctx core.SetupContext) error

type GetAlertConfiguration

type GetAlertConfiguration struct {
	AlertName string `json:"alertName" mapstructure:"alertName"`
	State     string `json:"state" mapstructure:"state"`
}

type GetSilence added in v0.10.0

type GetSilence struct{}

func (*GetSilence) Actions added in v0.10.0

func (c *GetSilence) Actions() []core.Action

func (*GetSilence) Cancel added in v0.10.0

func (c *GetSilence) Cancel(ctx core.ExecutionContext) error

func (*GetSilence) Cleanup added in v0.10.0

func (c *GetSilence) Cleanup(ctx core.SetupContext) error

func (*GetSilence) Color added in v0.10.0

func (c *GetSilence) Color() string

func (*GetSilence) Configuration added in v0.10.0

func (c *GetSilence) Configuration() []configuration.Field

func (*GetSilence) Description added in v0.10.0

func (c *GetSilence) Description() string

func (*GetSilence) Documentation added in v0.10.0

func (c *GetSilence) Documentation() string

func (*GetSilence) ExampleOutput added in v0.10.0

func (c *GetSilence) ExampleOutput() map[string]any

func (*GetSilence) Execute added in v0.10.0

func (c *GetSilence) Execute(ctx core.ExecutionContext) error

func (*GetSilence) HandleAction added in v0.10.0

func (c *GetSilence) HandleAction(ctx core.ActionContext) error

func (*GetSilence) HandleWebhook added in v0.10.0

func (c *GetSilence) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*GetSilence) Icon added in v0.10.0

func (c *GetSilence) Icon() string

func (*GetSilence) Label added in v0.10.0

func (c *GetSilence) Label() string

func (*GetSilence) Name added in v0.10.0

func (c *GetSilence) Name() string

func (*GetSilence) OutputChannels added in v0.10.0

func (c *GetSilence) OutputChannels(configuration any) []core.OutputChannel

func (*GetSilence) ProcessQueueItem added in v0.10.0

func (c *GetSilence) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetSilence) Setup added in v0.10.0

func (c *GetSilence) Setup(ctx core.SetupContext) error

type GetSilenceConfiguration added in v0.10.0

type GetSilenceConfiguration struct {
	Silence         string `json:"silence" mapstructure:"silence"`
	LegacySilenceID string `json:"silenceID,omitempty" mapstructure:"silenceID"`
}

type GetSilenceNodeMetadata added in v0.10.0

type GetSilenceNodeMetadata struct {
	SilenceID string `json:"silenceID"`
}

type Matcher added in v0.10.0

type Matcher struct {
	Name    string `json:"name"    mapstructure:"name"`
	Value   string `json:"value"   mapstructure:"value"`
	IsRegex bool   `json:"isRegex" mapstructure:"isRegex"`
	IsEqual bool   `json:"isEqual" mapstructure:"isEqual"`
}

type MatcherConfiguration added in v0.10.0

type MatcherConfiguration struct {
	Name    string `json:"name" mapstructure:"name"`
	Value   string `json:"value" mapstructure:"value"`
	IsRegex *bool  `json:"isRegex,omitempty" mapstructure:"isRegex"`
	IsEqual *bool  `json:"isEqual,omitempty" mapstructure:"isEqual"`
}

type Metadata

type Metadata struct{}

type OnAlert

type OnAlert struct{}

func (*OnAlert) Actions

func (t *OnAlert) Actions() []core.Action

func (*OnAlert) Cleanup

func (t *OnAlert) Cleanup(ctx core.TriggerContext) error

func (*OnAlert) Color

func (t *OnAlert) Color() string

func (*OnAlert) Configuration

func (t *OnAlert) Configuration() []configuration.Field

func (*OnAlert) Description

func (t *OnAlert) Description() string

func (*OnAlert) Documentation

func (t *OnAlert) Documentation() string

func (*OnAlert) ExampleData

func (t *OnAlert) ExampleData() map[string]any

func (*OnAlert) HandleAction

func (t *OnAlert) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnAlert) HandleWebhook

func (t *OnAlert) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*OnAlert) Icon

func (t *OnAlert) Icon() string

func (*OnAlert) Label

func (t *OnAlert) Label() string

func (*OnAlert) Name

func (t *OnAlert) Name() string

func (*OnAlert) Setup

func (t *OnAlert) Setup(ctx core.TriggerContext) error

type OnAlertConfiguration

type OnAlertConfiguration struct {
	Statuses   []string `json:"statuses" mapstructure:"statuses"`
	AlertNames []string `json:"alertNames" mapstructure:"alertNames"`
}

type OnAlertMetadata

type OnAlertMetadata struct {
	WebhookURL         string `json:"webhookUrl" mapstructure:"webhookUrl"`
	WebhookAuthEnabled bool   `json:"webhookAuthEnabled,omitempty" mapstructure:"webhookAuthEnabled"`
}

type Prometheus

type Prometheus struct{}

func (*Prometheus) Actions

func (p *Prometheus) Actions() []core.Action

func (*Prometheus) Cleanup

func (*Prometheus) Components

func (p *Prometheus) Components() []core.Component

func (*Prometheus) Configuration

func (p *Prometheus) Configuration() []configuration.Field

func (*Prometheus) Description

func (p *Prometheus) Description() string

func (*Prometheus) HandleAction

func (p *Prometheus) HandleAction(ctx core.IntegrationActionContext) error

func (*Prometheus) HandleRequest

func (p *Prometheus) HandleRequest(ctx core.HTTPRequestContext)

func (*Prometheus) Icon

func (p *Prometheus) Icon() string

func (*Prometheus) Instructions

func (p *Prometheus) Instructions() string

func (*Prometheus) Label

func (p *Prometheus) Label() string

func (*Prometheus) ListResources

func (p *Prometheus) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Prometheus) Name

func (p *Prometheus) Name() string

func (*Prometheus) Sync

func (p *Prometheus) Sync(ctx core.SyncContext) error

func (*Prometheus) Triggers

func (p *Prometheus) Triggers() []core.Trigger

type PrometheusAlert

type PrometheusAlert struct {
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
	State       string            `json:"state"`
	ActiveAt    string            `json:"activeAt,omitempty"`
	Value       string            `json:"value,omitempty"`
}

type PrometheusAlertsData

type PrometheusAlertsData struct {
	Alerts []PrometheusAlert `json:"alerts"`
}

type PrometheusWebhookHandler

type PrometheusWebhookHandler struct{}

func (*PrometheusWebhookHandler) Cleanup

func (*PrometheusWebhookHandler) CompareConfig

func (h *PrometheusWebhookHandler) CompareConfig(a any, b any) (bool, error)

func (*PrometheusWebhookHandler) Merge

func (h *PrometheusWebhookHandler) Merge(current, requested any) (any, bool, error)

func (*PrometheusWebhookHandler) Setup

type Query added in v0.10.0

type Query struct{}

func (*Query) Actions added in v0.10.0

func (c *Query) Actions() []core.Action

func (*Query) Cancel added in v0.10.0

func (c *Query) Cancel(ctx core.ExecutionContext) error

func (*Query) Cleanup added in v0.10.0

func (c *Query) Cleanup(ctx core.SetupContext) error

func (*Query) Color added in v0.10.0

func (c *Query) Color() string

func (*Query) Configuration added in v0.10.0

func (c *Query) Configuration() []configuration.Field

func (*Query) Description added in v0.10.0

func (c *Query) Description() string

func (*Query) Documentation added in v0.10.0

func (c *Query) Documentation() string

func (*Query) ExampleOutput added in v0.10.0

func (c *Query) ExampleOutput() map[string]any

func (*Query) Execute added in v0.10.0

func (c *Query) Execute(ctx core.ExecutionContext) error

func (*Query) HandleAction added in v0.10.0

func (c *Query) HandleAction(ctx core.ActionContext) error

func (*Query) HandleWebhook added in v0.10.0

func (c *Query) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*Query) Icon added in v0.10.0

func (c *Query) Icon() string

func (*Query) Label added in v0.10.0

func (c *Query) Label() string

func (*Query) Name added in v0.10.0

func (c *Query) Name() string

func (*Query) OutputChannels added in v0.10.0

func (c *Query) OutputChannels(configuration any) []core.OutputChannel

func (*Query) ProcessQueueItem added in v0.10.0

func (c *Query) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*Query) Setup added in v0.10.0

func (c *Query) Setup(ctx core.SetupContext) error

type QueryConfiguration added in v0.10.0

type QueryConfiguration struct {
	Query string `json:"query" mapstructure:"query"`
}

type QueryNodeMetadata added in v0.10.0

type QueryNodeMetadata struct {
	Query string `json:"query"`
}

type QueryRange added in v0.10.0

type QueryRange struct{}

func (*QueryRange) Actions added in v0.10.0

func (c *QueryRange) Actions() []core.Action

func (*QueryRange) Cancel added in v0.10.0

func (c *QueryRange) Cancel(ctx core.ExecutionContext) error

func (*QueryRange) Cleanup added in v0.10.0

func (c *QueryRange) Cleanup(ctx core.SetupContext) error

func (*QueryRange) Color added in v0.10.0

func (c *QueryRange) Color() string

func (*QueryRange) Configuration added in v0.10.0

func (c *QueryRange) Configuration() []configuration.Field

func (*QueryRange) Description added in v0.10.0

func (c *QueryRange) Description() string

func (*QueryRange) Documentation added in v0.10.0

func (c *QueryRange) Documentation() string

func (*QueryRange) ExampleOutput added in v0.10.0

func (c *QueryRange) ExampleOutput() map[string]any

func (*QueryRange) Execute added in v0.10.0

func (c *QueryRange) Execute(ctx core.ExecutionContext) error

func (*QueryRange) HandleAction added in v0.10.0

func (c *QueryRange) HandleAction(ctx core.ActionContext) error

func (*QueryRange) HandleWebhook added in v0.10.0

func (c *QueryRange) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*QueryRange) Icon added in v0.10.0

func (c *QueryRange) Icon() string

func (*QueryRange) Label added in v0.10.0

func (c *QueryRange) Label() string

func (*QueryRange) Name added in v0.10.0

func (c *QueryRange) Name() string

func (*QueryRange) OutputChannels added in v0.10.0

func (c *QueryRange) OutputChannels(configuration any) []core.OutputChannel

func (*QueryRange) ProcessQueueItem added in v0.10.0

func (c *QueryRange) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*QueryRange) Setup added in v0.10.0

func (c *QueryRange) Setup(ctx core.SetupContext) error

type QueryRangeConfiguration added in v0.10.0

type QueryRangeConfiguration struct {
	Query string `json:"query" mapstructure:"query"`
	Start string `json:"start" mapstructure:"start"`
	End   string `json:"end" mapstructure:"end"`
	Step  string `json:"step" mapstructure:"step"`
}

type QueryRangeNodeMetadata added in v0.10.0

type QueryRangeNodeMetadata struct {
	Query string `json:"query"`
}

type SilencePayload added in v0.10.0

type SilencePayload struct {
	Matchers  []Matcher `json:"matchers"`
	StartsAt  string    `json:"startsAt"`
	EndsAt    string    `json:"endsAt"`
	CreatedBy string    `json:"createdBy"`
	Comment   string    `json:"comment"`
}

Jump to

Keyboard shortcuts

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