metrics

package
v1.1.0-beta.0...-eb6cdbb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LblAction = "action"

	// Used by BackfillProgressGauge
	LblAddIndex       = "add_index"
	LblAddIndexMerge  = "add_index_merge_tmp"
	LblModifyColumn   = "modify_column"
	LblReorgPartition = "reorganize_partition"

	// Used by BackfillTotalCounter
	LblAddIdxRate         = "add_idx_rate"
	LblMergeTmpIdxRate    = "merge_tmp_idx_rate"
	LblCleanupIdxRate     = "cleanup_idx_rate"
	LblUpdateColRate      = "update_col_rate"
	LblReorgPartitionRate = "reorg_partition_rate"
)

Label constants.

View Source
const (
	LabelSession    = "session"
	LabelDomain     = "domain"
	LabelDDLOwner   = "ddl-owner"
	LabelDDL        = "ddl"
	LabelDDLWorker  = "ddl-worker"
	LabelDistReorg  = "dist-reorg"
	LabelDDLSyncer  = "ddl-syncer"
	LabelGCWorker   = "gcworker"
	LabelAnalyze    = "analyze"
	LabelWorkerPool = "worker-pool"
	LabelStats      = "stats"

	LabelBatchRecvLoop = "batch-recv-loop"
	LabelBatchSendLoop = "batch-send-loop"

	TiDB         = "tidb"
	LabelScope   = "scope"
	ScopeGlobal  = "global"
	ScopeSession = "session"
	Server       = "server"
	TiKVClient   = "tikvclient"
)

metrics labels.

View Source
const (
	LblUnretryable    = "unretryable"
	LblReachMax       = "reach_max"
	LblOK             = "ok"
	LblError          = "error"
	LblCommit         = "commit"
	LblAbort          = "abort"
	LblRollback       = "rollback"
	LblType           = "type"
	LblDb             = "db"
	LblResult         = "result"
	LblSQLType        = "sql_type"
	LblCoprType       = "copr_type"
	LblGeneral        = "general"
	LblInternal       = "internal"
	LblTxnMode        = "txn_mode"
	LblPessimistic    = "pessimistic"
	LblOptimistic     = "optimistic"
	LblStore          = "store"
	LblAddress        = "address"
	LblBatchGet       = "batch_get"
	LblGet            = "get"
	LblLockKeys       = "lock_keys"
	LblInTxn          = "in_txn"
	LblVersion        = "version"
	LblHash           = "hash"
	LblCTEType        = "cte_type"
	LblAccountLock    = "account_lock"
	LblIdle           = "idle"
	LblRunning        = "executing_sql"
	LblLockWaiting    = "waiting_for_lock"
	LblCommitting     = "committing"
	LblRollingBack    = "rolling_back"
	LblHasLock        = "has_lock"
	LblPhase          = "phase"
	LblModule         = "module"
	LblRCReadCheckTS  = "read_check"
	LblRCWriteCheckTS = "write_check"
	LblResourceGroup  = "resource_group"

	LblName = "name"

	LblFairLockingTxnUsed       = "txn-used"
	LblFairLockingTxnEffective  = "txn-effective"
	LblFairLockingStmtUsed      = "stmt-used"
	LblFairLockingStmtEffective = "stmt-effective"
	LblScope                    = "scope"
)

Label constants.

Variables

View Source
var (
	BindingCacheHitCounter  prometheus.Counter
	BindingCacheMissCounter prometheus.Counter
	BindingCacheMemUsage    prometheus.Gauge
	BindingCacheMemLimit    prometheus.Gauge
	BindingCacheNumBindings prometheus.Gauge
)

bindinfo metrics.

