cron

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package server provides a cron job to fetch metrics from Prometheus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCronJobServer

func NewCronJobServer(name string, logger log.Interface, opts ...Option) transport.Server

Types

type CronJob

type CronJob interface {
	cron.Job
	Index() string
	Spec() CronSpec
	IsImmediate() bool
}

func WrapCronJobWithMetrics

func WrapCronJobWithMetrics(job CronJob) CronJob

WrapCronJobWithMetrics 包装一个 CronJob,使其执行时自动上报 metrics

type CronSpec

type CronSpec string
const (
	CronSpecYearly   CronSpec = "@yearly"
	CronSpecAnnually CronSpec = "@annually"
	CronSpecMonthly  CronSpec = "@monthly"
	CronSpecWeekly   CronSpec = "@weekly"
	CronSpecDaily    CronSpec = "@daily"
	CronSpecMidnight CronSpec = "@midnight"
	CronSpecHourly   CronSpec = "@hourly"
)

func CronSpecCustom

func CronSpecCustom(s, m, h, d, M, w string) CronSpec

func CronSpecEvery

func CronSpecEvery(duration time.Duration) CronSpec

type Option

type Option func(*cronJobServer)

func WithCronJobChannel

func WithCronJobChannel(ch <-chan CronJob) Option

func WithCronJobs

func WithCronJobs(jobs ...CronJob) Option

func WithRemoveJobChannel

func WithRemoveJobChannel(ch <-chan string) Option

Jump to

Keyboard shortcuts

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