metrics

package
v1.1.0-beta.0...-66cb425 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PhaseIdle      = "idle"
	PhaseBeginTxn  = "begin_txn"
	PhaseCommitTxn = "commit_txn"
	PhaseQuery     = "query"
	PhaseCheckTTL  = "check_ttl"
	PhaseWaitRetry = "wait_retry"
	PhaseDispatch  = "dispatch"
	PhaseWaitToken = "wait_token"
	PhaseOther     = "other"
)

Phases to trace

View Source
var (
	SelectSuccessDuration prometheus.Observer
	SelectErrorDuration   prometheus.Observer
	DeleteSuccessDuration prometheus.Observer
	DeleteErrorDuration   prometheus.Observer

	ScannedExpiredRows       prometheus.Counter
	DeleteSuccessExpiredRows prometheus.Counter
	DeleteErrorExpiredRows   prometheus.Counter

	RunningJobsCnt    prometheus.Gauge
	CancellingJobsCnt prometheus.Gauge

	ScanningTaskCnt prometheus.Gauge
	DeletingTaskCnt prometheus.Gauge

	WaterMarkScheduleDelayNames = []struct {
		Name  string
		Delay time.Duration
	}{
		{
			Name:  "01 hour",
			Delay: time.Hour,
		},
		{
			Name:  "02 hour",
			Delay: time.Hour,
		},
		{
			Name:  "06 hour",
			Delay: 6 * time.Hour,
		},
		{
			Name:  "12 hour",
			Delay: 12 * time.Hour,
		},
		{
			Name:  "24 hour",
			Delay: 24 * time.Hour,
		},
		{
			Name:  "72 hour",
			Delay: 72 * time.Hour,
		},
		{
			Name:  "one week",
			Delay: 72 * time.Hour,
		},
		{
			Name:  "others",
			Delay: math.MaxInt64,
		},
	}
)

TTL metrics

Functions

func CtxWithPhaseTracer

func CtxWithPhaseTracer(ctx context.Context, tracer *PhaseTracer) context.Context

CtxWithPhaseTracer create a new context with tracer

func InitMetricsVars

func InitMetricsVars()

InitMetricsVars init ttl metrics vars vars.

func UpdateDelayMetrics

func UpdateDelayMetrics(records map[int64]*DelayMetricsRecord)

UpdateDelayMetrics updates the metrics of TTL delay

Types

type DelayMetricsRecord

type DelayMetricsRecord struct {
	TableID               int64
	LastJobTime           time.Time
	AbsoluteDelay         time.Duration
	ScheduleRelativeDelay time.Duration
}

DelayMetricsRecord is the delay metric record for a table

type PhaseTracer

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

PhaseTracer is used to tracer the phases duration

func NewDeleteWorkerPhaseTracer

func NewDeleteWorkerPhaseTracer() *PhaseTracer

NewDeleteWorkerPhaseTracer returns a tracer for delete worker

func NewScanWorkerPhaseTracer

func NewScanWorkerPhaseTracer() *PhaseTracer

NewScanWorkerPhaseTracer returns a tracer for scan worker

func PhaseTracerFromCtx

func PhaseTracerFromCtx(ctx context.Context) *PhaseTracer

PhaseTracerFromCtx returns a tracer from a given context

func (*PhaseTracer) EndPhase

func (t *PhaseTracer) EndPhase()

EndPhase ends the current phase

func (*PhaseTracer) EnterPhase

func (t *PhaseTracer) EnterPhase(phase string)

EnterPhase enters into a new phase

func (*PhaseTracer) Phase

func (t *PhaseTracer) Phase() string

Phase returns the current phase

Jump to

Keyboard shortcuts

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