View Source
var (
	// RestoreImportFileSeconds records the time cost for importing a file.
	// Including download / queuing.
	RestoreImportFileSeconds prometheus.Histogram
	// RestoreUploadSSTForPiTRSeconds records the time cost for uploading SST
	// files during restoring for future PiTR.
	RestoreUploadSSTForPiTRSeconds prometheus.Histogram
	// RestoreUploadSSTMetaForPiTRSeconds records the time cost for saving metadata
	// of uploaded SSTs for future PiTR.
	RestoreUploadSSTMetaForPiTRSeconds prometheus.Histogram

	// RestoreTableCreatedCount counts how many tables created.
	RestoreTableCreatedCount prometheus.Counter

	// MetaKVBatchFiles counts how many meta KV files restored in the batch
	MetaKVBatchFiles *prometheus.HistogramVec
	// MetaKVBatchFilteredKeys counts how many meta KV entries filtered from the batch
	MetaKVBatchFilteredKeys *prometheus.HistogramVec
	// MetaKVBatchKeys counts how many meta KV entries restored in the batch
	MetaKVBatchKeys *prometheus.HistogramVec
	// MetaKVBatchSize records the total size of the meta KV entries restored in the batch
	MetaKVBatchSize *prometheus.HistogramVec

	// KVApplyBatchDuration records the duration to apply the batch of KV files
	KVApplyBatchDuration prometheus.Histogram
	// KVApplyBatchFiles counts how many KV files restored in the batch
	KVApplyBatchFiles prometheus.Histogram
	// KVApplyBatchRegions counts how many regions restored in the batch of KV files
	KVApplyBatchRegions prometheus.Histogram
	// KVApplyBatchSize records the total size of the KV files restored in the batch
	KVApplyBatchSize prometheus.Histogram
	// KVApplyRegionFiles counts how many KV files restored for a region
	KVApplyRegionFiles prometheus.Histogram

	// KVApplyTasksEvents tracks the event of the apply tasks.
	// Label: event. Possible values: "skipped", "submitted", "started", "finished".
	// `submitted` - `started` = pending tasks.
	// `finished` - `started` = running tasks.
	KVApplyTasksEvents *prometheus.CounterVec
	// KVLogFileEmittedMemory tracks the memory usage of metadata.
	// Label: status. Possible values: "0-loaded", "1-split", "2-applied".
	// `1-split` - `0-loaded` = file info used for splitting regions.
	// `2-applied` - `1-split` = file info used for running restore tasks.
	KVLogFileEmittedMemory *prometheus.CounterVec
	// KVApplyRunOverRegionsEvents tracks the event of the run over regions call.
	// Label: event. Possible values: "request-region", "retry-region", "retry-range", "region-success".
	KVApplyRunOverRegionsEvents *prometheus.CounterVec
	// KVSplitHelperMemUsage tracks the memory usage of the split helper.
	KVSplitHelperMemUsage prometheus.Gauge
)
View Source
var (
	JobsGauge            *prometheus.GaugeVec
	HandleJobHistogram   *prometheus.HistogramVec
	BatchAddIdxHistogram *prometheus.HistogramVec

	SyncerInit    = "init"
	SyncerRestart = "restart"
	SyncerClear   = "clear"
	SyncerRewatch = "rewatch"

	StateSyncerInit = "init_global_state"

	DeploySyncerHistogram      *prometheus.HistogramVec
	UpdateSelfVersionHistogram *prometheus.HistogramVec

	OwnerUpdateGlobalVersion = "update_global_version"
	OwnerCheckAllVersions    = "check_all_versions"

	UpdateGlobalState = "update_global_state"

	OwnerHandleSyncerHistogram *prometheus.HistogramVec

	// Metrics for job_worker.go.
	WorkerAddDDLJob    = "add_job"
	DDLWorkerHistogram *prometheus.HistogramVec

	// DDLRunOneStep is the label for the DDL worker operation run_one_step.
	//
	// if a DDL job runs successfully, the cost time is mostly in below structure:
	//
	// run_job
	// ├─ step-1
	// │  ├─ transit_one_step
	// │  │  ├─ run_one_step
	// │  │  │  ├─ lock_schema_ver
	// │  │  │  ├─ incr_schema_ver
	// │  │  │  ├─ async_notify
	// │  │  ├─ other common works such as register MDL, commit, etc.
	// │  ├─ wait_schema_synced
	// │  ├─ clean_mdl_info
	// ├─ step-2/3/4 ... similar as above -> done state
	// ├─ handle_job_done
	DDLRunOneStep           = "run_one_step"
	DDLWaitSchemaSynced     = "wait_schema_synced"
	DDLIncrSchemaVerOpHist  prometheus.Observer
	DDLLockSchemaVerOpHist  prometheus.Observer
	DDLRunJobOpHist         prometheus.Observer
	DDLHandleJobDoneOpHist  prometheus.Observer
	DDLTransitOneStepOpHist prometheus.Observer
	DDLLockVerDurationHist  prometheus.Observer
	DDLCleanMDLInfoHist     prometheus.Observer
	RetryableErrorCount     *prometheus.CounterVec

	CreateDDLInstance = "create_ddl_instance"
	CreateDDL         = "create_ddl"
	DDLOwner          = "owner"
	DDLCounter        *prometheus.CounterVec

	BackfillTotalCounter  *prometheus.CounterVec
	BackfillProgressGauge *prometheus.GaugeVec
	DDLJobTableDuration   *prometheus.HistogramVec
	DDLRunningJobCount    *prometheus.GaugeVec
	AddIndexScanRate      *prometheus.HistogramVec
)

Metrics for the DDL package.

View Source
var (
	// DDLAddOneTempIndexWrite records the number of writes to a temporary index.
	DDLAddOneTempIndexWrite = func(connID uint64, tableID int64, doubleWrite bool) {}
	// DDLCommitTempIndexWrite commits the writes to a temporary index.
	DDLCommitTempIndexWrite = func(connID uint64) {}
	// DDLRollbackTempIndexWrite rolls back the writes to a temporary index.
	DDLRollbackTempIndexWrite = func(connID uint64) {}
	// DDLResetTempIndexWrite resets the write count for a temporary index.
	DDLResetTempIndexWrite = func(tblID int64) {}
	// DDLClearTempIndexWrite clears the write count for a temporary index.
	DDLClearTempIndexWrite = func(connID uint64) {}
	// DDLSetTempIndexScanAndMerge sets the scan count and merge count for a temporary index.
	DDLSetTempIndexScanAndMerge = func(tableID int64, scanCnt, mergeCnt uint64) {}
)
View Source
var (
	DistSQLQueryHistogram           *prometheus.HistogramVec
	DistSQLScanKeysPartialHistogram prometheus.Histogram
	DistSQLScanKeysHistogram        prometheus.Histogram
	DistSQLPartialCountHistogram    prometheus.Histogram
	DistSQLCoprCacheCounter         *prometheus.CounterVec
	DistSQLCoprClosestReadCounter   *prometheus.CounterVec
	DistSQLCoprRespBodySize         *prometheus.HistogramVec
)

