Make threshold checks configurable (#15284)

* Make threshold checks configurable

* Fix linter

Co-authored-by: Roman Nazarev <roman.nazarev@skyeng.ru>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
nazarevrn
2022-08-30 21:41:26 +03:00
committed by GitHub
parent 6e19683a00
commit 9c55ed6728
2 changed files with 7 additions and 5 deletions

View File

@@ -76,6 +76,7 @@ const allowedEnvironmentVars = [
'CACHE_REDIS_PASSWORD',
'CACHE_MEMCACHE',
'CACHE_VALUE_MAX_SIZE',
'CACHE_HEALTHCHECK_THRESHOLD',
// storage
'STORAGE_LOCATIONS',
'STORAGE_.+_DRIVER',
@@ -92,6 +93,7 @@ const allowedEnvironmentVars = [
'STORAGE_.+_ENDPOINT',
'STORAGE_.+_KEY_FILENAME',
'STORAGE_.+_BUCKET',
'STORAGE_.+_HEALTHCHECK_THRESHOLD',
// metadata
'FILE_METADATA_ALLOW_LIST',
// assets

View File

@@ -160,7 +160,7 @@ export class ServerService {
componentType: 'datastore',
observedUnit: 'ms',
observedValue: 0,
threshold: 150,
threshold: env.DB_HEALTHCHECK_THRESHOLD ? +env.DB_HEALTHCHECK_THRESHOLD : 150,
},
];
@@ -216,7 +216,7 @@ export class ServerService {
componentType: 'cache',
observedValue: 0,
observedUnit: 'ms',
threshold: 150,
threshold: env.CACHE_HEALTHCHECK_THRESHOLD ? +env.CACHE_HEALTHCHECK_THRESHOLD : 150,
},
],
};
@@ -256,7 +256,7 @@ export class ServerService {
componentType: 'ratelimiter',
observedValue: 0,
observedUnit: 'ms',
threshold: 150,
threshold: env.RATE_LIMITER_HEALTHCHECK_THRESHOLD ? +env.RATE_LIMITER_HEALTHCHECK_THRESHOLD : 150,
},
],
};
@@ -289,14 +289,14 @@ export class ServerService {
for (const location of toArray(env.STORAGE_LOCATIONS)) {
const disk = storage.disk(location);
const envThresholdKey = `STORAGE_${location}_HEALTHCHECK_THRESHOLD`.toUpperCase();
checks[`storage:${location}:responseTime`] = [
{
status: 'ok',
componentType: 'objectstore',
observedValue: 0,
observedUnit: 'ms',
threshold: 750,
threshold: env[envThresholdKey] ? +env[envThresholdKey] : 750,
},
];