metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ProfilerFile file to write profile info out to
	ProfilerFile *os.File
)

Functions

func EnableProfiler

func EnableProfiler(mode string) (changed bool)

EnableProfiler used to enable the profiler

func ReportServerUsage

func ReportServerUsage(stats MetricCollector, customStats func())

ReportServerUsage collects server usage data and reports metrics

Types

type MetricCollector

type MetricCollector interface {
	RegisterCounter(adapter.CollectorOptions) adapter.Counter
	RegisterGauge(adapter.CollectorOptions) adapter.Gauge
	RegisterTimer(adapter.CollectorOptions) adapter.Timer
	Shutdown()
}

MetricCollector provides means to create new collectors

func NewCollector added in v0.0.6

func NewCollector(monitoringConfig *MonitoringConfig, logger *logrus.Logger) MetricCollector

NewCollector creates a collector based on monitoring configuration

type Metrics added in v0.0.6

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

Metrics stores metrics reported from this package

type MonitoringConfig added in v0.0.6

type MonitoringConfig struct {
	// PrometheusMetricsPort port to run prometheus on
	PrometheusMetricsPort int `json:"prometheus_metrics_port,omitempty"`

	// Statsd metrics if you are not using prometheus
	Statsd *StatsdConfig `json:"statsd,omitempty"`

	// ProfilerPort if non-zero enable http profiler on this port
	ProfilerPort int `json:"profiler_port,omitempty"`

	// ProfilingPath is the variable that enable deep profiling is set
	ProfilingPath string `json:"profiling_path,omitempty"`

	ProfilerFile *os.File
}

MonitoringConfig for profiler and prometheus

type StatsdConfig added in v0.0.6

type StatsdConfig struct {
	// HostPort host:port of the statsd server
	HostPort string `json:"host,omitempty"`

	// StatsdPrefix prefix for statsd metrics
	Prefix string `json:"prefix,omitempty"`

	// StatsFlushPeriod in ms
	FlushPeriod int `json:"flush_period,omitempty"`
}

StatsdConfig for metrics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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