collector

package
v0.0.0-...-04b0b85 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBasicMetricCollector

func NewBasicMetricCollector(cfg BasicMetricCollectorConfig) metric.Collector

func NewBufferMetricCollector

func NewBufferMetricCollector(cfg BufferMetricCollectorConfig) metric.Collector

Types

type BasicMetricCollectorConfig

type BasicMetricCollectorConfig struct {
	// This function is called sequentially,
	// the next function will be called only after the current one returns, this function is blocking.
	CollectMetricFunc CollectMetricFunc
	// This function is called only once, for closing work, this function is blocking.
	// This function only is called when all CollectMetricFunc calls are done.
	DoneFunc DoneFunc
}

type BufferMetricCollectorConfig

type BufferMetricCollectorConfig struct {
	// Default is 10000.
	MetricsBufferSize int
	// Default is 5s.
	CollectMetricsInterval time.Duration

	// This function is called sequentially,
	// the next function will be called only after the current one returns, this function is blocking.
	//
	// Call rules:
	// 1. When the number of collected metrics exceeds MetricsBufferSize.
	// 2. When the time reaches CollectMetricsInterval.
	// 3. When receiving a close signal.
	CollectMetricsFunc CollectMetricsFunc
	// This function is called only once, for closing work, this function is blocking.
	// This function only is called when all CollectMetricsFunc calls are done.
	DoneFunc DoneFunc
}

type CollectMetricFunc

type CollectMetricFunc func(*metric.Metric)

type CollectMetricsFunc

type CollectMetricsFunc func([]*metric.Metric)

type DoneFunc

type DoneFunc func()

Jump to

Keyboard shortcuts

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