mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
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:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user