Skip to content

Commit

Permalink
Merge pull request #1043 from Krishanx92/master
Browse files Browse the repository at this point in the history
comment health check
  • Loading branch information
Krishanx92 authored Jan 17, 2024
2 parents cde2d49 + cb33406 commit 5763b69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions apim-apk-agent/internal/eventhub/dataloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (

pkgAuth "github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/auth"
"github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/eventhub/types"
"github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/health"
logger "github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/loggers"
"github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/logging"
sync "github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/synchronizer"
Expand Down Expand Up @@ -132,7 +131,8 @@ func LoadInitialData(configFile *config.Config) {
break
} else if data.ErrorCode >= 400 && data.ErrorCode < 500 {
//Error handle
health.SetControlPlaneRestAPIStatus(false)
logger.LoggerSync.Info("Error data information received")
//health.SetControlPlaneRestAPIStatus(false)
} else {
// Keep the iteration going on until a response is received.
// Error handle
Expand Down Expand Up @@ -175,7 +175,7 @@ func LoadInitialData(configFile *config.Config) {
Severity: logging.CRITICAL,
ErrorCode: 1600,
})
health.SetControlPlaneRestAPIStatus(false)
//health.SetControlPlaneRestAPIStatus(false)
} else {
// Keep the iteration going on until a response is recieved.
logger.LoggerSync.ErrorC(logging.ErrorDetails{
Expand Down Expand Up @@ -325,15 +325,15 @@ func FetchAPIsOnStartUp(conf *config.Config, apiUUIDList []string) {
} else if data.ErrorCode == 204 {
logger.LoggerMsg.Infof("No API Artifacts are available in the control plane for the envionments :%s",
strings.Join(envs, ", "))
health.SetControlPlaneRestAPIStatus(true)
//health.SetControlPlaneRestAPIStatus(true)
} else if data.ErrorCode >= 400 && data.ErrorCode < 500 {
logger.LoggerMsg.ErrorC(logging.ErrorDetails{
Message: fmt.Sprintf("Error occurred when retrieving APIs from control plane(unrecoverable error): %v", data.Err.Error()),
Severity: logging.CRITICAL,
ErrorCode: 1106,
})
isNoAPIArtifacts := data.ErrorCode == 404 && strings.Contains(data.Err.Error(), "No Api artifacts found")
health.SetControlPlaneRestAPIStatus(isNoAPIArtifacts)
//isNoAPIArtifacts := data.ErrorCode == 404 && strings.Contains(data.Err.Error(), "No Api artifacts found")
//health.SetControlPlaneRestAPIStatus(isNoAPIArtifacts)
} else {
// Keep the iteration still until all the envrionment response properly.
i--
Expand All @@ -342,7 +342,7 @@ func FetchAPIsOnStartUp(conf *config.Config, apiUUIDList []string) {
Severity: logging.MINOR,
ErrorCode: 1107,
})
health.SetControlPlaneRestAPIStatus(false)
//health.SetControlPlaneRestAPIStatus(false)
sync.RetryFetchingAPIs(c, data, sync.RuntimeArtifactEndpoint, true, queryParamMap)
}
}
Expand Down
3 changes: 1 addition & 2 deletions apim-apk-agent/internal/synchronizer/apis_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ package synchronizer

import (
"github.com/wso2/product-apim-tooling/apim-apk-agent/config"
"github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/health"

logger "github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/loggers"
sync "github.com/wso2/product-apim-tooling/apim-apk-agent/pkg/synchronizer"
Expand Down Expand Up @@ -99,7 +98,7 @@ func FetchAPIsFromControlPlane(updatedAPIID string, updatedEnvs []string) {
break
} else if data.ErrorCode >= 400 && data.ErrorCode < 500 {
logger.LoggerSync.Errorf("Error occurred when retrieving API %q from control plane: %v", updatedAPIID, data.Err)
health.SetControlPlaneRestAPIStatus(false)
//health.SetControlPlaneRestAPIStatus(false)
} else {
// Keep the iteration still until all the envrionment response properly.
logger.LoggerSync.Errorf("Error occurred while fetching data from control plane for the API %q: %v. Hence retrying..", updatedAPIID, data.Err)
Expand Down

0 comments on commit 5763b69

Please sign in to comment.