Skip to content

Commit

Permalink
ran a gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-domitrovich committed Dec 22, 2020
1 parent 11ebec5 commit 98a1a1d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion plugins/builtin/apm/nomad/plugin/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (a *APMPlugin) getTaskGroupResourceUsage(query *taskGroupQuery) ([]float64,

// Create the metric function now that the total allocated CPU is known
metricFunc = func(m *[]float64, ru *api.ResourceUsage) {
*m = append(*m, (ru.CpuStats.TotalTicks / float64(allocatedCPU)) * 100)
*m = append(*m, (ru.CpuStats.TotalTicks/float64(allocatedCPU))*100)
}
case queryMetricMem:
metricFunc = func(m *[]float64, ru *api.ResourceUsage) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/apm/nomad/plugin/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ func contains(slice []string, item string) bool {
}
}
return false
}
}
24 changes: 12 additions & 12 deletions plugins/builtin/apm/nomad/plugin/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ func Test_validateMetric(t *testing.T) {
name string
}{
{
inputMetric: "memory",
inputMetric: "memory",
inputValidMetrics: []string{queryMetricCPU, queryMetricCPUAllocated, queryMetricMem},
expectedOutput: nil,
name: "memory metric",
expectedOutput: nil,
name: "memory metric",
},
{
inputMetric: "cpu",
inputMetric: "cpu",
inputValidMetrics: []string{queryMetricCPU, queryMetricCPUAllocated, queryMetricMem},
expectedOutput: nil,
name: "cpu metric",
expectedOutput: nil,
name: "cpu metric",
},
{
inputMetric: "cpu-allocated",
inputMetric: "cpu-allocated",
inputValidMetrics: []string{queryMetricCPU, queryMetricCPUAllocated, queryMetricMem},
expectedOutput: nil,
name: "cpu-allocated metric",
expectedOutput: nil,
name: "cpu-allocated metric",
},
{
inputMetric: "cost-of-server",
inputMetric: "cost-of-server",
inputValidMetrics: []string{queryMetricCPU, queryMetricCPUAllocated, queryMetricMem},
expectedOutput: errors.New("invalid metric \"cost-of-server\", allowed values are: cpu, cpu-allocated, memory"),
name: "invalid metric",
expectedOutput: errors.New("invalid metric \"cost-of-server\", allowed values are: cpu, cpu-allocated, memory"),
name: "invalid metric",
},
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/builtin/apm/nomad/plugin/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func Test_parseNodePoolQuery(t *testing.T) {
name: "invalid metric",
},
{
inputQuery: "node_percentage-allocated_cpu-allocated/class/high-compute",
inputQuery: "node_percentage-allocated_cpu-allocated/class/high-compute",
expectedOutputQuery: nil,
expectError: errors.New("invalid metric \"cpu-allocated\", allowed values are: cpu, memory"),
name: "metric for task group queries only",
Expand Down

0 comments on commit 98a1a1d

Please sign in to comment.