prometheus

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TYPE = "prometheus"
)

Variables

View Source
var (
	ErrURLEmpty           = errors.New("URL cannot be empty")
	ErrExprEmpty          = errors.New("expression cannot be empty")
	ErrInvalidSuccessMode = errors.New("invalid success mode")

	ErrInvalidResult = errors.New("failed to decode result")

	ErrResultEmpty    = errors.New("result is empty")
	ErrResultNotEmpty = errors.New("result is not empty")
)

Functions

func NewPrometheusClientError

func NewPrometheusClientError(err error) error

Types

type ClientError

type ClientError struct {
	Err error
}

func (ClientError) Error

func (err ClientError) Error() string

func (ClientError) Unwrap

func (err ClientError) Unwrap() error

type Config

type Config struct {
	URL         string      `yaml:"url" json:"url" jsonschema:"required,title=Prometheus URL"`
	Expr        string      `yaml:"expr" json:"expr" jsonschema:"required,title=Prometheus expression"`
	SuccessMode SuccessMode `yaml:"success_mode" json:"success_mode" jsonschema:"default=if_vector,title=Success mode,enum=if_empty,enum=if_vector"`
	Insecure    bool        `yaml:"insecure" json:"insecure" jsonschema:"default=false"`
	// contains filtered or unexported fields
}

Config is the main monitor Config.

func NewConfig

func NewConfig() *Config

func (*Config) Init

func (c *Config) Init(_ context.Context, logger *log.Entry) error

func (*Config) Run

func (c *Config) Run(ctx context.Context) error

func (*Config) Validate

func (c *Config) Validate() error

type SuccessMode

type SuccessMode string
const (
	SuccessModeIfEmpty  SuccessMode = "if_empty"
	SuccessModeIfVector SuccessMode = "if_vector"
)

Jump to

Keyboard shortcuts

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