backend

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupMetrics

func CleanupMetrics(ctx context.Context, config *Config, dryRun bool) error

Pick metrics from the backend where the TTL has expired and remove them from the priority and colour sets and the TTL sorted set itself.

func MetricGenerator

func MetricGenerator(name string, ttl time.Duration) func(int, string) Metric

Metric generator closure

Types

type Config

type Config struct {
	ConfigDir   string
	RestyClient *resty.Client
	RedisClient *redis.Client
	Publisher   *Publisher
}

type Metric

type Metric struct {
	Name     string
	Priority int
	Colour   string
	TTL      time.Time
}

type Publisher

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

Publish publishes the data to the backend

func NewPublisher

func NewPublisher(address, prefix string) *Publisher

NewPublisher creates a new Publisher

func (*Publisher) ListMetrics added in v1.1.1

func (p *Publisher) ListMetrics(ctx context.Context, config *Config) ([]Metric, error)

List metrics

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, metric Metric) error

Publish publishes the data to the backend

type Range

type Range struct {
	From     float64 `koanf:"from"`
	To       float64 `koanf:"to"`
	Priority int     `koanf:"priority"`
	Colour   string  `koanf:"colour"`
}

Jump to

Keyboard shortcuts

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