monitoring

package
v0.0.0-...-c2add7f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package monitoring provides means to collect different types of metrics. The collected metrics should be exported later e.g. using the package exporter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// System metrics.
	System SystemStats

	// Metrics of Go runtime.
	Runtime RuntimeStats

	// Some random value required by Praktikum tasks.
	RandomValue metrics.Gauge

	// Count of metrics polling attempts.
	PollCount metrics.Counter
	// contains filtered or unexported fields
}

Metrics represent set of metrics collected by the agent.

func NewMetrics

func NewMetrics() *Metrics

func (*Metrics) Poll

func (m *Metrics) Poll(ctx context.Context) error

Poll refreshes values of metrics and increments PollCount.

type RuntimeStats

type RuntimeStats struct {
	Alloc         metrics.Gauge
	BuckHashSys   metrics.Gauge
	Frees         metrics.Gauge
	GCCPUFraction metrics.Gauge
	GCSys         metrics.Gauge
	HeapAlloc     metrics.Gauge
	HeapIdle      metrics.Gauge
	HeapInuse     metrics.Gauge
	HeapObjects   metrics.Gauge
	HeapReleased  metrics.Gauge
	HeapSys       metrics.Gauge
	LastGC        metrics.Gauge
	Lookups       metrics.Gauge
	MCacheInuse   metrics.Gauge
	MCacheSys     metrics.Gauge
	MSpanInuse    metrics.Gauge
	MSpanSys      metrics.Gauge
	Mallocs       metrics.Gauge
	NextGC        metrics.Gauge
	NumForcedGC   metrics.Gauge
	NumGC         metrics.Gauge
	OtherSys      metrics.Gauge
	PauseTotalNs  metrics.Gauge
	StackInuse    metrics.Gauge
	StackSys      metrics.Gauge
	Sys           metrics.Gauge
	TotalAlloc    metrics.Gauge
}

RuntimeStats represents Go runtime metrics. Regarding puurpose of each value see: https://pkg.go.dev/runtime#MemStats

func (*RuntimeStats) Poll

func (m *RuntimeStats) Poll()

Poll refreshes values of runtime metrics.

type SystemStats

type SystemStats struct {
	// Total amount of RAM on this system.
	TotalMemory metrics.Gauge

	// Total amount of not used RAM on this system
	FreeMemory metrics.Gauge

	// Utilisation in percent of all available logical/virtual cores on this system.
	CPUutilization1 metrics.Gauge
}

func (*SystemStats) Poll

func (s *SystemStats) Poll(ctx context.Context) error

Poll refreshes values of system metrics.

Jump to

Keyboard shortcuts

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