sorter

package
v0.0.0-...-db0ae72 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EventCount is the metric that counts events output by the sorter.
	EventCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: "tikv_cdc",
		Subsystem: "sorter",
		Name:      "event_count",
		Help:      "The number of events output by the sorter",
	}, []string{"capture", "changefeed", "type"})

	// ResolvedTsGauge is the metric that records sorter resolved ts.
	ResolvedTsGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "tikv_cdc",
		Subsystem: "sorter",
		Name:      "resolved_ts_gauge",
		Help:      "the resolved ts of the sorter",
	}, []string{"capture", "changefeed"})

	// InMemoryDataSizeGauge is the metric that records sorter memory usage.
	InMemoryDataSizeGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "tikv_cdc",
		Subsystem: "sorter",
		Name:      "in_memory_data_size_gauge",
		Help:      "The amount of pending data stored in-memory by the sorter",
	}, []string{"capture", "id"})

	// OnDiskDataSizeGauge is the metric that records sorter disk usage.
	OnDiskDataSizeGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "tikv_cdc",
		Subsystem: "sorter",
		Name:      "on_disk_data_size_gauge",
		Help:      "The amount of pending data stored on-disk by the sorter",
	}, []string{"capture", "id"})

	// OpenFileCountGauge is the metric that records sorter open files.
	OpenFileCountGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "tikv_cdc",
		Subsystem: "sorter",
		Name:      "open_file_count_gauge",
		Help:      "The number of open file descriptors held by the sorter",
	}, []string{"capture", "id"})
)

Functions

func InitMetrics

func InitMetrics(registry *prometheus.Registry)

InitMetrics registers all metrics in this file

Types

type EventSorter

type EventSorter interface {
	Run(ctx context.Context) error
	// TODO add constraints to entries, e.g., order and duplication guarantees.
	AddEntry(ctx context.Context, entry *model.PolymorphicEvent)
	// TryAddEntry tries to add and entry to the sorter.
	// Returns false if the entry can not be added; otherwise it returns true
	// Returns error if the sorter is closed or context is done
	TryAddEntry(ctx context.Context, entry *model.PolymorphicEvent) (bool, error)
	// Output sorted events, orderd by commit ts.
	// It may output a dummy event, a zero resolved ts event, to detect whether
	// output is available.
	Output() <-chan *model.PolymorphicEvent
}

EventSorter accepts unsorted PolymorphicEvents, sort them in background and returns sorted PolymorphicEvents in Output channel

Directories

Path Synopsis
Package memory is an in-memory EventSorter implementation.
Package memory is an in-memory EventSorter implementation.

Jump to

Keyboard shortcuts

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