monitor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetricSet

func NewMetricSet(name, help string) *metricSet

Types

type Config

type Config struct {
	// `yaml:"targets"`
	Targets []Target
}

func ReadConfig

func ReadConfig(mapper meta.RESTMapper, path string) (Config, error)

type Exporter

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

func NewExporter

func NewExporter(updatesChan <-chan TargetsStatusUpdate, server Server,
	metricName, metricDescription string) *Exporter

func (*Exporter) Start

func (e *Exporter) Start(ctx context.Context) error

type Metric

type Metric struct {
	Labels prom.Labels
	Value  float64
}

type MetricSet

type MetricSet interface {
	prom.Collector
	Update(metrics []Metric)
}

MetricSet is an expasion of prom.Collector interface that allows batch updates of metrics. Useful when processing a set of metrics that are later exposed to Prometheus via different metric.

type MonitorPoller

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

StatusPoller polls the status of a set of objects at a regular interval.

func NewMonitorPoller

func NewMonitorPoller(interval time.Duration, evaluator *eval.Evaluator, cfg Config) *MonitorPoller

func (*MonitorPoller) Start

func (s *MonitorPoller) Start(ctx context.Context) <-chan TargetsStatusUpdate

Start starts the poller and returns a channel that will receive status updates. The poller will run until the context is canceled. The channel will be closed when the context is canceled.

type Server

type Server interface {
	// Handle registers a handler for the given pattern, similar to http.Handle.
	Handle(pattern string, handler http.Handler)

	// Start starts the server and blocks until the server is stopped.
	Start(ctx context.Context) error
}

Server is the interface for serving the metrics.

type SimpleServer

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

func NewSimpleServer

func NewSimpleServer(host string, port int) *SimpleServer

func (*SimpleServer) Handle

func (s *SimpleServer) Handle(pattern string, handler http.Handler)

func (*SimpleServer) Start

func (s *SimpleServer) Start(ctx context.Context) error

type Target

type Target struct {
	Kinds    []schema.GroupKind
	Category string `yaml:"omitempty"`
}

type TargetStatuses

type TargetStatuses struct {
	Target   Target
	Statuses []status.ObjectStatus
}

type TargetsStatusUpdate

type TargetsStatusUpdate struct {
	Statuses []TargetStatuses
}

func (TargetsStatusUpdate) ToStatusUpdate

func (t TargetsStatusUpdate) ToStatusUpdate() eval.StatusUpdate

type YAMLConfig

type YAMLConfig struct {
	Targets []struct {
		Category string
		Kinds    []string
	}
}

Jump to

Keyboard shortcuts

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