metrics

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TxnCounter = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "txn_total",
			Help:      "Counter of created txns.",
		})

	TxnHistogram = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "txn_durations_seconds",
			Help:      "Bucketed histogram of processing txn",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 20),
		},
	)

	SnapshotCounter = prometheus.NewCounter(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "snapshot_total",
			Help:      "Counter of snapshots.",
		})

	TxnCmdHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "txn_cmd_duration_seconds",
			Help:      "Bucketed histogram of processing time of txn cmds.",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 20),
		}, []string{"type"})

	BackoffCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "backoff_total",
			Help:      "Counter of backoff.",
		}, []string{"type"})

	BackoffHistogram = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "backoff_seconds",
			Help:      "total backoff seconds of a single backoffer.",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 20),
		})

	SendReqHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "request_seconds",
			Help:      "Bucketed histogram of sending request duration.",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 20),
		}, []string{"type", "store"})

	LockResolverCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "lock_resolver_actions_total",
			Help:      "Counter of lock resolver actions.",
		}, []string{"type"})

	RegionErrorCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "region_err_total",
			Help:      "Counter of region errors.",
		}, []string{"type"})

	TxnWriteKVCountHistogram = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "txn_write_kv_num",
			Help:      "Count of kv pairs to write in a transaction.",
			Buckets:   prometheus.ExponentialBuckets(1, 2, 21),
		})

	TxnWriteSizeHistogram = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "txn_write_size_bytes",
			Help:      "Size of kv pairs to write in a transaction.",
			Buckets:   prometheus.ExponentialBuckets(1, 2, 21),
		})

	RawkvCmdHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "rawkv_cmd_seconds",
			Help:      "Bucketed histogram of processing time of rawkv cmds.",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 20),
		}, []string{"type"})

	RawkvSizeHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "rawkv_kv_size_bytes",
			Help:      "Size of key/value to put, in bytes.",
			Buckets:   prometheus.ExponentialBuckets(1, 2, 21),
		}, []string{"type"})

	TxnRegionsNumHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "txn_regions_num",
			Help:      "Number of regions in a transaction.",
			Buckets:   prometheus.ExponentialBuckets(1, 2, 20),
		}, []string{"type"})

	LoadSafepointCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "load_safepoint_total",
			Help:      "Counter of load safepoint.",
		}, []string{"type"})

	SecondaryLockCleanupFailureCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "lock_cleanup_task_total",
			Help:      "failure statistic of secondary lock cleanup task.",
		}, []string{"type"})

	RegionCacheCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "region_cache_operations_total",
			Help:      "Counter of region cache.",
		}, []string{"type", "result"})

	// PendingBatchRequests indicates the number of requests pending in the batch channel.
	PendingBatchRequests = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "pending_batch_requests",
			Help:      "Pending batch requests",
		})

	BatchWaitDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "client_go",
			Name:      "batch_wait_duration",

			Buckets: prometheus.ExponentialBuckets(1, 2, 30),
			Help:    "batch wait duration",
		})

	TSFutureWaitDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tikv",
			Subsystem: "pdclient",
			Name:      "ts_future_wait_seconds",
			Help:      "Bucketed histogram of seconds cost for waiting timestamp future.",
			Buckets:   prometheus.ExponentialBuckets(0.000005, 2, 18),
		})

	LocalLatchWaitTimeHistogram = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Namespace: "tidb",
			Subsystem: "tikvclient",
			Name:      "local_latch_wait_seconds",
			Help:      "Wait time of a get local latch.",
			Buckets:   prometheus.ExponentialBuckets(0.0005, 2, 20),
		})
)

Client metrics.

Functions

func PushMetrics

func PushMetrics(ctx context.Context, addr string, interval time.Duration, job, instance string)

PushMetrics pushes metrics to Prometheus Pushgateway. Note:

  • Normally, you need to start a goroutine to push metrics: `go PushMetrics(...)`
  • `instance` should be global identical -- NO 2 processes share a same `instance`.
  • `job` is used to distinguish different workloads, DO NOT use too many `job` labels since there are grafana panels that groups by `job`.

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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