From e81a39581ca5bdb935c620e141539c9b7e8cbb6a Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Mon, 17 Jun 2024 17:00:25 +0530 Subject: [PATCH] refactor: update warning and error threshold messages --- src/redis_health_check.ts | 4 ++-- tests/health_checks.spec.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/redis_health_check.ts b/src/redis_health_check.ts index e208319..0b5f153 100644 --- a/src/redis_health_check.ts +++ b/src/redis_health_check.ts @@ -218,7 +218,7 @@ export class RedisHealthCheck extends BaseCheck { */ if (this.#failThreshold && memoryUsage > this.#failThreshold) { return Result.failed( - `Memory usage exceeded the "${stringHelpers.bytes.format(this.#failThreshold)}" threshold` + `Redis memory usage is "${stringHelpers.bytes.format(memoryUsage)}", which is above the threshold of "${stringHelpers.bytes.format(this.#failThreshold)}".` ) .mergeMetaData(this.#getConnectionMetadata()) .mergeMetaData(this.#getMemoryMetadata(memoryUsage)) @@ -229,7 +229,7 @@ export class RedisHealthCheck extends BaseCheck { */ if (this.#warnThreshold && memoryUsage > this.#warnThreshold) { return Result.warning( - `Memory usage exceeded the "${stringHelpers.bytes.format(this.#warnThreshold)}" threshold` + `Redis memory usage is "${stringHelpers.bytes.format(memoryUsage)}", which is above the threshold of "${stringHelpers.bytes.format(this.#warnThreshold)}".` ) .mergeMetaData(this.#getConnectionMetadata()) .mergeMetaData(this.#getMemoryMetadata(memoryUsage)) diff --git a/tests/health_checks.spec.ts b/tests/health_checks.spec.ts index b30f04c..c4f9774 100644 --- a/tests/health_checks.spec.ts +++ b/tests/health_checks.spec.ts @@ -118,7 +118,7 @@ test.group('Health check | redis connection', () => { const result = await healthCheck.run() assert.containsSubset(result, { - message: 'Memory usage exceeded the "100MB" threshold', + message: 'Redis memory usage is "101MB", which is above the threshold of "100MB".', status: 'warning', meta: { connection: { @@ -151,7 +151,7 @@ test.group('Health check | redis connection', () => { const result = await healthCheck.run() assert.containsSubset(result, { - message: 'Memory usage exceeded the "200MB" threshold', + message: 'Redis memory usage is "201MB", which is above the threshold of "200MB".', status: 'error', meta: { connection: {