distsql metrics.

View Source
var (
	// LeaseExpireTime records the lease expire time.
	LeaseExpireTime prometheus.Gauge

	// LoadSchemaCounter records the counter of load schema.
	LoadSchemaCounter *prometheus.CounterVec

	// LoadSchemaDuration records the duration of load schema.
	LoadSchemaDuration *prometheus.HistogramVec

	// InfoCacheCounters are the counters of get/hit.
	InfoCacheCounters *prometheus.CounterVec

	// InfoCacheCounterGet is the total number of getting entry.
	InfoCacheCounterGet = "get"
	// InfoCacheCounterHit is the cache hit numbers for get.
	InfoCacheCounterHit = "hit"

	// LoadPrivilegeCounter records the counter of load privilege.
	LoadPrivilegeCounter *prometheus.CounterVec

	// LoadSysVarCacheCounter records the counter of loading sysvars
	LoadSysVarCacheCounter *prometheus.CounterVec

	SchemaValidatorStop       = "stop"
	SchemaValidatorRestart    = "restart"
	SchemaValidatorReset      = "reset"
	SchemaValidatorCacheEmpty = "cache_empty"
	SchemaValidatorCacheMiss  = "cache_miss"
	// HandleSchemaValidate records the counter of handling schema validate.
	HandleSchemaValidate *prometheus.CounterVec
)

Metrics for the domain package.

View Source
var (
	// ExecutorCounter records the number of expensive executors.
	ExecutorCounter *prometheus.CounterVec

	// StmtNodeCounter records the number of statement with the same type.
	StmtNodeCounter *prometheus.CounterVec

	// DbStmtNodeCounter records the number of statement with the same type and db.
	DbStmtNodeCounter *prometheus.CounterVec

	// ExecPhaseDuration records the duration of each execution phase.
	ExecPhaseDuration *prometheus.SummaryVec

	// OngoingTxnDurationHistogram records the duration of ongoing transactions.
	OngoingTxnDurationHistogram *prometheus.HistogramVec

	// MppCoordinatorStats records the number of mpp coordinator instances and related events
	MppCoordinatorStats *prometheus.GaugeVec

	// MppCoordinatorLatency records latencies of mpp coordinator operations.
	MppCoordinatorLatency *prometheus.HistogramVec

	// AffectedRowsCounter records the number of affected rows.
	AffectedRowsCounter *prometheus.CounterVec

	// AffectedRowsCounterInsert records the number of insert affected rows.
	AffectedRowsCounterInsert prometheus.Counter

	// AffectedRowsCounterUpdate records the number of update affected rows.
	AffectedRowsCounterUpdate prometheus.Counter

	// AffectedRowsCounterDelete records the number of delete affected rows.
	AffectedRowsCounterDelete prometheus.Counter

	// AffectedRowsCounterReplace records the number of replace affected rows.
	AffectedRowsCounterReplace prometheus.Counter

	// AffectedRowsCounterNTDMLUpdate records the number of NT-DML update affected rows.
	AffectedRowsCounterNTDMLUpdate prometheus.Counter
	// AffectedRowsCounterNTDMLDelete records the number of NT-DML delete affected rows.
	AffectedRowsCounterNTDMLDelete prometheus.Counter
	// AffectedRowsCounterNTDMLInsert records the number of NT-DML insert affected rows.
	AffectedRowsCounterNTDMLInsert prometheus.Counter
	// AffectedRowsCounterNTDMLReplace records the number of NT-DML replace affected rows.
	AffectedRowsCounterNTDMLReplace prometheus.Counter

	// NetworkTransmissionStats records the network transmission for queries
	NetworkTransmissionStats *prometheus.CounterVec
)
View Source
var (
	GCWorkerCounter                        *prometheus.CounterVec
	GCHistogram                            *prometheus.HistogramVec
	GCConfigGauge                          *prometheus.GaugeVec
	GCJobFailureCounter                    *prometheus.CounterVec
	GCActionRegionResultCounter            *prometheus.CounterVec
	GCRegionTooManyLocksCounter            prometheus.Counter
	GCUnsafeDestroyRangeFailuresCounterVec *prometheus.CounterVec
)

Metrics for the GC worker.

