Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1983 from serathius/node-cpu-whole-cores-1.5
Browse files Browse the repository at this point in the history
Export node cpu metrics in whole cores
  • Loading branch information
k8s-ci-robot committed Mar 20, 2018
2 parents 12fd56f + 75b15c5 commit f20021c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions metrics/sinks/stackdriver/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,10 @@ func (sink *StackdriverSink) TranslateMetric(timestamp time.Time, labels map[str
nodeLabels := sink.getNodeResourceLabels(labels)
switch name {
case core.MetricNodeCpuCapacity.MetricDescriptor.Name:
point := sink.doublePoint(timestamp, timestamp, float64(value.FloatValue))
point := sink.doublePoint(timestamp, timestamp, float64(value.FloatValue)/1000)
return createTimeSeries("k8s_node", nodeLabels, cpuTotalCoresMD, point)
case core.MetricNodeCpuAllocatable.MetricDescriptor.Name:
point := sink.doublePoint(timestamp, timestamp, float64(value.FloatValue))
point := sink.doublePoint(timestamp, timestamp, float64(value.FloatValue)/1000)
return createTimeSeries("k8s_node", nodeLabels, cpuAllocatableCoresMD, point)
case core.MetricCpuUsage.MetricDescriptor.Name:
point := sink.doublePoint(timestamp, collectionStartTime, float64(value.IntValue)/float64(time.Second/time.Nanosecond))
Expand Down
4 changes: 2 additions & 2 deletions metrics/sinks/stackdriver/stackdriver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ func TestTranslateMetricSet(t *testing.T) {
podVolumeTotal := testTranslateLabeledMetric(as, podLabels, generateLabeledIntMetric(11, map[string]string{}, "filesystem/limit"), "kubernetes.io/pod/volume/total_bytes")
podVolumeUsed := testTranslateLabeledMetric(as, podLabels, generateLabeledIntMetric(12, map[string]string{}, "filesystem/usage"), "kubernetes.io/pod/volume/used_bytes")
nodeCpuUsage := testTranslateMetric(as, generateIntMetric(13000000000), nodeLabels, "cpu/usage", "kubernetes.io/node/cpu/core_usage_time")
nodeCpuTotal := testTranslateMetric(as, generateFloatMetric(14), nodeLabels, "cpu/node_capacity", "kubernetes.io/node/cpu/total_cores")
nodeCpuAllocatable := testTranslateMetric(as, generateFloatMetric(15), nodeLabels, "cpu/node_allocatable", "kubernetes.io/node/cpu/allocatable_cores")
nodeCpuTotal := testTranslateMetric(as, generateFloatMetric(14000), nodeLabels, "cpu/node_capacity", "kubernetes.io/node/cpu/total_cores")
nodeCpuAllocatable := testTranslateMetric(as, generateFloatMetric(15000), nodeLabels, "cpu/node_allocatable", "kubernetes.io/node/cpu/allocatable_cores")
nodeMemoryUsage := testTranslateMetric(as, generateIntMetric(16), nodeLabels, "memory/bytes_used", "kubernetes.io/node/memory/used_bytes")
nodeMemoryTotal := testTranslateMetric(as, generateIntMetric(17), nodeLabels, "memory/node_capacity", "kubernetes.io/node/memory/total_bytes")
nodeMemoryAllocatable := testTranslateMetric(as, generateIntMetric(18), nodeLabels, "memory/node_allocatable", "kubernetes.io/node/memory/allocatable_bytes")
Expand Down

0 comments on commit f20021c

Please sign in to comment.