collect

package
v0.0.0-...-6327341 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultMetricFileNameSuffix = "doctor-metrics.json"
	DefaultFileRotationInterval = 1 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudWatchCollector

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

CloudWatchCollector implements the Collector interface, collecting metrics to a file

func NewCloudWatchCollector

func NewCloudWatchCollector(config CloudWatchCollectorConfig) (*CloudWatchCollector, error)

NewCloudWatchCollector attempts to create a new CloudWatchCollector using the specified config returning the CloudWatchCollector and error (if any)

func (*CloudWatchCollector) Collect

func (cwc *CloudWatchCollector) Collect(metric metric.Metric) error

Collect collects metric to CloudWatch returning error (if any) (rotation is only triggered when a metric is collection) Collect is safe to call across go-routines

type CloudWatchCollectorConfig

type CloudWatchCollectorConfig struct {
	Ctx             context.Context
	AWSRegion       string
	MetricNamespace string
}

CloudWatchCollectorConfig wraps values for configuring a CloudWatch

type Collector

type Collector interface {
	Collect(metric metric.Metric) error
}

Collector allows for collecting a metric to an arbitrary metric sink (e.g. a file or AWS CloudWatch) for historical and real time monitoring purposes

type FileCollector

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

FileCollector implements the Collector interface, collecting metrics to a file

func NewFileCollector

func NewFileCollector(config FileCollectorConfig) (*FileCollector, error)

NewFileCollector attempts to create a new FileCollector using the specified config (or default values where appropriate) returning the FileCollector and error (if any)

func (*FileCollector) Collect

func (fc *FileCollector) Collect(metric metric.Metric) error

Collect collects metric to a file, returning error (if any) Collect will ensure that the file is rotated at most `fileRotationInterval` (rotation is only triggered when a metric is collection) Collect is safe to call across go-routines, and will block to ensure an in progress collection completes cleanly before a new metric is collected

type FileCollectorConfig

type FileCollectorConfig struct {
	MetricFileNameSuffix string
	FileRotationInterval *time.Duration
}

FileCollectorConfig wraps values for configuring a FileCollector

Jump to

Keyboard shortcuts

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