View Source
var (
	// GlobalSortWriteToCloudStorageDuration records the duration of writing to cloud storage.
	GlobalSortWriteToCloudStorageDuration *prometheus.HistogramVec
	// GlobalSortWriteToCloudStorageRate records the rate of writing to cloud storage.
	GlobalSortWriteToCloudStorageRate *prometheus.HistogramVec
	// GlobalSortReadFromCloudStorageDuration records the duration of reading from cloud storage.
	GlobalSortReadFromCloudStorageDuration *prometheus.HistogramVec
	// GlobalSortReadFromCloudStorageRate records the rate of reading from cloud storage.
	GlobalSortReadFromCloudStorageRate *prometheus.HistogramVec
	// GlobalSortIngestWorkerCnt records the working number of ingest workers.
	GlobalSortIngestWorkerCnt *prometheus.GaugeVec
	// GlobalSortUploadWorkerCount is the gauge of active parallel upload worker count.
	GlobalSortUploadWorkerCount prometheus.Gauge
	// MergeSortWriteBytes records the bytes written in merge sort.
	MergeSortWriteBytes prometheus.Counter
	// MergeSortReadBytes records the bytes read in merge sort.
	MergeSortReadBytes prometheus.Counter
)
View Source
var (
	// InfoSchemaV2CacheCounter records the counter of infoschema v2 cache hit/miss/evict.
	InfoSchemaV2CacheCounter *prometheus.CounterVec
	// InfoSchemaV2CacheMemUsage records the memory size of infoschema v2 cache.
	InfoSchemaV2CacheMemUsage prometheus.Gauge
	// InfoSchemaV2CacheObjCnt records the table count of infoschema v2 cache.
	InfoSchemaV2CacheObjCnt prometheus.Gauge
	// InfoSchemaV2CacheMemLimit records the memory limit of infoschema v2 cache.
	InfoSchemaV2CacheMemLimit prometheus.Gauge
	// TableByNameDuration records the duration of TableByName API for infoschema v2.
	TableByNameDuration *prometheus.HistogramVec
	// TableByNameHitDuration is TableByNameDuration with label type "hit"
	TableByNameHitDuration prometheus.Observer
	// TableByNameMissDuration is TableByNameDuration with label type "miss"
	TableByNameMissDuration prometheus.Observer
)
View Source
var (
	LastCheckpoint                    *prometheus.GaugeVec
	AdvancerOwner                     prometheus.Gauge
	AdvancerTickDuration              *prometheus.HistogramVec
	GetCheckpointBatchSize            *prometheus.HistogramVec
	RegionCheckpointRequest           *prometheus.CounterVec
	RegionCheckpointFailure           *prometheus.CounterVec
	RegionCheckpointSubscriptionEvent *prometheus.HistogramVec

	LogBackupCurrentLastRegionID            prometheus.Gauge
	LogBackupCurrentLastRegionLeaderStoreID prometheus.Gauge
)

log backup metrics. see the `Help` field for details.

View Source
var (
	GlobalAutoID      = "global"
	TableAutoIDAlloc  = "alloc"
	TableAutoIDRebase = "rebase"
	AutoIDHistogram   *prometheus.HistogramVec

	GetSchemaDiff    = "get_schema_diff"
	SetSchemaDiff    = "set_schema_diff"
	GetHistoryDDLJob = "get_history_ddl_job"

	MetaHistogram          *prometheus.HistogramVec
	ResetAutoIDConnCounter prometheus.Counter
)

Metrics

View Source
var (
	// PanicCounter measures the count of panics.
	PanicCounter *prometheus.CounterVec

	// MemoryUsage measures the usage gauge of memory.
	MemoryUsage *prometheus.GaugeVec
)
View Source
var (
	NewSessionHistogram *prometheus.HistogramVec

	WatcherClosed     = "watcher_closed"
	Cancelled         = "cancelled"
	Deleted           = "deleted"
	PutValue          = "put_value"
	SessionDone       = "session_done"
	CtxDone           = "context_done"
	WatchOwnerCounter *prometheus.CounterVec

	NoLongerOwner        = "no_longer_owner"
	CampaignOwnerCounter *prometheus.CounterVec
)

Metrics

View Source
var (
	// RawKVBatchPutDurationSeconds records the time cost for batch put
	RawKVBatchPutDurationSeconds *prometheus.HistogramVec
	// RawKVBatchPutBatchSize records the number of kv entries in the batch put
	RawKVBatchPutBatchSize *prometheus.HistogramVec
)
View Source
var (
	// EMACPUUsageGauge means exponential moving average of CPU usage
	EMACPUUsageGauge prometheus.Gauge

	// PoolConcurrencyCounter means how much concurrency in the pool
	PoolConcurrencyCounter *prometheus.GaugeVec
)
View Source
var (
	PacketIOCounter            *prometheus.CounterVec
	QueryDurationHistogram     *prometheus.HistogramVec
	QueryRPCHistogram          *prometheus.HistogramVec
	QueryProcessedKeyHistogram *prometheus.HistogramVec
	QueryTotalCounter          *prometheus.CounterVec
	ConnGauge                  *prometheus.GaugeVec
	DisconnectionCounter       *prometheus.CounterVec
	PreparedStmtGauge          prometheus.Gauge
	ExecuteErrorCounter        *prometheus.CounterVec
	CriticalErrorCounter       prometheus.Counter

	ServerStart = "server-start"
	ServerStop  = "server-stop"

	// Eventkill occurs when the server.Kill() function is called.
	EventKill = "kill"

	ServerEventCounter              *prometheus.CounterVec
	TimeJumpBackCounter             prometheus.Counter
	PlanCacheCounter                *prometheus.CounterVec
	PlanCacheMissCounter            *prometheus.CounterVec
	PlanCacheInstanceMemoryUsage    *prometheus.GaugeVec
	PlanCacheInstancePlanNumCounter *prometheus.GaugeVec
	PlanCacheProcessDuration        *prometheus.HistogramVec
	ReadFromTableCacheCounter       prometheus.Counter
	HandShakeErrorCounter           prometheus.Counter
	GetTokenDurationHistogram       prometheus.Histogram
	NumOfMultiQueryHistogram        prometheus.Histogram
	TotalQueryProcHistogram         *prometheus.HistogramVec
	TotalCopProcHistogram           *prometheus.HistogramVec
	TotalCopWaitHistogram           *prometheus.HistogramVec
	CopMVCCRatioHistogram           *prometheus.HistogramVec
	MaxProcs                        prometheus.Gauge
	GOGC                            prometheus.Gauge
	ConnIdleDurationHistogram       *prometheus.HistogramVec
	ServerInfo                      *prometheus.GaugeVec
	TokenGauge                      prometheus.Gauge
	ConfigStatus                    *prometheus.GaugeVec
	TiFlashQueryTotalCounter        *prometheus.CounterVec
	TiFlashFailedMPPStoreState      *prometheus.GaugeVec
	PDAPIExecutionHistogram         *prometheus.HistogramVec
	PDAPIRequestCounter             *prometheus.CounterVec
	CPUProfileCounter               prometheus.Counter
	LoadTableCacheDurationHistogram prometheus.Histogram
	RCCheckTSWriteConfilictCounter  *prometheus.CounterVec
	MemoryLimit                     prometheus.Gauge
	InternalSessions                prometheus.Gauge
	ActiveUser                      prometheus.Gauge
)

