Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultDockerClientOpts = []client.Opt{client.WithVersion("1.39")} // Kubernetes 往 docker label 注入的相关变量 KubernetesLabels = map[string]string{ "io.kubernetes.pod.namespace": "kubernetes_pod_namespace", "io.kubernetes.pod.name": "kubernetes_pod_name", "io.kubernetes.container.name": "kubernetes_container_name", } )
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter 负责采集 docker 运行的实时相关指标
func (*Exporter) List ¶
func (e *Exporter) List() ([]*StatsEntry, error)
List 通过 docker.ContainerStats 接口采集 docker stats 指标
type StatsEntry ¶
type StatsEntry struct { ContainerID string `json:"container_id"` ContainerName string `json:"container_name"` CPUPercentage float64 `json:"cpu_usage_percentage"` Memory float64 `json:"memory_usage_in_bytes"` MemoryPercentage float64 `json:"memory_usage_percentage"` MemoryLimit float64 `json:"memory_limit_in_bytes"` NetworkRx float64 `json:"network_rx_in_bytes"` NetworkTx float64 `json:"network_tx_in_bytes"` BlockRead float64 `json:"block_read_in_bytes"` BlockWrite float64 `json:"block_write_in_bytes"` // Kubernetes 相关 labels 变量,仅在 k8s 集中中运行才能采集到 KubernetesLabels map[string]string `json:"kubernetes_labels,omitempty"` }
StatsEntry 定义了 Stats 的详细内容
Click to show internal directories.
Click to hide internal directories.