|
@@ -1378,6 +1378,12 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
}
|
|
}
|
|
|
clusterID := os.Getenv(clusterIDKey)
|
|
clusterID := os.Getenv(clusterIDKey)
|
|
|
|
|
|
|
|
|
|
+ durHrs := end.Sub(start).Hours() + 1
|
|
|
|
|
+ durStr := fmt.Sprintf("%fh", durHrs)
|
|
|
|
|
+ if durHrs > 24.0 {
|
|
|
|
|
+ durStr = fmt.Sprintf("%fd", durHrs/24.0)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if remoteEnabled == true {
|
|
if remoteEnabled == true {
|
|
|
remoteLayout := "2006-01-02T15:04:05Z"
|
|
remoteLayout := "2006-01-02T15:04:05Z"
|
|
|
remoteStartStr := start.Format(remoteLayout)
|
|
remoteStartStr := start.Format(remoteLayout)
|
|
@@ -1566,9 +1572,9 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
for msg := range queryProfileCh {
|
|
for msg := range queryProfileCh {
|
|
|
queryProfileBreakdown += "\n - " + msg
|
|
queryProfileBreakdown += "\n - " + msg
|
|
|
}
|
|
}
|
|
|
- measureTime(queryProfileStart, fmt.Sprintf("costDataRange(%s): Prom/k8s Queries: %s", windowString, queryProfileBreakdown))
|
|
|
|
|
|
|
+ measureTime(queryProfileStart, fmt.Sprintf("costDataRange(%s): Prom/k8s Queries: %s", durStr, queryProfileBreakdown))
|
|
|
|
|
|
|
|
- defer measureTime(time.Now(), fmt.Sprintf("costDataRange(%s): Processing Query Data", windowString))
|
|
|
|
|
|
|
+ defer measureTime(time.Now(), fmt.Sprintf("costDataRange(%s): Processing Query Data", durStr))
|
|
|
|
|
|
|
|
if promErr != nil {
|
|
if promErr != nil {
|
|
|
return nil, fmt.Errorf("Error querying prometheus: %s", promErr.Error())
|
|
return nil, fmt.Errorf("Error querying prometheus: %s", promErr.Error())
|
|
@@ -1585,7 +1591,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
start, end, window, err.Error())
|
|
start, end, window, err.Error())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): compute normalizations", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): compute normalizations", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -1595,7 +1601,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): GetNodeCost", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): GetNodeCost", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -1624,7 +1630,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
addMetricPVData(pvAllocationMapping, pvCostMapping, cp)
|
|
addMetricPVData(pvAllocationMapping, pvCostMapping, cp)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): process PV data", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): process PV data", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -1656,7 +1662,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
klog.V(1).Infof("Unable to get Deployment Match Labels for Metrics: %s", err.Error())
|
|
klog.V(1).Infof("Unable to get Deployment Match Labels for Metrics: %s", err.Error())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): process labels", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): process labels", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -1684,7 +1690,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
networkUsageMap = make(map[string]*NetworkUsageData)
|
|
networkUsageMap = make(map[string]*NetworkUsageData)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): process deployments, services, and network usage", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): process deployments, services, and network usage", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -1744,7 +1750,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
containers[key] = true
|
|
containers[key] = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): GetContainerMetricVectors", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): GetContainerMetricVectors", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -1769,7 +1775,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): applyAllocationToRequests", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): applyAllocationToRequests", durStr))
|
|
|
|
|
|
|
|
profileStart = time.Now()
|
|
profileStart = time.Now()
|
|
|
|
|
|
|
@@ -2072,7 +2078,7 @@ func (cm *CostModel) costDataRange(cli prometheusClient.Client, clientset kubern
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- measureTime(profileStart, fmt.Sprintf("costDataRange(%s): build CostData map", windowString))
|
|
|
|
|
|
|
+ measureTime(profileStart, fmt.Sprintf("costDataRange(%s): build CostData map", durStr))
|
|
|
|
|
|
|
|
w := end.Sub(start)
|
|
w := end.Sub(start)
|
|
|
w += window
|
|
w += window
|