Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteErrorToLabel(err error) string
- func GenerateReorgLabel(label string, schemaName string, tableName string) string
- func GetBackfillProgressByLabel(label string, schemaName string, tableName string) prometheus.Gauge
- func GetRegisteredImportMetrics(factory promutil.Factory, constLabels prometheus.Labels) *metric.Common
- func InitBindInfoMetrics()
- func InitDDLMetrics()
- func InitDistSQLMetrics()
- func InitDistTaskMetrics()
- func InitDomainMetrics()
- func InitExecutorMetrics()
- func InitGCWorkerMetrics()
- func InitGlobalSortMetrics()
- func InitInfoSchemaV2Metrics()
- func InitLogBackupMetrics()
- func InitMetaMetrics()
- func InitMetrics()
- func InitOwnerMetrics()
- func InitResourceGroupMetrics()
- func InitResourceManagerMetrics()
- func InitServerMetrics()
- func InitSessionMetrics()
- func InitSliMetrics()
- func InitStatsMetrics()
- func InitTTLMetrics()
- func InitTopSQLMetrics()
- func NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
- func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
- func NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
- func NewSummaryVec(opts prometheus.SummaryOpts, labelNames []string) *prometheus.SummaryVec
- func RegisterMetrics()
- func RetLabel(err error) string
- func SetConstLabels(kv ...string)
- func ToggleSimplifiedMode(simplified bool)
- func UnregisterImportMetrics(metrics *metric.Common)
- func UpdateMetricsForAddTask(task *proto.TaskBase)
- func UpdateMetricsForFinishTask(task *proto.Task)
- func UpdateMetricsForRunTask(task *proto.Task)
- func UpdateMetricsForScheduleTask(task *proto.TaskBase)
Constants ¶
const ( LblAction = "action" LblAddIndex = "add_index" LblAddIndexMerge = "add_index_merge_tmp" LblModifyColumn = "modify_column" LblReorgPartition = "reorganize_partition" )
Label constants.
const ( SchedulingStatus = "scheduling" WaitingStatus = "waiting" RunningStatus = "running" CompletedStatus = "completed" )
status for task
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" LabelBatchRecvLoop = "batch-recv-loop" LabelBatchSendLoop = "batch-send-loop" TiDB = "tidb" LabelScope = "scope" ScopeGlobal = "global" ScopeSession = "session" Server = "server" TiKVClient = "tikvclient" )
metrics labels.
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 ¶
var ( BindingCacheHitCounter prometheus.Counter BindingCacheMissCounter prometheus.Counter BindingCacheMemUsage prometheus.Gauge BindingCacheMemLimit prometheus.Gauge BindingCacheNumBindings prometheus.Gauge )
bindinfo metrics.
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 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.
var ( DistSQLQueryHistogram *prometheus.HistogramVec DistSQLScanKeysPartialHistogram prometheus.Histogram DistSQLScanKeysHistogram prometheus.Histogram DistSQLPartialCountHistogram prometheus.Histogram DistSQLCoprCacheCounter *prometheus.CounterVec DistSQLCoprClosestReadCounter *prometheus.CounterVec DistSQLCoprRespBodySize *prometheus.HistogramVec )
distsql metrics.
var ( //DistTaskGauge is the gauge of dist task count. DistTaskGauge *prometheus.GaugeVec //DistTaskStartTimeGauge is the gauge of dist task count. DistTaskStartTimeGauge *prometheus.GaugeVec // DistTaskUsedSlotsGauge is the gauge of used slots on executor node. DistTaskUsedSlotsGauge *prometheus.GaugeVec )
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.
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 )
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.
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 )
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 // 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 )
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.
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
var ( // PanicCounter measures the count of panics. PanicCounter *prometheus.CounterVec // MemoryUsage measures the usage gauge of memory. MemoryUsage *prometheus.GaugeVec )
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
var ( // EMACPUUsageGauge means exponential moving average of CPU usage EMACPUUsageGauge prometheus.Gauge // PoolConcurrencyCounter means how much concurrency in the pool PoolConcurrencyCounter *prometheus.GaugeVec )
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 )
Metrics
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 )
Session metrics.
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 )
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 HistoricalStatsCounter *prometheus.CounterVec PlanReplayerTaskCounter *prometheus.CounterVec PlanReplayerRegisterTaskGauge prometheus.Gauge )
Stats metrics.
var ( TopSQLIgnoredCounter *prometheus.CounterVec TopSQLReportDurationHistogram *prometheus.HistogramVec TopSQLReportDataHistogram *prometheus.HistogramVec )
Top SQL metrics.
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
var ( // ResettablePlanCacheCounterFortTest be used to support reset counter in test. ResettablePlanCacheCounterFortTest = false )
var (
RunawayCheckerCounter *prometheus.CounterVec
)
Metrics Query duration by query is QueryDurationHistogram in `server.go`.
Functions ¶
func ExecuteErrorToLabel ¶
ExecuteErrorToLabel converts an execute error to label.
func GenerateReorgLabel ¶
GenerateReorgLabel returns the label with schema name and table name.
func GetBackfillProgressByLabel ¶
func GetBackfillProgressByLabel(label string, schemaName string, tableName string) prometheus.Gauge
GetBackfillProgressByLabel returns the Gauge showing the percentage progress for the given type label.
func GetRegisteredImportMetrics ¶
func GetRegisteredImportMetrics(factory promutil.Factory, constLabels prometheus.Labels) *metric.Common
GetRegisteredImportMetrics returns the registered import metrics.
func InitBindInfoMetrics ¶
func InitBindInfoMetrics()
InitBindInfoMetrics initializes bindinfo metrics.
func InitDistTaskMetrics ¶
func InitDistTaskMetrics()
InitDistTaskMetrics initializes disttask 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 InitResourceGroupMetrics ¶
func InitResourceGroupMetrics()
InitResourceGroupMetrics initializes resource group metrics.
func InitResourceManagerMetrics ¶
func InitResourceManagerMetrics()
InitResourceManagerMetrics initializes resource manager metrics.
func NewCounter ¶
func NewCounter(opts prometheus.CounterOpts) prometheus.Counter
NewCounter wraps a prometheus.NewCounter.
func NewCounterVec ¶
func NewCounterVec(opts prometheus.CounterOpts, labelNames []string) *prometheus.CounterVec
NewCounterVec wraps a prometheus.NewCounterVec.
func NewGauge ¶
func NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge wraps a prometheus.NewGauge.
func NewGaugeVec ¶
func NewGaugeVec(opts prometheus.GaugeOpts, labelNames []string) *prometheus.GaugeVec
NewGaugeVec wraps a prometheus.NewGaugeVec.
func NewHistogram ¶
func NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram wraps a prometheus.NewHistogram.
func NewHistogramVec ¶
func NewHistogramVec(opts prometheus.HistogramOpts, labelNames []string) *prometheus.HistogramVec
NewHistogramVec wraps a prometheus.NewHistogramVec.
func NewSummaryVec ¶
func NewSummaryVec(opts prometheus.SummaryOpts, labelNames []string) *prometheus.SummaryVec
NewSummaryVec wraps a prometheus.NewSummaryVec.
func RegisterMetrics ¶
func RegisterMetrics()
RegisterMetrics registers the metrics which are ONLY used in TiDB server.
func RetLabel ¶
RetLabel returns "ok" when err == nil and "err" when err != nil. This could be useful when you need to observe the operation result.
func SetConstLabels ¶
func SetConstLabels(kv ...string)
SetConstLabels sets constant labels for metrics.
func ToggleSimplifiedMode ¶
func ToggleSimplifiedMode(simplified bool)
ToggleSimplifiedMode is used to register/unregister the metrics that unused by grafana.
func UnregisterImportMetrics ¶
UnregisterImportMetrics unregisters the registered import metrics.
func UpdateMetricsForAddTask ¶
UpdateMetricsForAddTask update metrics when a task is added
func UpdateMetricsForFinishTask ¶
UpdateMetricsForFinishTask update metrics when a task is finished
func UpdateMetricsForRunTask ¶
UpdateMetricsForRunTask update metrics when a task starts running
func UpdateMetricsForScheduleTask ¶
UpdateMetricsForScheduleTask update metrics when a task is added
Types ¶
This section is empty.