telemetry

package
v1.1.0-beta.0...-9a1b696 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
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

View Source
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
)
View Source
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.

View Source
var GlobalBuiltinFunctionsUsage = &builtinFunctionsUsageCollector{usageData: make(BuiltinFunctionsUsage)}

GlobalBuiltinFunctionsUsage is used to collect builtin functions usage information

Functions

func GetTelemetryStatus

func GetTelemetryStatus(etcdClient *clientv3.Client) (string, error)

GetTelemetryStatus returns the telemetry status saved in etcd.

func GetTrackingID

func GetTrackingID(etcdClient *clientv3.Client) (string, error)

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 PostSavepointCount

func PostSavepointCount()

PostSavepointCount exports for testing.

func PreviewUsageData

func PreviewUsageData(ctx sessionctx.Context, etcdClient *clientv3.Client) (string, error)

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

func ResetTrackingID(etcdClient *clientv3.Client) (string, error)

ResetTrackingID generates a new tracking ID.

func RotateSubWindow

func RotateSubWindow()

RotateSubWindow rotates the telemetry sub window.

Types

type BuiltinFunctionsUsage

type BuiltinFunctionsUsage map[string]uint32

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

type SlowQueryBucket map[string]int

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.

Jump to

Keyboard shortcuts

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