@whook/otel
v27.0.2
Published
OpenTelemetry instrumentation wrappers for Whook
Maintainers
Readme
@whook/otel
OpenTelemetry instrumentation wrappers for Whook
This plugin instruments Whook-specific lifecycle steps with OpenTelemetry spans and events.
What is instrumented
httpRouter: request-level router span with events for routing, parsing, execution and transfer completion timings.httpTransaction: child span for each transaction.ROUTES_HANDLERS: execution spans per route operation.CRONS_HANDLERS: execution spans per cron run.CONSUMERS_HANDLERS: execution spans per consumer run.
Setup
Install the module:
npm i @whook/otelRegister the plugin before @whook/whook so its wrapped services are picked
first:
$.register(
constant('WHOOK_PLUGINS', [
'__project__',
+ '@whook/otel',
'@whook/whook',
]),
);You may need to manually wrap some services when already wrapped elsewhere:
+ import { wrapHTTPRouterWithOTel } from '@whook/otel';
// (...)
$.register(
+ wrapHTTPRouterWithOTel(
wrapHTTPRouterWithSwaggerUI(initHTTPRouter),
+ ),
);You will need to use the Open Telemetry SDK to send the data to a destination of your choice.
About apm
The built-in apm service is still relevant as a lightweight structured logging
fallback. This plugin is opt-in and focused on OpenTelemetry traces, so it does
not remove or replace apm.
