[PLT-5465/APIV4] GET /system/health - Improve ping health check to have limits (#6331)
* implement PLT-5465 - Improve ping health check to have limits * update /ping and delete /health * remove permission check
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
0e4add96ae
Коммит
ddc996f33f
@@ -1737,15 +1737,18 @@ func (c *Client4) GetFileInfosForPost(postId string, etag string) ([]*FileInfo,
|
||||
}
|
||||
}
|
||||
|
||||
// General Section
|
||||
// General/System Section
|
||||
|
||||
// GetPing will ping the server and to see if it is up and running.
|
||||
func (c *Client4) GetPing() (bool, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetSystemRoute()+"/ping", ""); err != nil {
|
||||
return false, &Response{StatusCode: r.StatusCode, Error: err}
|
||||
// GetPing will return ok if the running goRoutines are below the threshold and unhealthy for above.
|
||||
func (c *Client4) GetPing() (string, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetSystemRoute()+"/ping", ""); r.StatusCode == 500 {
|
||||
defer r.Body.Close()
|
||||
return "unhealthy", &Response{StatusCode: r.StatusCode, Error: err}
|
||||
} else if err != nil {
|
||||
return "", &Response{StatusCode: r.StatusCode, Error: err}
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return CheckStatusOK(r), BuildResponse(r)
|
||||
return MapFromJson(r.Body)["status"], BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ type ServiceSettings struct {
|
||||
ReadTimeout *int
|
||||
WriteTimeout *int
|
||||
MaximumLoginAttempts int
|
||||
GoroutineHealthThreshold *int
|
||||
GoogleDeveloperKey string
|
||||
EnableOAuthServiceProvider bool
|
||||
EnableIncomingWebhooks bool
|
||||
@@ -1170,6 +1171,11 @@ func (o *Config) SetDefaults() {
|
||||
*o.RateLimitSettings.Enable = false
|
||||
}
|
||||
|
||||
if o.ServiceSettings.GoroutineHealthThreshold == nil {
|
||||
o.ServiceSettings.GoroutineHealthThreshold = new(int)
|
||||
*o.ServiceSettings.GoroutineHealthThreshold = -1
|
||||
}
|
||||
|
||||
if o.RateLimitSettings.MaxBurst == nil {
|
||||
o.RateLimitSettings.MaxBurst = new(int)
|
||||
*o.RateLimitSettings.MaxBurst = 100
|
||||
|
||||
Ссылка в новой задаче
Block a user