Metrics

View Source
var (
	AutoIDReqDuration                  prometheus.Histogram
	SessionExecuteParseDuration        *prometheus.HistogramVec
	SessionExecuteCompileDuration      *prometheus.HistogramVec
	SessionExecuteRunDuration          *prometheus.HistogramVec
	SchemaLeaseErrorCounter            *prometheus.CounterVec
	SessionRetry                       *prometheus.HistogramVec
	SessionRetryErrorCounter           *prometheus.CounterVec
	SessionRestrictedSQLCounter        prometheus.Counter
	StatementPerTransaction            *prometheus.HistogramVec
	TransactionDuration                *prometheus.HistogramVec
	StatementDeadlockDetectDuration    prometheus.Histogram
	StatementPessimisticRetryCount     prometheus.Histogram
	StatementLockKeysCount             prometheus.Histogram
	ValidateReadTSFromPDCount          prometheus.Counter
	NonTransactionalDMLCount           *prometheus.CounterVec
	TxnStatusEnteringCounter           *prometheus.CounterVec
	TxnDurationHistogram               *prometheus.HistogramVec
	LazyPessimisticUniqueCheckSetCount prometheus.Counter
	PessimisticDMLDurationByAttempt    *prometheus.HistogramVec
	ResourceGroupQueryTotalCounter     *prometheus.CounterVec
	FairLockingUsageCount              *prometheus.CounterVec
	PessimisticLockKeysDuration        prometheus.Histogram
)

Session metrics.

View Source
var (
	// SmallTxnWriteDuration uses to collect small transaction write duration.
	SmallTxnWriteDuration prometheus.Histogram
	// TxnWriteThroughput uses to collect transaction write throughput which transaction is not small.
	TxnWriteThroughput prometheus.Histogram
)
View Source
var (
	AutoAnalyzeHistogram      prometheus.Histogram
	AutoAnalyzeCounter        *prometheus.CounterVec
	StatsInaccuracyRate       prometheus.Histogram
	PseudoEstimation          *prometheus.CounterVec
	SyncLoadCounter           prometheus.Counter
	SyncLoadTimeoutCounter    prometheus.Counter
	SyncLoadDedupCounter      prometheus.Counter
	SyncLoadHistogram         prometheus.Histogram
	ReadStatsHistogram        prometheus.Histogram
	StatsCacheCounter         *prometheus.CounterVec
	StatsCacheGauge           *prometheus.GaugeVec
	StatsHealthyGauge         *prometheus.GaugeVec
	StatsDeltaLoadHistogram   prometheus.Histogram
	StatsDeltaUpdateHistogram prometheus.Histogram
	StatsUsageUpdateHistogram prometheus.Histogram

	HistoricalStatsCounter        *prometheus.CounterVec
	PlanReplayerTaskCounter       *prometheus.CounterVec
	PlanReplayerRegisterTaskGauge prometheus.Gauge
)

Stats metrics.

