@node-xray/core
v1.0.1
Published
Core runtime engine for node-xray: async context, event store, loop monitor, WebSocket hub, redactor
Downloads
93
Maintainers
Readme
@node-xray/core
Core runtime engine for node-xray. Provides async context tracking, an in-memory ring-buffer event store, event-loop monitoring, a versioned WebSocket hub, and default-deny header/body redaction.
Install
npm install @node-xray/coreYou normally do not need to install this package directly — it is a transitive dependency of every adapter (
@node-xray/express,@node-xray/fastify,@node-xray/nestjs).
Key exports
| Export | Description |
| ---------------------------------- | ----------------------------------------------------------------- |
| createCore() | Factory that adapters consume to initialize the runtime |
| getContext() | Read the current request's XRayContext from AsyncLocalStorage |
| withTags() | Annotate the current request with custom tags |
| resolveOptions() | Validate and merge user config with defaults |
| RequestStore | In-memory FIFO ring buffer (default 200 records) |
| createHub() | Versioned WebSocket hub with backpressure |
| redactHeaders() / redactBody() | Default-deny redaction for sensitive data |
| startLoopMonitor() | Event-loop delay and utilization sampling |
| mountDashboard() | Serve the dashboard UI with security headers |
Usage
import { createCore, getContext, withTags } from '@node-xray/core';