prometheus

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PluginName is the name of the Prometheus Botkube plugin.
	PluginName = "prometheus"
)

Variables

This section is empty.

Functions

func NewSource

func NewSource(version string) source.Source

NewSource returns a new instance of Source.

Types

type Client

type Client struct {
	// API refers to prometheus client. https://github.com/prometheus/client_golang
	API promApi.API
	// contains filtered or unexported fields
}

Client prometheus client

func NewClient

func NewClient(url string) (*Client, error)

NewClient initializes Prometheus client

func (*Client) Alerts

func (c *Client) Alerts(ctx context.Context, request GetAlertsRequest) ([]alert, error)

Alerts returns only new alerts.

type Config

type Config struct {
	URL             string               `yaml:"url,omitempty"`
	AlertStates     []promApi.AlertState `yaml:"alertStates,omitempty"`
	IgnoreOldAlerts *bool                `yaml:"ignoreOldAlerts,omitempty"`
	Log             config.Logger        `yaml:"log"`
}

Config prometheus configuration

func MergeConfigs

func MergeConfigs(configs []*source.Config) (Config, error)

MergeConfigs merges all input configuration.

type GetAlertsRequest

type GetAlertsRequest struct {
	IgnoreOldAlerts bool
	MinAlertTime    time.Time
	AlertStates     []promApi.AlertState
}

type Source

type Source struct {
	source.HandleExternalRequestUnimplemented
	// contains filtered or unexported fields
}

Source prometheus source plugin data structure

func (*Source) Metadata

func (p *Source) Metadata(_ context.Context) (api.MetadataOutput, error)

Metadata returns metadata of prometheus configuration

func (*Source) Stream

func (p *Source) Stream(ctx context.Context, input source.StreamInput) (source.StreamOutput, error)

Stream streams prometheus alerts

Jump to

Keyboard shortcuts

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