View Source
var (
	TelemetrySQLCTECnt                                 *prometheus.CounterVec
	TelemetryMultiSchemaChangeCnt                      prometheus.Counter
	TelemetryTablePartitionCnt                         prometheus.Counter
	TelemetryTablePartitionListCnt                     prometheus.Counter
	TelemetryTablePartitionRangeCnt                    prometheus.Counter
	TelemetryTablePartitionHashCnt                     prometheus.Counter
	TelemetryTablePartitionRangeColumnsCnt             prometheus.Counter
	TelemetryTablePartitionRangeColumnsGt1Cnt          prometheus.Counter
	TelemetryTablePartitionRangeColumnsGt2Cnt          prometheus.Counter
	TelemetryTablePartitionRangeColumnsGt3Cnt          prometheus.Counter
	TelemetryTablePartitionListColumnsCnt              prometheus.Counter
	TelemetryTablePartitionMaxPartitionsCnt            prometheus.Counter
	TelemetryAccountLockCnt                            *prometheus.CounterVec
	TelemetryTablePartitionCreateIntervalPartitionsCnt prometheus.Counter
	TelemetryTablePartitionAddIntervalPartitionsCnt    prometheus.Counter
	TelemetryTablePartitionDropIntervalPartitionsCnt   prometheus.Counter
	TelemetryExchangePartitionCnt                      prometheus.Counter
	TelemetryAddIndexIngestCnt                         prometheus.Counter
	TelemetryFlashbackClusterCnt                       prometheus.Counter
	TelemetryIndexMergeUsage                           prometheus.Counter
	TelemetryCompactPartitionCnt                       prometheus.Counter
	TelemetryReorganizePartitionCnt                    prometheus.Counter
	TelemetryDistReorgCnt                              prometheus.Counter
	TelemetryStoreBatchedQueryCnt                      prometheus.Counter
	TelemetryBatchedQueryTaskCnt                       prometheus.Counter
	TelemetryStoreBatchedCnt                           prometheus.Counter
	TelemetryStoreBatchedFallbackCnt                   prometheus.Counter
)

Metrics

View Source
var (
	TopSQLIgnoredCounter          *prometheus.CounterVec
	TopSQLReportDurationHistogram *prometheus.HistogramVec
	TopSQLReportDataHistogram     *prometheus.HistogramVec
)

Top SQL metrics.

View Source
var (
	TTLQueryDuration *prometheus.HistogramVec

	TTLProcessedExpiredRowsCounter *prometheus.CounterVec

	TTLJobStatus *prometheus.GaugeVec

	TTLTaskStatus *prometheus.GaugeVec

	TTLPhaseTime *prometheus.CounterVec

	TTLInsertRowsCount prometheus.Counter

	TTLWatermarkDelay *prometheus.GaugeVec

	TTLEventCounter *prometheus.CounterVec

	TTLSyncTimerCounter prometheus.Counter

	TTLFullRefreshTimersCounter prometheus.Counter
)

TTL metrics

View Source
var (
	// DistTaskUsedSlotsGauge is the gauge of used slots on executor node.
	DistTaskUsedSlotsGauge *prometheus.GaugeVec
)
View Source
var (
	// ResettablePlanCacheCounterFortTest be used to support reset counter in test.
	ResettablePlanCacheCounterFortTest = false
)
View Source
var (
	RunawayCheckerCounter *prometheus.CounterVec
)

Metrics Query duration by query is QueryDurationHistogram in `server.go`.

Functions

func ExecuteErrorToLabel

func ExecuteErrorToLabel(err error) string

ExecuteErrorToLabel converts an execute error to label.

func GetBackfillProgressByLabel

func GetBackfillProgressByLabel(label, schemaName, tableName, optionalColOrIdxName string) prometheus.Gauge

GetBackfillProgressByLabel returns the Gauge showing the percentage progress for the given type label.

func GetBackfillTotalByLabel

func GetBackfillTotalByLabel(label, schemaName, tableName, optionalColOrIdxName string) prometheus.Counter

GetBackfillTotalByLabel returns the Counter showing the speed of backfilling for the given type label.

func GetLazyPessimisticUniqueCheckSetCounter

func GetLazyPessimisticUniqueCheckSetCounter() int64

GetLazyPessimisticUniqueCheckSetCounter returns the counter of setting tidb_constraint_check_in_place_pessimistic to false.

func GetRegisteredImportMetrics

func GetRegisteredImportMetrics(factory promutil.Factory, constLabels prometheus.Labels) *metric.Common

GetRegisteredImportMetrics returns the registered import metrics.

func GetRegisteredJob

func GetRegisteredJob() map[int64]*metric.Common

GetRegisteredJob is used for test

func GetSavepointStmtCounter

func GetSavepointStmtCounter() int64

GetSavepointStmtCounter gets the savepoint statement executed counter.

func InitBRMetrics

func InitBRMetrics()

InitBRMetrics initializes all metrics in BR.

func InitBindInfoMetrics

func InitBindInfoMetrics()

InitBindInfoMetrics initializes bindinfo metrics.

func InitDDLMetrics

func InitDDLMetrics()

InitDDLMetrics initializes defines DDL metrics.

func InitDistSQLMetrics

func InitDistSQLMetrics()

InitDistSQLMetrics initializes distsql metrics.

func InitDistTaskMetrics

func InitDistTaskMetrics()

InitDistTaskMetrics initializes disttask metrics.

func InitDomainMetrics

func InitDomainMetrics()

InitDomainMetrics initializes domain metrics.

func InitExecutorMetrics

func InitExecutorMetrics()

InitExecutorMetrics initializes excutor metrics.

func InitGCWorkerMetrics

func InitGCWorkerMetrics()

InitGCWorkerMetrics initializes GC worker metrics.

func InitGlobalSortMetrics

func InitGlobalSortMetrics()

