mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-05 17:27:51 +00:00
Merge pull request #550 from olivierlemasle/stylecheck
golangci-lint: Add stylecheck linter
This commit is contained in:
commit
062c42eccc
2 changed files with 7 additions and 6 deletions
|
|
@ -23,6 +23,7 @@ linters:
|
||||||
- nolintlint
|
- nolintlint
|
||||||
- revive
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
- stylecheck
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unused
|
- unused
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
|
||||||
}
|
}
|
||||||
|
|
||||||
containerMetrics := make(map[string]metrics.ContainerMetrics)
|
containerMetrics := make(map[string]metrics.ContainerMetrics)
|
||||||
earliestTs := pmodel.Latest
|
earliestTS := pmodel.Latest
|
||||||
|
|
||||||
// organize all the CPU results
|
// organize all the CPU results
|
||||||
for _, cpu := range cpuRes {
|
for _, cpu := range cpuRes {
|
||||||
|
|
@ -211,8 +211,8 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
containerMetrics[containerName].Usage[corev1.ResourceCPU] = *resource.NewMilliQuantity(int64(cpu.Value*1000.0), resource.DecimalSI)
|
containerMetrics[containerName].Usage[corev1.ResourceCPU] = *resource.NewMilliQuantity(int64(cpu.Value*1000.0), resource.DecimalSI)
|
||||||
if cpu.Timestamp.Before(earliestTs) {
|
if cpu.Timestamp.Before(earliestTS) {
|
||||||
earliestTs = cpu.Timestamp
|
earliestTS = cpu.Timestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,8 +226,8 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
containerMetrics[containerName].Usage[corev1.ResourceMemory] = *resource.NewMilliQuantity(int64(mem.Value*1000.0), resource.BinarySI)
|
containerMetrics[containerName].Usage[corev1.ResourceMemory] = *resource.NewMilliQuantity(int64(mem.Value*1000.0), resource.BinarySI)
|
||||||
if mem.Timestamp.Before(earliestTs) {
|
if mem.Timestamp.Before(earliestTS) {
|
||||||
earliestTs = mem.Timestamp
|
earliestTS = mem.Timestamp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,7 +250,7 @@ func (p *resourceProvider) assignForPod(pod *metav1.PartialObjectMetadata, resul
|
||||||
CreationTimestamp: metav1.Now(),
|
CreationTimestamp: metav1.Now(),
|
||||||
},
|
},
|
||||||
// store the time in the final format
|
// store the time in the final format
|
||||||
Timestamp: metav1.NewTime(earliestTs.Time()),
|
Timestamp: metav1.NewTime(earliestTS.Time()),
|
||||||
Window: metav1.Duration{Duration: p.window},
|
Window: metav1.Duration{Duration: p.window},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue