metrics

package
v0.0.0-...-7f57e1f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ExecBatchHistogram records batch size of a txn.
	ExecBatchHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "ticdc",
			Subsystem: "sink",
			Name:      "batch_row_count",
			Help:      "Row count number for a given batch.",
			Buckets:   prometheus.ExponentialBuckets(1, 2, 18),
		}, []string{"namespace", "changefeed", "type"}) // type is for `sinkType`

	// ExecWriteBytesGauge records the total number of bytes written by sink.
	TotalWriteBytesCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "ticdc",
			Subsystem: "sink",
			Name:      "write_bytes_total",
			Help:      "Total number of bytes written by sink",
		}, []string{"namespace", "changefeed", "type"}) // type is for `sinkType`

	// LargeRowSizeHistogram records size of large rows.
	LargeRowSizeHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "ticdc",
			Subsystem: "sink",
			Name:      "large_row_size",
			Help:      "The size of all received row changed events (in bytes).",
			Buckets:   prometheus.ExponentialBuckets(largeRowSizeLowBound, 2, 15),
		}, []string{"namespace", "changefeed", "type"}) // type is for `sinkType`

	// ExecDDLCounter records the count of DDL executed.
	ExecDDLCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "ticdc",
			Subsystem: "sink",
			Name:      "ddl_exec_count",
			Help:      "Total count of ddl execution.",
		}, []string{"namespace", "changefeed", "type"}) // type is for `sinkType`

	// ExecDDLHistogram records the execution time of a DDL.
	ExecDDLHistogram = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "ticdc",
			Subsystem: "sink",
			Name:      "ddl_exec_duration",
			Help:      "Bucketed histogram of processing time (s) of a ddl.",
			Buckets:   prometheus.ExponentialBuckets(0.01, 2, 18),
		}, []string{"namespace", "changefeed", "type"}) // type is for `sinkType`

	// ExecutionErrorCounter is the counter of execution errors.
	ExecutionErrorCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "ticdc",
			Subsystem: "sink",
			Name:      "execution_error",
			Help:      "Total count of execution errors.",
		}, []string{"namespace", "changefeed", "type"}) // type is for `sinkType`
)

---------- Metrics used in Statistics. ---------- //

Functions

func InitMetrics

func InitMetrics(registry *prometheus.Registry)

InitMetrics registers all metrics in this file.

Types

type Statistics

type Statistics struct {
	// contains filtered or unexported fields
}

Statistics maintains some status and metrics of the Sink Note: All methods of Statistics should be thread-safe.

func NewStatistics

func NewStatistics(
	changefeed model.ChangeFeedID,
	sinkType sink.Type,
) *Statistics

NewStatistics creates a statistics

func (*Statistics) Close

func (b *Statistics) Close()

Close release some internal resources.

func (*Statistics) ObserveRows

func (b *Statistics) ObserveRows(rows ...*model.RowChangedEvent)

ObserveRows stats all received `RowChangedEvent`s.

func (*Statistics) RecordBatchExecution

func (b *Statistics) RecordBatchExecution(executor func() (int, int64, error)) error

RecordBatchExecution stats batch executors which return (batchRowCount, error).

func (*Statistics) RecordDDLExecution

func (b *Statistics) RecordDDLExecution(executor func() error) error

RecordDDLExecution record the time cost of execute ddl

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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