InitGlobalSortMetrics initializes defines global sort metrics.

func InitInfoSchemaV2Metrics

func InitInfoSchemaV2Metrics()

InitInfoSchemaV2Metrics intializes infoschema v2 related metrics.

func InitLogBackupMetrics

func InitLogBackupMetrics()

InitLogBackupMetrics initializes log backup metrics.

func InitMetaMetrics

func InitMetaMetrics()

InitMetaMetrics initializes meta metrics.

func InitMetrics

func InitMetrics()

InitMetrics is used to initialize metrics.

func InitOwnerMetrics

func InitOwnerMetrics()

InitOwnerMetrics initializes owner metrics.

func InitRawKVMetrics

func InitRawKVMetrics()

InitRawKVMetrics initializes all metrics in rawkv.

func InitResourceGroupMetrics

func InitResourceGroupMetrics()

InitResourceGroupMetrics initializes resource group metrics.

func InitResourceManagerMetrics

func InitResourceManagerMetrics()

InitResourceManagerMetrics initializes resource manager metrics.

func InitServerMetrics

func InitServerMetrics()

InitServerMetrics initializes server metrics.

func InitSessionMetrics

func InitSessionMetrics()

InitSessionMetrics initializes session metrics.

func InitSliMetrics

func InitSliMetrics()

InitSliMetrics initializes sli metrics.

func InitStatsMetrics

func InitStatsMetrics()

InitStatsMetrics initializes stats metrics.

func InitTTLMetrics

func InitTTLMetrics()

InitTTLMetrics initializes ttl metrics.

func InitTelemetryMetrics

func InitTelemetryMetrics()

InitTelemetryMetrics initializes telemetry metrics.

func InitTopSQLMetrics

func InitTopSQLMetrics()

InitTopSQLMetrics initializes top-sql metrics.

func RegisterLightningCommonMetricsForDDL

func RegisterLightningCommonMetricsForDDL(jobID int64) *metric.Common

RegisterLightningCommonMetricsForDDL returns the registered common metrics.

func RegisterMetrics

func RegisterMetrics()

RegisterMetrics registers the metrics which are ONLY used in TiDB server.

func RetLabel

func RetLabel(err error) string

RetLabel returns "ok" when err == nil and "err" when err != nil. This could be useful when you need to observe the operation result.

func ToggleSimplifiedMode

func ToggleSimplifiedMode(simplified bool)

ToggleSimplifiedMode is used to register/unregister the metrics that unused by grafana.

func UnregisterImportMetrics

func UnregisterImportMetrics(metrics *metric.Common)

UnregisterImportMetrics unregisters the registered import metrics.

func UnregisterLightningCommonMetricsForDDL

func UnregisterLightningCommonMetricsForDDL(jobID int64, metrics *metric.Common)

UnregisterLightningCommonMetricsForDDL unregisters the registered common metrics.

Types

type AccountLockCounter

type AccountLockCounter struct {
	LockUser          int64 `json:"lockUser"`
	UnlockUser        int64 `json:"unlockUser"`
	CreateOrAlterUser int64 `json:"createOrAlterUser"`
}

AccountLockCounter records the number of lock users/roles

func GetAccountLockCounter

func GetAccountLockCounter() AccountLockCounter

GetAccountLockCounter gets the AccountLockCounter

func (AccountLockCounter) Sub

Sub returns the difference of two counters.

type CTEUsageCounter

type CTEUsageCounter struct {
	NonRecursiveCTEUsed int64 `json:"nonRecursiveCTEUsed"`
	RecursiveUsed       int64 `json:"recursiveUsed"`
	NonCTEUsed          int64 `json:"nonCTEUsed"`
}

CTEUsageCounter records the usages of CTE.

func GetCTECounter

func GetCTECounter() CTEUsageCounter

GetCTECounter gets the TxnCommitCounter.

func (CTEUsageCounter) Sub

Sub returns the difference of two counters.

type DDLUsageCounter

type DDLUsageCounter struct {
	AddIndexIngestUsed   int64 `json:"add_index_ingest_used"`
	MetadataLockUsed     bool  `json:"metadata_lock_used"`
	FlashbackClusterUsed int64 `json:"flashback_cluster_used"`
	DistReorgUsed        int64 `json:"dist_reorg_used"`
}

DDLUsageCounter records the usages of DDL related features.

func GetDDLUsageCounter

func GetDDLUsageCounter() DDLUsageCounter

GetDDLUsageCounter gets the add index acceleration solution counts.

func (DDLUsageCounter) Sub

Sub returns the difference of two counters.

type ExchangePartitionUsageCounter

type ExchangePartitionUsageCounter struct {
	ExchangePartitionCnt int64 `json:"exchange_partition_cnt"`
}

ExchangePartitionUsageCounter records the usages of exchange partition.

func GetExchangePartitionCounter

func GetExchangePartitionCounter() ExchangePartitionUsageCounter

GetExchangePartitionCounter gets the TxnCommitCounter.

func (ExchangePartitionUsageCounter) Sub

Sub returns the difference of two counters.

type FairLockingUsageCounter

type FairLockingUsageCounter struct {
	TxnFairLockingUsed      int64 `json:"txn_fair_locking_used"`
	TxnFairLockingEffective int64 `json:"txn_fair_locking_effective"`
}

