metric

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// states used for the TableCounter labels
	TableStatePending   = "pending"
	TableStateImported  = "imported"
	TableStateCompleted = "completed"

	BytesStateTotalRestore   = "total_restore" // total source data bytes needs to restore
	BytesStateRestored       = "restored"      // source data bytes restored during restore engine
	BytesStateRestoreWritten = "written"       // bytes written during restore engine
	BytesStateImported       = "imported"      // bytes imported during import engine

	ProgressPhaseTotal   = "total"   // total restore progress(not include post-process, like checksum and analyze)
	ProgressPhaseRestore = "restore" // restore engine progress
	ProgressPhaseImport  = "import"  // import engine progress

	// results used for the TableCounter labels
	TableResultSuccess = "success"
	TableResultFailure = "failure"

	// states used for the ChunkCounter labels
	ChunkStateEstimated = "estimated"
	ChunkStatePending   = "pending"
	ChunkStateRunning   = "running"
	ChunkStateFinished  = "finished"
	ChunkStateFailed    = "failed"

	BlockDeliverKindIndex = "index"
	BlockDeliverKindData  = "data"
)

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, metrics *Metrics) context.Context

NewContext returns a new context with the provided metrics.

func ReadCounter

func ReadCounter(counter prometheus.Counter) float64

ReadCounter reports the current value of the counter.

func ReadHistogramSum

func ReadHistogramSum(histogram prometheus.Histogram) float64

ReadHistogramSum reports the sum of all observed values in the histogram.

Types

type Metrics

type Metrics struct {
	ImporterEngineCounter                *prometheus.CounterVec
	IdleWorkersGauge                     *prometheus.GaugeVec
	KvEncoderCounter                     *prometheus.CounterVec
	TableCounter                         *prometheus.CounterVec
	ProcessedEngineCounter               *prometheus.CounterVec
	ChunkCounter                         *prometheus.CounterVec
	BytesCounter                         *prometheus.CounterVec
	ImportSecondsHistogram               prometheus.Histogram
	ChunkParserReadBlockSecondsHistogram prometheus.Histogram
	ApplyWorkerSecondsHistogram          *prometheus.HistogramVec
	RowReadSecondsHistogram              prometheus.Histogram
	RowReadBytesHistogram                prometheus.Histogram
	RowEncodeSecondsHistogram            prometheus.Histogram
	RowKVDeliverSecondsHistogram         prometheus.Histogram
	BlockDeliverSecondsHistogram         prometheus.Histogram
	BlockDeliverBytesHistogram           *prometheus.HistogramVec
	BlockDeliverKVPairsHistogram         *prometheus.HistogramVec
	ChecksumSecondsHistogram             prometheus.Histogram
	LocalStorageUsageBytesGauge          *prometheus.GaugeVec
	ProgressGauge                        *prometheus.GaugeVec
}

func FromContext

func FromContext(ctx context.Context) (*Metrics, bool)

FromContext returns the metrics stored in the context.

func NewMetrics

func NewMetrics(factory promutil.Factory) *Metrics

NewMetrics creates a new empty metrics.

func (*Metrics) RecordEngineCount

func (m *Metrics) RecordEngineCount(status string, err error)

func (*Metrics) RecordTableCount

func (m *Metrics) RecordTableCount(status string, err error)

func (*Metrics) RegisterTo

func (m *Metrics) RegisterTo(r promutil.Registry)

RegisterTo registers all metrics to the given registry.

func (*Metrics) UnregisterFrom

func (m *Metrics) UnregisterFrom(r promutil.Registry)

UnregisterFrom unregisters all metrics from the given registry.

Jump to

Keyboard shortcuts

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