@langwatch/n8n-observability
v1.0.0
Published
LangWatch + n8n OpenTelemetry bootstrap (TypeScript, modern, preloadable).
Readme
@langwatch/n8n-observability
This package provides the actual n8n instrumentation for LangWatch observability.
It is published to npm as @langwatch/n8n-observability.
For a guide on how to use this package, see the setup guide in the other readme.
Development
Prerequisites
- Node.js ≥ 18
- pnpm ≥ 8
Build
pnpm install
pnpm buildBuild artifacts include:
dist/hooks.cjs→ CommonJS entry forEXTERNAL_HOOK_FILESdist/index.js→ ESM programmatic API
Test & Lint
pnpm test
pnpm lintInternals: How it Works
- Registers LangWatch’s Node SDK (
setupObservability) → OpenTelemetry tracer provider. - Locates the active
n8n-coreinstance and patchesWorkflowExecute:processRunExecutionData→ workflow spanprocessRunData→ workflow spanrunNode→ per-node span
- Patching is idempotent (guarded by
WeakSet).
Span Model
Workflow spans (
n8n.workflow.execute.*)
Attributes:n8n.workflow.id,n8n.workflow.name; errors recorded as exception events.Node spans (
n8n.node.execute)
Attributes undern8n.node.*(type, name, etc.); optional JSON I/O capture; errors recorded as exception events.
Privacy
Inputs/outputs come from INodeExecutionData.json.
Disable capture with N8N_OTEL_CAPTURE_INPUT=false, or configure redaction rules in LangWatch.
Troubleshooting
No n8n-core patched
- Set
N8N_OTEL_DEBUG=1to see search paths. - Verify
EXTERNAL_HOOK_FILESpoints todist/hooks.cjs.
- Set
setupObservabilityfailed- Check
LANGWATCH_API_KEY. - Verify network access to LangWatch.
- Check
No spans
- Look for startup log:
observability ready and patches applied. - Confirm I/O capture isn’t disabled if expecting inputs/outputs.
- Look for startup log:
License
MIT. View the LICENSE file for details.
