QHealthcheck
@quik/healthcheck / QHealthcheck
Class: QHealthcheck
Defined in: healthcheck/src/QHealthcheck.ts:8
In-memory healthcheck registry storing status by item name.
Extends
QObject
Implements
IQHealthcheck
Constructors
Constructor
new QHealthcheck():
QHealthcheck
Returns
QHealthcheck
Inherited from
QObject.constructor
Accessors
logger
Get Signature
get
protectedlogger():IQLogger
Defined in: core/src/QObject.ts:15
The logger getter for the object.
Returns
IQLogger
Inherited from
QObject.logger
name
Get Signature
get name():
string
Defined in: core/src/QObject.ts:8
Returns
string
Inherited from
QObject.name
Methods
all()
all():
Record<string,HealthcheckStatus>
Defined in: healthcheck/src/QHealthcheck.ts:15
Returns a snapshot of all registered items and their statuses.
Returns
Record<string, HealthcheckStatus>
Implementation of
IQHealthcheck.all
degraded()
degraded(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:22
Mark the given item as degraded.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.degraded
down()
down(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:29
Mark the given item as down.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.down
endSpan()
protectedendSpan(span):void
Defined in: core/src/QObject.ts:35
End a span returned by startSpan.
Parameters
span
TelemetrySpan
The span to end.
Returns
void
Inherited from
QObject.endSpan
ok()
ok(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:36
Mark the given item as ok.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.ok
pending()
pending(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:43
Mark the given item as pending.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.pending
ready()
ready(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:50
Mark the given item as ready.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.ready
recordSpanError()
protectedrecordSpanError(span,err):void
Defined in: core/src/QObject.ts:45
Record an exception on an active span.
Parameters
span
TelemetrySpan
The span to record the error on.
err
unknown
The error to record.
Returns
void
Inherited from
QObject.recordSpanError
register()
register(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:57
Register a healthcheck item with a default pending status.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.register
registerCheck()
registerCheck(
name,check,options?):void
Defined in: healthcheck/src/QHealthcheck.ts:64
Register a healthcheck function with optional timeout/error behavior.
Parameters
name
string
check
HealthcheckCheck
options?
HealthcheckCheckOptions
Returns
void
Implementation of
IQHealthcheck.registerCheck
runChecks()
runChecks(
options?):Promise<HealthcheckResults>
Defined in: healthcheck/src/QHealthcheck.ts:76
Execute all registered checks and update their statuses.
When healthcheck.cacheResultMs is greater than zero the result is cached
for that duration so repeated calls within the window skip re-running checks.
Useful when the healthcheck endpoint is polled frequently.
Parameters
options?
Returns
Promise<HealthcheckResults>
Implementation of
IQHealthcheck.runChecks
set()
set(
item,status):void
Defined in: healthcheck/src/QHealthcheck.ts:112
Set an explicit status for a healthcheck item.
Parameters
item
string
status
HealthcheckStatus
Returns
void
Implementation of
IQHealthcheck.set
setSpanAttribute()
protectedsetSpanAttribute(span,key,value):void
Defined in: core/src/QObject.ts:64
Set a single attribute on an active span.
Parameters
span
TelemetrySpan
The span to update.
key
string
Attribute key.
value
string | number | boolean
Attribute value.
Returns
void
Inherited from
QObject.setSpanAttribute
startSpan()
protectedstartSpan(spanName,options?):TelemetrySpan
Defined in: core/src/QObject.ts:26
Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.
Parameters
spanName
string
Name of the span.
options?
TelemetrySpanOptions
Optional span attributes and kind.
Returns
TelemetrySpan
Inherited from
QObject.startSpan
status()
status(
item):HealthcheckStatus
Defined in: healthcheck/src/QHealthcheck.ts:119
Returns the status for a given item, defaulting to pending.
Parameters
item
string
Returns
HealthcheckStatus
Implementation of
IQHealthcheck.status
unready()
unready(
item):void
Defined in: healthcheck/src/QHealthcheck.ts:127
Mark the given item as unready.
Parameters
item
string
Returns
void
Implementation of
IQHealthcheck.unready