metricutils

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DashboardEnabledFlag = "dashboard"
View Source
const MetricsEnabledFlag = "metrics"

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

View Source
const PrometheusExporterFlag = "prometheus"
View Source
const PrometheusExporterPortFlag = "prometheusport"

Variables

View Source
var Enabled = false

Enabled is checked by the constructor functions for all of the standard metrics. If it is true, the metric returned is a stub.

This global kill-switch helps quantify the observer effect and makes for less cluttered pprof profiles.

View Source
var EnabledPrometheusExport = false

Functions

func CollectProcessMetrics

func CollectProcessMetrics(refresh time.Duration)

CollectProcessMetrics periodically collects various metrics about the running process.

func ReadDiskStats

func ReadDiskStats(stats *DiskStats) error

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

func StartMetricCollectionAndExport

func StartMetricCollectionAndExport(ctx *cli.Context)

StartMetricCollectionAndExport starts exporting to prometheus and collects process metrics.

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