Structured observability hooks (the hooks config option). Every hook is optional and is
called synchronously with one event object; its return value is ignored and never awaited, so
an async hook does not delay the request. A hook that throws, or returns a promise that
rejects, never changes the call's outcome or retries: the error is swallowed (and passed to the
logger, if one is configured, as 'Hook <name> failed:', error). Keep hooks fast — offload
slow work (e.g. exporting telemetry) instead of doing it inline. Events are read-only: see
GlassnodeHookEventBase.
Hooks fire only once a call has passed argument validation: a GlassnodeInputError or a
GlassnodeConfigError fires none.
Order per call: onRequest → (onResponse) → [onRetry → onRequest → (onResponse)]… →
onError if the call fails. A successful call ends with an onResponse whose ok is true and
no onError; a 200 whose body fails parsing or schema validation is followed by onError.
Structured observability hooks (the
hooksconfig option). Every hook is optional and is called synchronously with one event object; its return value is ignored and never awaited, so an async hook does not delay the request. A hook that throws, or returns a promise that rejects, never changes the call's outcome or retries: the error is swallowed (and passed to thelogger, if one is configured, as'Hook <name> failed:', error). Keep hooks fast — offload slow work (e.g. exporting telemetry) instead of doing it inline. Events are read-only: see GlassnodeHookEventBase.Hooks fire only once a call has passed argument validation: a
GlassnodeInputErroror aGlassnodeConfigErrorfires none.Order per call:
onRequest→ (onResponse) → [onRetry→onRequest→ (onResponse)]… →onErrorif the call fails. A successful call ends with anonResponsewhoseokis true and noonError; a200whose body fails parsing or schema validation is followed byonError.