Documentation
¶
Index ¶
- Constants
- Variables
- func AddGlobalMemArbitratorCounter(counterVec prometheus.CounterVec, taskType string, count int64)
- func DDLClearBackfillMetrics(tableID int64)
- func DDLHasBackfillMetrics() bool
- func ExecuteErrorToLabel(err error) string
- func GetBackfillLabelsForTest(tableID int64) map[string]struct{}
- func GetBackfillProgressByTableID(tableID int64, label, schemaName, tableName, optionalColOrIdxName string) prometheus.Gauge
- func GetBackfillTotalByTableID(tableID int64, label, schemaName, tableName, optionalColOrIdxName string) prometheus.Counter
- func GetLazyPessimisticUniqueCheckSetCounter() int64
- func GetRegisteredImportMetrics(factory promutil.Factory, constLabels prometheus.Labels) *metric.Common
- func GetRegisteredJob() map[int64]*metric.Common
- func GetSavepointStmtCounter() int64
- func InitBRMetrics()
- func InitBindInfoMetrics()
- func InitDDLMetrics()
- func InitDistSQLMetrics()
- func InitDomainMetrics()
- func InitExecutorMetrics()
- func InitGCWorkerMetrics()
- func InitGlobalSortMetrics()
- func InitInfoSchemaV2Metrics()
- func InitLogBackupMetrics()
- func InitMemoryMetrics()
- func InitMetaMetrics()
- func InitMetrics()
- func InitOwnerMetrics()
- func InitRUV2Metrics()
- func InitRawKVMetrics()
- func InitResourceGroupMetrics()
- func InitResourceManagerMetrics()
- func InitServerMetrics()
- func InitSessionMetrics()
- func InitSliMetrics()
- func InitStatsMetrics()
- func InitStmtSummaryMetrics()
- func InitTTLMetrics()
- func InitTelemetryMetrics()
- func InitTopSQLMetrics()
- func Register(cs ...prometheus.Collector)
- func RegisterLightningCommonMetricsForDDL(jobID int64) *metric.Common
- func RegisterMetrics()
- func ResetGlobalMemArbitratorGauge()
- func RetLabel(err error) string
- func SetGlobalMemArbitratorGauge(gaugeVec prometheus.GaugeVec, taskType string, value int64)
- func SetStmtSummaryWindowMetrics(typ string, recordCount, evictedCount float64)
- func ToggleSimplifiedMode(simplified bool)
- func Unregister(cs ...prometheus.Collector)
- func UnregisterImportMetrics(metrics *metric.Common)
- func UnregisterLightningCommonMetricsForDDL(jobID int64, metrics *metric.Common)
- type AccountLockCounter
- type CTEUsageCounter
- type DDLUsageCounter
- type ExchangePartitionUsageCounter
- type FairLockingUsageCounter
- type IndexMergeUsageCounter
- type MultiSchemaChangeUsageCounter
- type NonTransactionalStmtCounter
- type StoreBatchCoprCounter
- type TablePartitionUsageCounter
Constants ¶
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.
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.
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" // For TLS LblCipher = "cipher" )
Label constants.
const ( // StmtSummaryTypeV1 marks metrics reported by the legacy statement summary implementation. StmtSummaryTypeV1 = "v1" // StmtSummaryTypeV2 marks metrics reported by the persistent statement summary implementation. StmtSummaryTypeV2 = "v2" )
Statement summary metrics.
const StageTotal = "total"
StageTotal is used in the "stage" label of GCHistogram to represent the total time of a turn of GC.
Variables ¶
var ( BindingCacheHitCounter prometheus.Counter BindingCacheMissCounter prometheus.Counter BindingCacheMemUsage prometheus.Gauge BindingCacheMemLimit prometheus.Gauge BindingCacheNumBindings prometheus.Gauge )
bindinfo metrics.
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 )
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.
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) {} )
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 ( // 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 // 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 // IndexLookUpExecutorDuration records the duration of index look up executor IndexLookUpExecutorDuration *prometheus.HistogramVec // IndexLookRowsCounter records the number of rows in index look up executor IndexLookRowsCounter *prometheus.CounterVec // IndexLookUpExecutorRowNumber records the number of rows scanned in one index look up executor IndexLookUpExecutorRowNumber *prometheus.HistogramVec // IndexLookUpCopTaskCount records the number of cop tasks in index look up executor IndexLookUpCopTaskCount *prometheus.CounterVec )
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 // MergeSortWriteBytes records the bytes written in merge sort. MergeSortWriteBytes prometheus.Counter // MergeSortReadBytes records the bytes read in merge sort. MergeSortReadBytes prometheus.Counter )
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 )
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 ( GlobalMemArbitrationDuration prometheus.Histogram GlobalMemArbitratorWorkMode prometheus.GaugeVec GlobalMemArbitratorQuota prometheus.GaugeVec GlobalMemArbitratorWaitingTask prometheus.GaugeVec GlobalMemArbitratorRuntimeMemMagnifi prometheus.Gauge GlobalMemArbitratorRootPool prometheus.GaugeVec GlobalMemArbitratorEventCounter prometheus.CounterVec GlobalMemArbitratorSubEvents struct { PoolInitHitDigest prometheus.Counter PoolInitReserve prometheus.Counter PoolInitMediumQuota prometheus.Counter PoolInitNone prometheus.Counter } GlobalMemArbitratorTaskExecCounter prometheus.CounterVec GlobalMemArbitratorSubTasks struct { CancelWaitAverseParse prometheus.Counter CancelWaitAversePlan prometheus.Counter CancelStandardModeParse prometheus.Counter CancelStandardModePlan prometheus.Counter ForceKillParse prometheus.Counter ForceKillPlan prometheus.Counter NoLimit prometheus.Counter } )
Memory metrics.
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 ( // 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 )
var ( RunawayCheckerCounter *prometheus.CounterVec RunawayFlusherCounter *prometheus.CounterVec RunawayFlusherAddCounter *prometheus.CounterVec RunawayFlusherBatchSizeHistogram *prometheus.HistogramVec RunawayFlusherDurationHistogram *prometheus.HistogramVec RunawayFlusherIntervalHistogram *prometheus.HistogramVec RunawaySyncerDurationHistogram *prometheus.HistogramVec RunawaySyncerIntervalHistogram *prometheus.HistogramVec RunawaySyncerCheckpointGauge *prometheus.GaugeVec RunawaySyncerCounter *prometheus.CounterVec )
Metrics Query duration by query is QueryDurationHistogram in `server.go`.
var ( // EMACPUUsageGauge means exponential moving average of CPU usage EMACPUUsageGauge prometheus.Gauge // PoolConcurrencyCounter means how much concurrency in the pool PoolConcurrencyCounter *prometheus.GaugeVec )
var ( RUV2ResultChunkCells prometheus.Counter RUV2ExecutorL1 *prometheus.CounterVec RUV2ExecutorL2 *prometheus.CounterVec RUV2ExecutorL3 *prometheus.CounterVec RUV2ExecutorL5InsertRows prometheus.Counter RUV2PlanCnt prometheus.Counter RUV2PlanDeriveStatsPaths prometheus.Counter RUV2ResourceManagerReadCnt prometheus.Counter RUV2ResourceManagerWriteCnt prometheus.Counter RUV2SessionParserTotal prometheus.Counter RUV2TxnCnt prometheus.Counter RUV2TiKVKVEngineCacheMiss prometheus.Counter RUV2TiKVCoprocessorExecutorIterations prometheus.Counter RUV2TiKVCoprocessorResponseBytes prometheus.Counter RUV2TiKVRaftstoreStoreWriteTriggerWB prometheus.Counter RUV2TiKVStorageProcessedKeysBatchGet prometheus.Counter RUV2TiKVStorageProcessedKeysGet prometheus.Counter RUV2TiKVCoprocessorWorkTotal *prometheus.CounterVec )
RUv2 metrics.
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 SlowQueryCounter *prometheus.CounterVec 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 // TLS TLSVersion *prometheus.CounterVec TLSCipher *prometheus.CounterVec )
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 PessimisticLockKeysDuration prometheus.Histogram )
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 ManualAnalyzeCounter *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.
var ( // StmtSummaryWindowRecordCount is a gauge that tracks the number of statement // summary records in the current statement summary window. StmtSummaryWindowRecordCount *prometheus.GaugeVec // StmtSummaryWindowEvictedCount is a gauge that tracks the number of LRU // evictions that have occurred in the current statement summary window. // This value resets to 0 when the window rotates. StmtSummaryWindowEvictedCount *prometheus.GaugeVec )
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
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 )
Functions ¶
func AddGlobalMemArbitratorCounter ¶
func AddGlobalMemArbitratorCounter(counterVec prometheus.CounterVec, taskType string, count int64)
AddGlobalMemArbitratorCounter adds a counter for the global memory arbitrator.
func DDLClearBackfillMetrics ¶
func DDLClearBackfillMetrics(tableID int64)
DDLClearBackfillMetrics deletes all backfill-related metric series registered for the given table ID key.
func DDLHasBackfillMetrics ¶
func DDLHasBackfillMetrics() bool
DDLHasBackfillMetrics reports whether there are any registered backfill metrics.
func ExecuteErrorToLabel ¶
ExecuteErrorToLabel converts an execute error to label.
func GetBackfillLabelsForTest ¶
GetBackfillLabelsForTest returns the registered label set for the given table ID. It is only used in tests.
func GetBackfillProgressByTableID ¶
func GetBackfillProgressByTableID(tableID int64, label, schemaName, tableName, optionalColOrIdxName string) prometheus.Gauge
GetBackfillProgressByTableID returns the Gauge for the given table ID and type label. It also tracks the label for later cleanup.
func GetBackfillTotalByTableID ¶
func GetBackfillTotalByTableID(tableID int64, label, schemaName, tableName, optionalColOrIdxName string) prometheus.Counter
GetBackfillTotalByTableID returns the Counter for the given table ID and type label. It also tracks the label for later cleanup.
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 ¶
GetRegisteredJob is used for test
func GetSavepointStmtCounter ¶
func GetSavepointStmtCounter() int64
GetSavepointStmtCounter gets the savepoint statement executed counter.
func InitBindInfoMetrics ¶
func InitBindInfoMetrics()
InitBindInfoMetrics initializes bindinfo 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 InitMemoryMetrics ¶
func InitMemoryMetrics()
InitMemoryMetrics initializes the memory metrics for the global memory arbitrator.
func InitResourceGroupMetrics ¶
func InitResourceGroupMetrics()
InitResourceGroupMetrics initializes resource group metrics.
func InitResourceManagerMetrics ¶
func InitResourceManagerMetrics()
InitResourceManagerMetrics initializes resource manager metrics.
func InitStmtSummaryMetrics ¶
func InitStmtSummaryMetrics()
InitStmtSummaryMetrics initializes statement summary metrics.
func InitTelemetryMetrics ¶
func InitTelemetryMetrics()
InitTelemetryMetrics initializes telemetry metrics.
func RegisterLightningCommonMetricsForDDL ¶
RegisterLightningCommonMetricsForDDL returns the registered common metrics.
func RegisterMetrics ¶
func RegisterMetrics()
RegisterMetrics registers the metrics which are ONLY used in TiDB server.
func ResetGlobalMemArbitratorGauge ¶
func ResetGlobalMemArbitratorGauge()
ResetGlobalMemArbitratorGauge resets all gauges for the global memory arbitrator to zero.
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 SetGlobalMemArbitratorGauge ¶
func SetGlobalMemArbitratorGauge(gaugeVec prometheus.GaugeVec, taskType string, value int64)
SetGlobalMemArbitratorGauge sets a gauge for the global memory arbitrator.
func SetStmtSummaryWindowMetrics ¶
SetStmtSummaryWindowMetrics reports statement summary window metrics for a given implementation type.
func ToggleSimplifiedMode ¶
func ToggleSimplifiedMode(simplified bool)
ToggleSimplifiedMode is used to register/unregister the metrics that unused by grafana.
func Unregister ¶
func Unregister(cs ...prometheus.Collector)
Unregister unregisters custom collectors.
func UnregisterImportMetrics ¶
UnregisterImportMetrics unregisters the registered import metrics.
func UnregisterLightningCommonMetricsForDDL ¶
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 ¶
func (c AccountLockCounter) Sub(rhs AccountLockCounter) AccountLockCounter
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 (CTEUsageCounter) Sub ¶
func (c CTEUsageCounter) Sub(rhs CTEUsageCounter) CTEUsageCounter
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 ¶
func (a DDLUsageCounter) Sub(rhs DDLUsageCounter) DDLUsageCounter
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 ¶
func (c ExchangePartitionUsageCounter) Sub(rhs ExchangePartitionUsageCounter) ExchangePartitionUsageCounter
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 ¶
func (i FairLockingUsageCounter) Sub(rhs FairLockingUsageCounter) FairLockingUsageCounter
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 ¶
func (i IndexMergeUsageCounter) Sub(rhs IndexMergeUsageCounter) IndexMergeUsageCounter
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 ¶
func (c MultiSchemaChangeUsageCounter) Sub(rhs MultiSchemaChangeUsageCounter) MultiSchemaChangeUsageCounter
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 ¶
func (n NonTransactionalStmtCounter) Sub(rhs NonTransactionalStmtCounter) NonTransactionalStmtCounter
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 ¶
func (n StoreBatchCoprCounter) Sub(rhs StoreBatchCoprCounter) StoreBatchCoprCounter
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 ¶
func (c TablePartitionUsageCounter) Cal(rhs TablePartitionUsageCounter) TablePartitionUsageCounter
Cal returns the difference of two counters.