docker

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CONFIG_KEY = "docker"
)

Variables

This section is empty.

Functions

func CalculateDockerCPUPercent

func CalculateDockerCPUPercent(previousCPU, previousSystem uint64, v *container.StatsResponse) float64

CalculateDockerCPUPercent calculates the CPU usage percentage for a Docker container Implementation based on: https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go

func CalculateDockerMemoryUsed

func CalculateDockerMemoryUsed(mem container.MemoryStats) float64

CalculateDockerMemoryUsed is mirroring the official way to calculate: https://github.com/docker/cli/blob/master/cli/command/container/stats_helpers.go#L239

func DetectConfigFromConfigFile

func DetectConfigFromConfigFile() bool

func DetectConfigFromEnv

func DetectConfigFromEnv() bool

func DockerCollectors

func DockerCollectors(adapter *DockerContainerAdapter) []agent.MetricCollector

DockerCollectors returns the list of collectors for Docker, replacing system metrics with Docker-specific ones while keeping database-specific collectors

func DockerHardwareInfo

func DockerHardwareInfo(client *client.Client, containerName string) func(ctx context.Context, state *agent.MetricsState) error

DockerHardwareInfo collects hardware metrics from a Docker container using the Docker API

Types

type Config

type Config struct {
	ContainerName string `mapstructure:"container_name" validate:"required"`
}

func ConfigFromViper

func ConfigFromViper(key *string) (Config, error)

type DockerContainerAdapter

type DockerContainerAdapter struct {
	agent.CommonAgent
	Config Config

	GuardrailSettings guardrails.Config

	PGDriver  *pgxpool.Pool
	PGVersion string
	// contains filtered or unexported fields
}

DockerContainerAdapter works with the container name and by communicating with the docker Unix socket to get stats like memory usage, number of CPUs available and memory limit

func CreateDockerContainerAdapter

func CreateDockerContainerAdapter() (*DockerContainerAdapter, error)

func (*DockerContainerAdapter) ApplyConfig

func (d *DockerContainerAdapter) ApplyConfig(proposedConfig *agent.ProposedConfigResponse) error

func (*DockerContainerAdapter) GetActiveConfig

func (d *DockerContainerAdapter) GetActiveConfig() (agent.ConfigArraySchema, error)

func (*DockerContainerAdapter) GetSystemInfo

func (d *DockerContainerAdapter) GetSystemInfo() ([]metrics.FlatValue, error)

func (*DockerContainerAdapter) Guardrails

func (d *DockerContainerAdapter) Guardrails() *guardrails.Signal

Jump to

Keyboard shortcuts

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