5c69001e27
* Add metrics each run of job * Fix lint * Fix test lint * Fix backwards job status * Add tags * Comment example * Rename it * Fix some names * Fix readme * update readme, examples, naming * fix unrelated test that was leaking scheduler * remove overzealous leak detection * rename interface methods --------- Co-authored-by: gorodet-sky <gorodetsky.dev@gmail.com>
27 lines
849 B
Go
27 lines
849 B
Go
package gocron
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// JobStatus is the status of job run that should be collected with the metric.
|
|
type JobStatus string
|
|
|
|
// The different statuses of job that can be used.
|
|
const (
|
|
Fail JobStatus = "fail"
|
|
Success JobStatus = "success"
|
|
)
|
|
|
|
// Monitor represents the interface to collect jobs metrics.
|
|
type Monitor interface {
|
|
// IncrementJob will provide details about the job and expects the underlying implementation
|
|
// to handle instantiating and incrementing a value
|
|
IncrementJob(id uuid.UUID, name string, tags []string, status JobStatus)
|
|
// RecordJobTiming will provide details about the job and the timing and expects the underlying implementation
|
|
// to handle instantiating and recording the value
|
|
RecordJobTiming(startTime, endTime time.Time, id uuid.UUID, name string, tags []string)
|
|
}
|