Prechádzať zdrojové kódy

added socket insight

Achilleas Tzenetopoulos 5 rokov pred
rodič
commit
16a5083855

+ 4 - 3
kubernetes-v1.15.4/pkg/scheduler/algorithm/priorities/custom_resource_allocation.go

@@ -155,7 +155,7 @@ func connectToInfluxDB(cfg Config) (client.Client, error) {
 
 }
 
-func queryInfluxDB(metrics []string, uuid string,
+func queryInfluxDB(metrics []string, uuid string, socket int,
 	time int, cfg Config, c client.Client) (map[string]float64, error) {
 
 	// calculate the number of rows needed
@@ -164,7 +164,7 @@ func queryInfluxDB(metrics []string, uuid string,
 	// merge all the required columns
 	columns := strings.Join(metrics, ", ")
 	// build the coommand
-	command := fmt.Sprintf("SELECT %s from system_metrics where uuid = '%s' order by time desc limit %d", columns, uuid, numberOfRows)
+	command := fmt.Sprintf("SELECT %s from socket_metrics where uuid = '%s' and socket_id='%d' order by time desc limit %d", columns, uuid, socket, numberOfRows)
 	q := client.NewQuery(command, cfg.Database.Name, "")
 	response, err := c.Query(q)
 	if err != nil {
@@ -196,9 +196,10 @@ func customResourceScorer(nodeName string) (int64, error) {
 
 	//Get the uuid of this node in order to query in the database
 	curr_uuid, ok := nodes[nodeName]
+	socket, _ := sockets[nodeName]
 
 	if ok {
-		results, err := queryInfluxDB([]string{"ipc", "l3m", "c6res"}, curr_uuid, 20, cfg, c)
+		results, err := queryInfluxDB([]string{"ipc", "l3m", "c6res"}, curr_uuid, socket, 20, cfg, c)
 		if err != nil {
 			klog.Infof("Error in querying or calculating average: %v", err.Error())
 			return 0, nil