cronprom

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cronprom exposes cron scheduler events as Prometheus metrics.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidOption = errors.New("cronprom: invalid option")

ErrInvalidOption reports an invalid Recorder option.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option configures New.

func WithDurationBuckets

func WithDurationBuckets(b []float64) Option

WithDurationBuckets overrides the job duration histogram buckets (seconds). Buckets must be finite, positive and strictly increasing.

func WithLatenessBuckets

func WithLatenessBuckets(b []float64) Option

WithLatenessBuckets overrides the missed-fire lateness histogram buckets (seconds). Buckets must be finite, positive and strictly increasing.

func WithNamespace

func WithNamespace(ns string) Option

WithNamespace sets the metric namespace. Default "cron".

func WithRegisterer

func WithRegisterer(r prometheus.Registerer) Option

WithRegisterer sets where collectors register. Default prometheus.DefaultRegisterer. A nil r is rejected.

type Recorder

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

Recorder records scheduler activity as Prometheus metrics. Use New.

func New

func New(opts ...Option) (*Recorder, error)

New builds and registers a Recorder; install the result with cron.WithRecorder. It returns an error wrapping ErrInvalidOption for a nil or rejected option, and the registration error if any collector clashes with an existing one.

func (*Recorder) Collect added in v0.1.1

func (r *Recorder) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Recorder) Describe added in v0.1.1

func (r *Recorder) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*Recorder) Record added in v0.1.1

func (r *Recorder) Record(raw cron.Event)

Record implements cron.Recorder and is safe for concurrent use. Job names become label values, so callers should keep them low-cardinality; entries without a name share the empty label.

Jump to

Keyboard shortcuts

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