Skip to content

Commit

Permalink
refactor: update warning and error threshold messages
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jun 17, 2024
1 parent 6e8dc87 commit e81a395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/redis_health_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tests/health_checks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit e81a395

Please sign in to comment.