Documentation
¶
Index ¶
- Constants
- func CalculateDockerCPUPercent(previousCPU, previousSystem uint64, v *container.StatsResponse) float64
- func CalculateDockerMemoryUsed(mem container.MemoryStats) float64
- func DetectConfigFromConfigFile() bool
- func DetectConfigFromEnv() bool
- func DockerCollectors(adapter *DockerContainerAdapter) []agent.MetricCollector
- func DockerHardwareInfo(client *client.Client, containerName string) func(ctx context.Context, state *agent.MetricsState) error
- type Config
- type DockerContainerAdapter
- func (d *DockerContainerAdapter) ApplyConfig(proposedConfig *agent.ProposedConfigResponse) error
- func (d *DockerContainerAdapter) GetActiveConfig() (agent.ConfigArraySchema, error)
- func (d *DockerContainerAdapter) GetSystemInfo() ([]metrics.FlatValue, error)
- func (d *DockerContainerAdapter) Guardrails() *guardrails.Signal
Constants ¶
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 ¶
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