job

package
v0.0.0-...-73b793f Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WatchJobsFile

func WatchJobsFile(name, mtrBin, watchSchedule string, collector *Collector)

Types

type Collector

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

func NewCollector

func NewCollector() *Collector

func (*Collector) AddJob

func (c *Collector) AddJob(job JobMeta) bool

func (*Collector) RemoveJob

func (c *Collector) RemoveJob(label string) bool

func (*Collector) ServeHTTP

func (c *Collector) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP writes promtheues styled metrics about the last executed `mtr` run, see https://prometheus.io/docs/instrumenting/exposition_formats/#line-format

NOTE: at the moment, no use of github.com/prometheus/client_golang/prometheus because overhead in size and complexity. once mtr-exporter requires features like push-gateway-export or graphite export or the like, we switch.

func (*Collector) SetRenderDeprecatedMetrics

func (c *Collector) SetRenderDeprecatedMetrics(f bool) *Collector

func (*Collector) UpdateJob

func (c *Collector) UpdateJob(job JobMeta) bool

type Job

type Job struct {
	JobMeta

	UpdateFn func(JobMeta) bool
	// contains filtered or unexported fields
}

func NewJob

func NewJob(mtr string, args []string, schedule string) *Job

func (*Job) Launch

func (job *Job) Launch() error

func (*Job) Run

func (job *Job) Run()

cron.v3 interface

type JobMeta

type JobMeta struct {
	Report   mtr.Report
	Launched time.Time
	Duration time.Duration
	Schedule string
	Label    string
	CmdLine  string
}

type Jobs

type Jobs []*Job

func ParseJobFile

func ParseJobFile(filename, mtr string) (jobs Jobs, cksum []byte, err error)

func ParseJobs

func ParseJobs(r io.Reader, mtr string) (Jobs, error)

func (Jobs) CollectedReports

func (jobs Jobs) CollectedReports() int

func (Jobs) Count

func (jobs Jobs) Count() int

func (Jobs) Empty

func (jobs Jobs) Empty() bool

func (Jobs) ReSchedule

func (jobs Jobs) ReSchedule(scheduler *cron.Cron, collector *Collector) error

Jump to

Keyboard shortcuts

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