|
|
@@ -1686,10 +1686,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
normalizationValue, err := getNormalizations(resNormalization)
|
|
|
if err != nil {
|
|
|
msg := fmt.Sprintf("error computing normalization for start=%s, end=%s, window=%s, res=%f", start, end, window, resolutionHours*60*60)
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap(msg)
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("%s: %s", msg, err)
|
|
|
+ return nil, prom.WrapError(err, msg)
|
|
|
}
|
|
|
|
|
|
measureTime(profileStart, profileThreshold, fmt.Sprintf("costDataRange(%fh): compute normalizations", durHrs))
|
|
|
@@ -1805,10 +1802,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
|
|
|
RAMReqMap, err := GetNormalizedContainerMetricVectors(resRAMRequests, normalizationValue, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetNormalizedContainerMetricVectors(RAMRequests)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetNormalizedContainerMetricVectors(RAMRequests): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetNormalizedContainerMetricVectors(RAMRequests)")
|
|
|
}
|
|
|
for key := range RAMReqMap {
|
|
|
containers[key] = true
|
|
|
@@ -1816,10 +1810,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
|
|
|
RAMUsedMap, err := GetNormalizedContainerMetricVectors(resRAMUsage, normalizationValue, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetNormalizedContainerMetricVectors(RAMUsage)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetNormalizedContainerMetricVectors(RAMUsage): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetNormalizedContainerMetricVectors(RAMUsage)")
|
|
|
}
|
|
|
for key := range RAMUsedMap {
|
|
|
containers[key] = true
|
|
|
@@ -1827,10 +1818,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
|
|
|
CPUReqMap, err := GetNormalizedContainerMetricVectors(resCPURequests, normalizationValue, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetNormalizedContainerMetricVectors(CPURequests)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetNormalizedContainerMetricVectors(CPURequests): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetNormalizedContainerMetricVectors(CPURequests)")
|
|
|
}
|
|
|
for key := range CPUReqMap {
|
|
|
containers[key] = true
|
|
|
@@ -1840,10 +1828,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
// rate(container_cpu_usage_seconds_total) which properly accounts for normalized rates
|
|
|
CPUUsedMap, err := GetContainerMetricVectors(resCPUUsage, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetContainerMetricVectors(CPUUsage)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetContainerMetricVectors(CPUUsage): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetContainerMetricVectors(CPUUsage)")
|
|
|
}
|
|
|
for key := range CPUUsedMap {
|
|
|
containers[key] = true
|
|
|
@@ -1851,10 +1836,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
|
|
|
RAMAllocMap, err := GetContainerMetricVectors(resRAMAlloc, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetContainerMetricVectors(RAMAllocations)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetContainerMetricVectors(RAMAllocations): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetContainerMetricVectors(RAMAllocations)")
|
|
|
}
|
|
|
for key := range RAMAllocMap {
|
|
|
containers[key] = true
|
|
|
@@ -1862,10 +1844,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
|
|
|
CPUAllocMap, err := GetContainerMetricVectors(resCPUAlloc, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetContainerMetricVectors(CPUAllocations)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetContainerMetricVectors(CPUAllocations): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetContainerMetricVectors(CPUAllocations)")
|
|
|
}
|
|
|
for key := range CPUAllocMap {
|
|
|
containers[key] = true
|
|
|
@@ -1873,10 +1852,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
|
|
|
GPUReqMap, err := GetNormalizedContainerMetricVectors(resGPURequests, normalizationValue, clusterID)
|
|
|
if err != nil {
|
|
|
- if pce, ok := err.(prom.CommError); ok {
|
|
|
- return nil, pce.Wrap("GetContainerMetricVectors(GPURequests)")
|
|
|
- }
|
|
|
- return nil, fmt.Errorf("GetContainerMetricVectors(GPURequests): %s", err)
|
|
|
+ return nil, prom.WrapError(err, "GetContainerMetricVectors(GPURequests)")
|
|
|
}
|
|
|
for key := range GPUReqMap {
|
|
|
containers[key] = true
|