Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recommend by latency error #1634

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/setup.env
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export LOGFILE_MAXSIZE=10
export LOGFILE_MAXBACKUPS=3
export LOGFILE_MAXAGE=30
export LOGFILE_COMPRESS=false
# Set log level, such as trace, debug info, warn, error, fatal, and panic
# Set log level, such as trace, debug, info, warn, error, fatal, and panic
export LOGLEVEL=debug
# Set log writer, such as file, stdout, or both
export LOGWRITER=both
Expand Down
2 changes: 1 addition & 1 deletion src/api/rest/server/middlewares/custom-middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func RequestIdAndDetailsIssuer(next echo.HandlerFunc) echo.HandlerFunc {
// Set Request on the context
c.Set("RequestID", reqID)

log.Trace().Msgf("(Request ID middleware) Request ID: %s", reqID)
//log.Trace().Msgf("(Request ID middleware) Request ID: %s", reqID)
if _, ok := common.RequestMap.Load(reqID); ok {
return fmt.Errorf("the X-Request-Id is already in use")
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/rest/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ func RunServer(port string) {
fmt.Println(" Default CredentialHolder: " + common.DefaultCredentialHolder + "\n")

if enableAuth {
fmt.Println(" Access to API dashboard" + " (username: " + apiUser + " / password: " + apiPass + ")")
fmt.Println(" Access to API dashboard" + " (username: $API_USERNAME / password: $API_PASSWORD)")
}

fmt.Printf(noticeColor, apidashboard)
Expand Down
5 changes: 3 additions & 2 deletions src/core/mcis/recommendation.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func RecommendVmLatency(nsId string, specList *[]mcir.TbSpecInfo, param *[]Param
for i, k := range *specList {
sumLatancy := 0.0
for _, region := range v.Val {
l, _ := GetLatency(region, k.RegionName)
l, _ := GetLatency(region, k.ProviderName+"-"+k.RegionName)
sumLatancy += l
}

Expand Down Expand Up @@ -555,10 +555,11 @@ func getDistance(latitude float64, longitude float64, providerName string, regio

// GetLatency func get latency between given two regions
func GetLatency(src string, dest string) (float64, error) {

latencyString := common.RuntimeLatancyMap[common.RuntimeLatancyMapIndex[src]][common.RuntimeLatancyMapIndex[dest]]
latency, err := strconv.ParseFloat(strings.ReplaceAll(latencyString, " ", ""), 32)
if err != nil {
log.Error().Err(err).Msg("")
log.Info().Err(err).Msgf("Cannot get GetLatency between src: %v, dest: %v (check assets)", src, dest)
return 999999, err
}
return latency, nil
Expand Down
2 changes: 1 addition & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func setConfig() {
log.Error().Err(err).Msg("")
panic(err)
}
common.PrintCredentialInfo(common.RuntimeCredential)
// common.PrintCredentialInfo(common.RuntimeCredential)
}

// err = common.RegisterAllCloudInfo()
Expand Down