FairLockingUsageCounter records the usage of Fair Locking feature of pessimistic transaction.

func GetFairLockingUsageCounter

func GetFairLockingUsageCounter() FairLockingUsageCounter

GetFairLockingUsageCounter returns the Fair Locking usage counter.

func (FairLockingUsageCounter) Sub

Sub returns the difference of two counters.

type IndexMergeUsageCounter

type IndexMergeUsageCounter struct {
	IndexMergeUsed int64 `json:"index_merge_used"`
}

IndexMergeUsageCounter records the usages of IndexMerge feature.

func GetIndexMergeCounter

func GetIndexMergeCounter() IndexMergeUsageCounter

GetIndexMergeCounter gets the IndexMerge usage counter.

func (IndexMergeUsageCounter) Sub

Sub returns the difference of two counters.

type MultiSchemaChangeUsageCounter

type MultiSchemaChangeUsageCounter struct {
	MultiSchemaChangeUsed int64 `json:"multi_schema_change_used"`
}

MultiSchemaChangeUsageCounter records the usages of multi-schema change.

func GetMultiSchemaCounter

func GetMultiSchemaCounter() MultiSchemaChangeUsageCounter

GetMultiSchemaCounter gets the TxnCommitCounter.

func (MultiSchemaChangeUsageCounter) Sub

Sub returns the difference of two counters.

type NonTransactionalStmtCounter

type NonTransactionalStmtCounter struct {
	DeleteCount int64 `json:"delete"`
	UpdateCount int64 `json:"update"`
	InsertCount int64 `json:"insert"`
}

NonTransactionalStmtCounter records the usages of non-transactional statements.

func GetNonTransactionalStmtCounter

func GetNonTransactionalStmtCounter() NonTransactionalStmtCounter

GetNonTransactionalStmtCounter gets the NonTransactionalStmtCounter.

func (NonTransactionalStmtCounter) Sub

Sub returns the difference of two counters.

type StoreBatchCoprCounter

type StoreBatchCoprCounter struct {
	// BatchSize is the global value of `tidb_store_batch_size`
	BatchSize int `json:"batch_size"`
	// BatchedQuery is the counter of queries that use this feature.
	BatchedQuery int64 `json:"query"`
	// BatchedQueryTask is the counter of total tasks in queries above.
	BatchedQueryTask int64 `json:"tasks"`
	// BatchedCount is the counter of successfully batched tasks.
	BatchedCount int64 `json:"batched"`
	// BatchedFallbackCount is the counter of fallback batched tasks by region miss.
	BatchedFallbackCount int64 `json:"batched_fallback"`
}

StoreBatchCoprCounter records the usages of batch copr statements.

func GetStoreBatchCoprCounter

func GetStoreBatchCoprCounter() StoreBatchCoprCounter

GetStoreBatchCoprCounter gets the IndexMerge usage counter.

func (StoreBatchCoprCounter) Sub

Sub returns the difference of two counters.

type TablePartitionUsageCounter

type TablePartitionUsageCounter struct {
	TablePartitionCnt                         int64 `json:"table_partition_cnt"`
	TablePartitionListCnt                     int64 `json:"table_partition_list_cnt"`
	TablePartitionRangeCnt                    int64 `json:"table_partition_range_cnt"`
	TablePartitionHashCnt                     int64 `json:"table_partition_hash_cnt"`
	TablePartitionRangeColumnsCnt             int64 `json:"table_partition_range_columns_cnt"`
	TablePartitionRangeColumnsGt1Cnt          int64 `json:"table_partition_range_columns_gt_1_cnt"`
	TablePartitionRangeColumnsGt2Cnt          int64 `json:"table_partition_range_columns_gt_2_cnt"`
	TablePartitionRangeColumnsGt3Cnt          int64 `json:"table_partition_range_columns_gt_3_cnt"`
	TablePartitionListColumnsCnt              int64 `json:"table_partition_list_columns_cnt"`
	TablePartitionMaxPartitionsCnt            int64 `json:"table_partition_max_partitions_cnt"`
	TablePartitionCreateIntervalPartitionsCnt int64 `json:"table_partition_create_interval_partitions_cnt"`
	TablePartitionAddIntervalPartitionsCnt    int64 `json:"table_partition_add_interval_partitions_cnt"`
	TablePartitionDropIntervalPartitionsCnt   int64 `json:"table_partition_drop_interval_partitions_cnt"`
	TablePartitionComactCnt                   int64 `json:"table_TablePartitionComactCnt"`
	TablePartitionReorganizePartitionCnt      int64 `json:"table_reorganize_partition_cnt"`
}

TablePartitionUsageCounter records the usages of table partition.

func GetTablePartitionCounter

func GetTablePartitionCounter() TablePartitionUsageCounter

GetTablePartitionCounter gets the TxnCommitCounter.

func ResetTablePartitionCounter

func ResetTablePartitionCounter(pre TablePartitionUsageCounter) TablePartitionUsageCounter

ResetTablePartitionCounter gets the TxnCommitCounter.

func (TablePartitionUsageCounter) Cal

Cal returns the difference of two counters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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