Skip to content

Commit

Permalink
fix: use retries in case app-detection-rule could not be deployed
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Warmuth <[email protected]>
  • Loading branch information
warber committed Oct 3, 2023
1 parent 7f30f23 commit 4d28e66
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/client/dtclient/config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ func isApplicationNotReadyYet(resp rest.Response, theApi api.API) bool {
return isCalculatedMetricsError(resp, theApi) ||
isSyntheticMonitorServerError(resp, theApi) ||
isApplicationAPIError(resp, theApi) ||
isApplicationRule5xx(resp, theApi) ||
strings.Contains(string(resp.Body), "Unknown application(s)")
}

Expand All @@ -341,6 +342,13 @@ func isApplicationAPIError(resp rest.Response, theApi api.API) bool {
(resp.Is5xxError() || resp.StatusCode == http.StatusConflict || resp.StatusCode == http.StatusNotFound)
}

// Special case (workaround):
// Sometimes, the API returns 500 Internal Server Error e.g. when an application referenced by
// an application detection rule is not fully "ready" yet.
func isApplicationRule5xx(resp rest.Response, theApi api.API) bool {
return theApi.ID == "app-detection-rule" && resp.Is5xxError()
}

func isCredentialNotReadyYet(resp rest.Response) bool {
s := string(resp.Body)
return strings.Contains(s, "credential-vault") &&
Expand Down

0 comments on commit 4d28e66

Please sign in to comment.