metrics

package
v0.0.0-...-e82d903 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ContainerActions tracks the time taken to process container operations
	ContainerActions = metricsNS.NewLabeledTimer("container_actions", "The number of seconds it takes to process each container action", "action")
	// NetworkActions tracks the time taken to process network operations
	NetworkActions = metricsNS.NewLabeledTimer("network_actions", "The number of seconds it takes to process each network action", "action")
	// HostInfoFunctions tracks the time taken to gather host information
	HostInfoFunctions = metricsNS.NewLabeledTimer("host_info_functions", "The number of seconds it takes to call functions gathering info about the host", "function")
	ImageActions      = metricsNS.NewLabeledTimer("image_actions", "The number of seconds it takes to process each image action", "action")

	// EngineInfo provides information about the engine and its environment
	EngineInfo = metricsNS.NewLabeledGauge("engine", "The information related to the engine and the OS it is running on", gometrics.Unit("info"),
		"version",
		"commit",
		"architecture",
		"graphdriver",
		"kernel",
		"os",
		"os_type",
		"os_version",
		"daemon_id",
	)
	// EngineCPUs tracks the number of CPUs available to the engine
	EngineCPUs = metricsNS.NewGauge("engine_cpus", "The number of cpus that the host system of the engine has", gometrics.Unit("cpus"))
	// EngineMemory tracks the amount of memory available to the engine
	EngineMemory = metricsNS.NewGauge("engine_memory", "The number of bytes of memory that the host system of the engine has", gometrics.Bytes)

	// HealthChecksCounter tracks the total number of health checks
	HealthChecksCounter = metricsNS.NewCounter("health_checks", "The total number of health checks")
	// HealthChecksFailedCounter tracks the number of failed health checks
	HealthChecksFailedCounter = metricsNS.NewCounter("health_checks_failed", "The total number of failed health checks")
	// HealthCheckStartDuration tracks the time taken to prepare health checks
	HealthCheckStartDuration = metricsNS.NewTimer("health_check_start_duration", "The number of seconds it takes to prepare to run health checks")

	// StateCtr tracks container states
	StateCtr = newStateCounter(metricsNS, metricsNS.NewDesc("container_states", "The count of containers in various states", gometrics.Unit("containers"), "state"))

	// EventsCounter tracks the number of events logged
	EventsCounter = metricsNS.NewCounter("events", "The number of events logged")

	// EventSubscribers tracks the number of current subscribers to events
	EventSubscribers = metricsNS.NewGauge("events_subscribers", "The number of current subscribers to events", gometrics.Total)
)

Functions

func CleanupPlugin

func CleanupPlugin(store plugingetter.PluginGetter)

CleanupPlugin stops metrics collection for all plugins

func RegisterPlugin

func RegisterPlugin(store *plugin.Store, path string) error

RegisterPlugin starts the metrics server listener and registers the metrics plugin callback with the plugin store

func StartTimer

func StartTimer(t gometrics.Timer) func()

Types

type Plugin

type Plugin interface {
	StartMetrics() error
	StopMetrics() error
}

Plugin represents a metrics collector plugin

type StateCounter

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

StateCounter tracks container states

func (*StateCounter) Collect

func (ctr *StateCounter) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (*StateCounter) Delete

func (ctr *StateCounter) Delete(id string)

Delete removes a container's state

func (*StateCounter) Describe

func (ctr *StateCounter) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*StateCounter) Get

func (ctr *StateCounter) Get() (running int, paused int, stopped int)

Get returns the count of containers in running, paused, and stopped states

func (*StateCounter) Set

func (ctr *StateCounter) Set(id, label string)

Set updates the state for a container

Jump to

Keyboard shortcuts

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