Rename the various metric keys so they don't accidentally overlap

This commit is contained in:
Paul Bellamy
2016-01-20 16:12:30 +00:00
parent 0190c15145
commit bf57aeb8d9
10 changed files with 37 additions and 37 deletions

View File

@@ -41,16 +41,16 @@ const (
NetworkTxErrors = "network_tx_errors"
NetworkTxBytes = "network_tx_bytes"
MemoryMaxUsage = "memory_max_usage"
MemoryUsage = "memory_usage"
MemoryFailcnt = "memory_failcnt"
MemoryLimit = "memory_limit"
MemoryMaxUsage = "docker_memory_max_usage"
MemoryUsage = "docker_memory_usage"
MemoryFailcnt = "docker_memory_failcnt"
MemoryLimit = "docker_memory_limit"
CPUPercpuUsage = "cpu_per_cpu_usage"
CPUUsageInUsermode = "cpu_usage_in_usermode"
CPUTotalUsage = "cpu_total_usage"
CPUUsageInKernelmode = "cpu_usage_in_kernelmode"
CPUSystemCPUUsage = "cpu_system_cpu_usage"
CPUPercpuUsage = "docker_cpu_per_cpu_usage"
CPUUsageInUsermode = "docker_cpu_usage_in_usermode"
CPUTotalUsage = "docker_cpu_total_usage"
CPUUsageInKernelmode = "docker_cpu_usage_in_kernelmode"
CPUSystemCPUUsage = "docker_cpu_system_cpu_usage"
StateRunning = "running"
StateStopped = "stopped"

View File

@@ -79,7 +79,7 @@ func TestContainer(t *testing.T) {
"docker_image_id": "baz",
"docker_label_foo1": "bar1",
"docker_label_foo2": "bar2",
"memory_usage": "12345",
"docker_memory_usage": "12345",
}).WithSets(report.Sets{
"docker_container_ports": report.MakeStringSet("1.2.3.4:80->80/tcp", "81/tcp"),
"docker_container_ips": report.MakeStringSet("1.2.3.4"),
@@ -90,8 +90,8 @@ func TestContainer(t *testing.T) {
).WithLatest(
"docker_container_state", now, "running",
).WithMetrics(report.Metrics{
"cpu_total_usage": report.MakeMetric(),
"memory_usage": report.MakeMetric().Add(now, 12345),
"docker_cpu_total_usage": report.MakeMetric(),
"docker_memory_usage": report.MakeMetric().Add(now, 12345),
}).WithParents(report.Sets{
report.ContainerImage: report.MakeStringSet(report.MakeContainerImageNodeID("baz")),
})

View File

@@ -19,8 +19,8 @@ const (
Load1 = "load1"
Load5 = "load5"
Load15 = "load15"
CPUUsage = "cpu_usage_percent"
MemUsage = "mem_usage_bytes"
CPUUsage = "host_cpu_usage_percent"
MemoryUsage = "host_mem_usage_bytes"
)
// Exposed for testing.
@@ -76,8 +76,8 @@ func (r *Reporter) Report() (report.Report, error) {
metrics := GetLoad(now)
cpuUsage, max := GetCPUUsagePercent()
metrics[CPUUsage] = report.MakeMetric().Add(now, cpuUsage).WithMax(max)
memUsage, max := GetMemoryUsageBytes()
metrics[MemUsage] = report.MakeMetric().Add(now, memUsage).WithMax(max)
memoryUsage, max := GetMemoryUsageBytes()
metrics[MemoryUsage] = report.MakeMetric().Add(now, memoryUsage).WithMax(max)
rep.Host.AddNode(report.MakeHostNodeID(r.hostID), report.MakeNodeWith(map[string]string{
Timestamp: mtime.Now().UTC().Format(time.RFC3339Nano),

View File

@@ -22,11 +22,11 @@ func TestReporter(t *testing.T) {
hostname = "hostname"
timestamp = time.Now()
load = report.Metrics{
host.Load1: report.MakeMetric().Add(timestamp, 1.0),
host.Load5: report.MakeMetric().Add(timestamp, 5.0),
host.Load15: report.MakeMetric().Add(timestamp, 15.0),
host.CPUUsage: report.MakeMetric().Add(timestamp, 30.0).WithMax(100.0),
host.MemUsage: report.MakeMetric().Add(timestamp, 60.0).WithMax(100.0),
host.Load1: report.MakeMetric().Add(timestamp, 1.0),
host.Load5: report.MakeMetric().Add(timestamp, 5.0),
host.Load15: report.MakeMetric().Add(timestamp, 15.0),
host.CPUUsage: report.MakeMetric().Add(timestamp, 30.0).WithMax(100.0),
host.MemoryUsage: report.MakeMetric().Add(timestamp, 60.0).WithMax(100.0),
}
uptime = "278h55m43s"
kernel = "release version"

View File

@@ -14,8 +14,8 @@ const (
PPID = "ppid"
Cmdline = "cmdline"
Threads = "threads"
CPUUsage = "cpu_usage_percent"
MemoryUsage = "memory_usage_bytes"
CPUUsage = "process_cpu_usage_percent"
MemoryUsage = "process_memory_usage_bytes"
)
// Reporter generates Reports containing the Process topology.

View File

@@ -27,7 +27,7 @@ var (
)
hostNodeMetrics = renderMetrics(
MetricRow{ID: host.CPUUsage, Label: "CPU", Format: percentFormat},
MetricRow{ID: host.MemUsage, Label: "Memory", Format: filesizeFormat},
MetricRow{ID: host.MemoryUsage, Label: "Memory", Format: filesizeFormat},
MetricRow{ID: host.Load1, Label: "Load (1m)", Format: defaultFormat, Group: "load"},
MetricRow{ID: host.Load5, Label: "Load (5m)", Format: defaultFormat, Group: "load"},
MetricRow{ID: host.Load15, Label: "Load (15m)", Format: defaultFormat, Group: "load"},

View File

@@ -76,7 +76,7 @@ func TestNodeMetrics(t *testing.T) {
Metric: &fixture.ClientHostCPUMetric,
},
{
ID: host.MemUsage,
ID: host.MemoryUsage,
Label: "Memory",
Format: "filesize",
Group: "",

View File

@@ -90,7 +90,7 @@ var (
topologyID string
NodeSummaryGroup
}{
{report.Host, NodeSummaryGroup{TopologyID: "hosts", Label: "Hosts", Columns: []string{host.CPUUsage, host.MemUsage}}},
{report.Host, NodeSummaryGroup{TopologyID: "hosts", Label: "Hosts", Columns: []string{host.CPUUsage, host.MemoryUsage}}},
{report.Pod, NodeSummaryGroup{TopologyID: "pods", Label: "Pods", Columns: []string{}}},
{report.ContainerImage, NodeSummaryGroup{TopologyID: "containers-by-image", Label: "Container Images", Columns: []string{}}},
{report.Container, NodeSummaryGroup{TopologyID: "containers", Label: "Containers", Columns: []string{docker.CPUTotalUsage, docker.MemoryUsage}}},

View File

@@ -55,7 +55,7 @@ func TestMakeDetailedHostNode(t *testing.T) {
Metric: &fixture.ClientHostCPUMetric,
},
{
ID: host.MemUsage,
ID: host.MemoryUsage,
Format: "filesize",
Label: "Memory",
Value: 0.08,

View File

@@ -352,11 +352,11 @@ var (
}).WithID(ClientHostNodeID).WithTopology(report.Host).WithSets(report.Sets{
host.LocalNetworks: report.MakeStringSet("10.10.10.0/24"),
}).WithMetrics(report.Metrics{
host.CPUUsage: ClientHostCPUMetric,
host.MemUsage: ClientHostMemoryMetric,
host.Load1: ClientHostLoad1Metric,
host.Load5: ClientHostLoad5Metric,
host.Load15: ClientHostLoad15Metric,
host.CPUUsage: ClientHostCPUMetric,
host.MemoryUsage: ClientHostMemoryMetric,
host.Load1: ClientHostLoad1Metric,
host.Load5: ClientHostLoad5Metric,
host.Load15: ClientHostLoad15Metric,
}),
ServerHostNodeID: report.MakeNodeWith(map[string]string{
"host_name": ServerHostName,
@@ -365,11 +365,11 @@ var (
}).WithID(ServerHostNodeID).WithTopology(report.Host).WithSets(report.Sets{
host.LocalNetworks: report.MakeStringSet("10.10.10.0/24"),
}).WithMetrics(report.Metrics{
host.CPUUsage: ServerHostCPUMetric,
host.MemUsage: ServerHostMemoryMetric,
host.Load1: ServerHostLoad1Metric,
host.Load5: ServerHostLoad5Metric,
host.Load15: ServerHostLoad15Metric,
host.CPUUsage: ServerHostCPUMetric,
host.MemoryUsage: ServerHostMemoryMetric,
host.Load1: ServerHostLoad1Metric,
host.Load5: ServerHostLoad5Metric,
host.Load15: ServerHostLoad15Metric,
}),
},
},