Documentation
¶
Index ¶
- Constants
- Variables
- func GetTelemetryStatus(etcdClient *clientv3.Client) (string, error)
- func GetTrackingID(etcdClient *clientv3.Client) (string, error)
- func InitialRun(ctx sessionctx.Context, etcdClient *clientv3.Client) error
- func IsTelemetryEnabled(ctx sessionctx.Context) (bool, error)
- func PostReportTelemetryDataForTest()
- func PostSavepointCount()
- func PreviewUsageData(ctx sessionctx.Context, etcdClient *clientv3.Client) (string, error)
- func ReportUsageData(ctx sessionctx.Context, etcdClient *clientv3.Client) error
- func ResetTrackingID(etcdClient *clientv3.Client) (string, error)
- func RotateSubWindow()
- type BuiltinFunctionsUsage
- type ClusterIndexUsage
- type NewClusterIndexUsage
- type SlowQueryBucket
- type TableClusteredInfo
- type TxnUsage
Constants ¶
const ( // WindowSize determines how long some data is aggregated by. WindowSize = 1 * time.Hour // SubWindowSize determines how often data is rotated. SubWindowSize = 1 * time.Minute )
const ( // OwnerKey is the telemetry owner path that is saved to etcd. OwnerKey = "/tidb/telemetry/owner" // Prompt is the prompt for telemetry owner manager. Prompt = "telemetry" // ReportInterval is the interval of the report. ReportInterval = 6 * time.Hour )
Variables ¶
var ( // CurrentExecuteCount is CurrentExecuteCount CurrentExecuteCount atomic.Uint64 // CurrentTiFlashPushDownCount is CurrentTiFlashPushDownCount CurrentTiFlashPushDownCount atomic.Uint64 // CurrentTiFlashExchangePushDownCount is CurrentTiFlashExchangePushDownCount CurrentTiFlashExchangePushDownCount atomic.Uint64 // CurrentCoprCacheHitRatioGTE0Count is CurrentCoprCacheHitRatioGTE1Count CurrentCoprCacheHitRatioGTE0Count atomic.Uint64 // CurrentCoprCacheHitRatioGTE1Count is CurrentCoprCacheHitRatioGTE1Count CurrentCoprCacheHitRatioGTE1Count atomic.Uint64 // CurrentCoprCacheHitRatioGTE10Count is CurrentCoprCacheHitRatioGTE10Count CurrentCoprCacheHitRatioGTE10Count atomic.Uint64 // CurrentCoprCacheHitRatioGTE20Count is CurrentCoprCacheHitRatioGTE20Count CurrentCoprCacheHitRatioGTE20Count atomic.Uint64 // CurrentCoprCacheHitRatioGTE40Count is CurrentCoprCacheHitRatioGTE40Count CurrentCoprCacheHitRatioGTE40Count atomic.Uint64 // CurrentCoprCacheHitRatioGTE80Count is CurrentCoprCacheHitRatioGTE80Count CurrentCoprCacheHitRatioGTE80Count atomic.Uint64 // CurrentCoprCacheHitRatioGTE100Count is CurrentCoprCacheHitRatioGTE100Count CurrentCoprCacheHitRatioGTE100Count atomic.Uint64 // CurrentTiflashTableScanCount count the number of tiflash table scan and tiflash partition table scan CurrentTiflashTableScanCount atomic.Uint64 // CurrentTiflashTableScanWithFastScanCount count the number of tiflash table scan and tiflash partition table scan which use fastscan CurrentTiflashTableScanWithFastScanCount atomic.Uint64 )
var GetDomainInfoSchema func(sessionctx.Context) infoschema.InfoSchema
GetDomainInfoSchema is used by the telemetry package to get the latest schema information while avoiding circle dependency with domain package.
var GlobalBuiltinFunctionsUsage = &builtinFunctionsUsageCollector{usageData: make(BuiltinFunctionsUsage)}
GlobalBuiltinFunctionsUsage is used to collect builtin functions usage information
Functions ¶
func GetTelemetryStatus ¶
GetTelemetryStatus returns the telemetry status saved in etcd.
func GetTrackingID ¶
GetTrackingID gets the current tracking ID. It is possible that return value is empty, which means the ID is not generated yet.
func InitialRun ¶
func InitialRun(ctx sessionctx.Context, etcdClient *clientv3.Client) error
InitialRun reports the Telmetry configuration and trigger an initial run
func IsTelemetryEnabled ¶
func IsTelemetryEnabled(ctx sessionctx.Context) (bool, error)
IsTelemetryEnabled check whether telemetry enabled.
func PostReportTelemetryDataForTest ¶
func PostReportTelemetryDataForTest()
PostReportTelemetryDataForTest is for test.
func PreviewUsageData ¶
PreviewUsageData returns a preview of the usage data that is going to be reported.
func ReportUsageData ¶
func ReportUsageData(ctx sessionctx.Context, etcdClient *clientv3.Client) error
ReportUsageData generates the latest usage data and sends it to PingCAP. Status will be saved to etcd. Status update failures will be returned.
func ResetTrackingID ¶
ResetTrackingID generates a new tracking ID.
Types ¶
type BuiltinFunctionsUsage ¶
BuiltinFunctionsUsage is a map from ScalarFuncSig_name(string) to usage count(uint32)
func (BuiltinFunctionsUsage) Inc ¶
func (b BuiltinFunctionsUsage) Inc(scalarFuncSigName string)
Inc will increase the usage count of scalar function by 1
func (BuiltinFunctionsUsage) Merge ¶
func (b BuiltinFunctionsUsage) Merge(usageData BuiltinFunctionsUsage)
Merge BuiltinFunctionsUsage data
type ClusterIndexUsage ¶
type ClusterIndexUsage map[string]TableClusteredInfo
ClusterIndexUsage records the usage info of all the tables, no more than 10k tables, deprecated.
type NewClusterIndexUsage ¶
type NewClusterIndexUsage struct { // The number of user's tables with clustered index enabled. NumClusteredTables uint64 `json:"numClusteredTables"` // The number of user's tables. NumTotalTables uint64 `json:"numTotalTables"` }
NewClusterIndexUsage records the clustered index usage info of all the tables.
type SlowQueryBucket ¶
SlowQueryBucket records the statistic information of slow query buckets Buckets: prometheus.ExponentialBuckets(0.001, 2, 28), // 1ms ~ 1.5days // defined in metrics/server.go
func (SlowQueryBucket) String ¶
func (bucketMap SlowQueryBucket) String() string
type TableClusteredInfo ¶
type TableClusteredInfo struct { IsClustered bool `json:"isClustered"` // True means CLUSTERED, False means NON_CLUSTERED ClusterPKType string `json:"clusterPKType"` // INT means clustered PK type is int }
TableClusteredInfo records the usage info of clusterindex of each table CLUSTERED, NON_CLUSTERED, NA
type TxnUsage ¶
type TxnUsage struct { AsyncCommitUsed bool `json:"asyncCommitUsed"` OnePCUsed bool `json:"onePCUsed"` TxnCommitCounter metrics.TxnCommitCounter `json:"txnCommitCounter"` MutationCheckerUsed bool `json:"mutationCheckerUsed"` AssertionLevel string `json:"assertionLevel"` RcCheckTS bool `json:"rcCheckTS"` RCWriteCheckTS bool `json:"rcWriteCheckTS"` SavepointCounter int64 `json:"SavepointCounter"` LazyUniqueCheckSetCounter int64 `json:"lazyUniqueCheckSetCounter"` }
TxnUsage records the usage info of transaction related features, including async-commit, 1PC and counters of transactions committed with different protocols.