rebrandly-otel
v0.7.3
Published
NodeJS OTEL wrapper by Rebrandly
Readme
rebrandly-otel
Rebrandly's OpenTelemetry SDK for Node.js: traces, metrics and logs over OTLP, with wrappers for AWS Lambda (lambdaHandler, awsMessageHandler) and middlewares for Express, Fastify and lambda-api.
Full documentation: DOCUMENTATION.md. Release notes: CHANGELOG.md.
npm install rebrandly-otelconst { lambdaHandler, logger } = require('rebrandly-otel');
exports.handler = lambdaHandler({ name: 'my-function' })(async (event, context) => {
logger.info('Processing event');
});Node.js versions
^18.19.0 || >=20.6.0 — every Lambda nodejs18.x and later runtime. The SDK stays on the OpenTelemetry JS 2.x line on purpose; the 3.x line needs Node >= 22.15.
Histogram buckets
Histograms created without bucket advice use the SDK default boundaries, which are seconds-oriented:
0.001, 0.004, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5For milliseconds, bytes or anything else, pass advice.explicitBucketBoundaries — it always wins over the default (0.7.0+):
const { meter } = require('rebrandly-otel');
const latency = meter.meter.createHistogram('request.duration', {
unit: 'ms',
advice: { explicitBucketBoundaries: [10, 25, 50, 100, 250, 500, 1000, 2500, 5000] }
});See Custom Histograms.
Streaming Lambda handlers
lambdaHandler() can wrap an awslambda.streamifyResponse() handler (0.7.0+). See Streaming Handlers.
Development
npm install --include=dev # devDependencies are needed for the test suite
npm testPublishing: merging to master runs CI and npm publish.
