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 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) EnterPhase ¶
func (t *PhaseTracer) EnterPhase(phase string)
EnterPhase enters into a new phase
Click to show internal directories.
Click to hide internal directories.