metrics

package
v0.0.0-...-2e47a7b Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package metrics provides general system and process level metrics collection.

Index

Constants

View Source
const MetricsEnabledFlag = "metrics"

MetricsEnabledFlag is the CLI flag name to use to enable metrics collections.

Variables

View Source
var Enabled = true

Enabled is the flag specifying if metrics are enable or not.

Functions

func CollectProcessMetrics

func CollectProcessMetrics(refresh time.Duration)

CollectProcessMetrics periodically collects various metrics about the running process.

func NewCounter

func NewCounter(name string) metrics.Counter

NewCounter create a new metrics Counter, either a real one of a NOP stub depending on the metrics flag.

func NewMeter

func NewMeter(name string) metrics.Meter

NewMeter create a new metrics Meter, either a real one of a NOP stub depending on the metrics flag.

func NewTimer

func NewTimer(name string) metrics.Timer

NewTimer create a new metrics Timer, either a real one of a NOP stub depending on the metrics flag.

func ReadDiskStats

func ReadDiskStats(stats *DiskStats) error

ReadDiskStats retrieves the disk IO stats belonging to the current process.

func Start

func Start()

Init enables or disables the metrics system. Since we need this to run before any other code gets to create meters and timers, we'll actually do an ugly hack and peek into the command line args for the metrics flag.

Types

type DiskStats

type DiskStats struct {
	ReadCount  int64 // Number of read operations executed
	ReadBytes  int64 // Total number of bytes read
	WriteCount int64 // Number of write operations executed
	WriteBytes int64 // Total number of byte written
}

DiskStats is the per process disk io stats.

Jump to

Keyboard shortcuts

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