observer

package
v0.0.0-...-64decf6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetrics

func InitMetrics(registry *prometheus.Registry)

InitMetrics registers all metrics in this file.

Types

type DummyObserver

type DummyObserver struct{}

DummyObserver is an observer that does nothing

func NewDummyObserver

func NewDummyObserver() *DummyObserver

NewDummyObserver creates a new DummyObserver instance

func (*DummyObserver) Close

func (o *DummyObserver) Close() error

Close implements Observer

func (*DummyObserver) Tick

func (o *DummyObserver) Tick(ctx context.Context) error

Tick implements Observer

type NewObserverOpt

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

NewObserverOpt represents available options when creating a new observer.

type NewObserverOption

type NewObserverOption func(*NewObserverOpt)

NewObserverOption configures NewObserverOpt.

func WithDBConnFactory

func WithDBConnFactory(factory pmysql.ConnectionFactory) NewObserverOption

WithDBConnFactory specifies factory to create db connection.

type Observer

type Observer interface {
	// Tick is called periodically, Observer fetches performance metrics and
	// records them in each Tick.
	// Tick and Close must be concurrent safe.
	Tick(ctx context.Context) error
	Close() error
}

Observer defines an interface of downstream performance observer.

func NewObserver

func NewObserver(
	ctx context.Context,
	changefeedID model.ChangeFeedID,
	sinkURIStr string,
	replCfg *config.ReplicaConfig,
	opts ...NewObserverOption,
) (Observer, error)

NewObserver creates a new Observer

type TiDBObserver

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

TiDBObserver is a tidb performance observer. It's not thread-safe.

func NewTiDBObserver

func NewTiDBObserver(db *sql.DB) *TiDBObserver

NewTiDBObserver creates a new TiDBObserver instance

func (*TiDBObserver) Close

func (o *TiDBObserver) Close() error

Close implements Observer

func (*TiDBObserver) Tick

func (o *TiDBObserver) Tick(ctx context.Context) error

Tick implements Observer

Jump to

Keyboard shortcuts

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