You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(log-capture): pino integration and public API
Adds log-capture support to the pino plugin. When logCaptureEnabled is
true, the write hook publishes each serialized JSON log line to the
apm:pino:log:json diagnostic channel so the log-capture sender can
forward them to the Datadog log intake without requiring a sidecar Agent.
The hook is designed as an additive path alongside the existing log
injection: log injection (dd.trace_id / dd.span_id correlation) still
works independently, and capture-only mode (logInjection: false,
logCaptureEnabled: true) leaves the log record unmodified.
- pino/src/index.js: publish complete JSON line to apm:pino:log:json
on every write when logCaptureEnabled; compatible with pino 5-8.
Pass hasUserDd so the plugin skips injection but still captures records
that already carry a caller-provided dd field.
- datadog-instrumentations/src/pino.js: always publish to channel when
subscribers exist; hasUserDd flag prevents injection from overwriting
a caller-owned dd field while still forwarding the record for capture.
- docs/API.md: public documentation for DD_LOG_CAPTURE_* options
- .github/workflows/instrumentation.yml: add pino to instrumentation CI
- pino/test/unit.spec.js: unit test for capture-only mode
- pino/test/index.spec.js: integration smoke test for the JSON channel
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
dd-trace can forward JSON log records written by Pino directly to a custom HTTP(S) intake without adding transports to each logger. The forwarding hook publishes full log entries (including Datadog trace metadata when log injection is enabled) through an internal buffer that flushes on a timer and before process exit.
541
+
542
+
**Default behavior:** Log capture is enabled automatically in certain environments. For all other environments, enable it with `logCaptureEnabled: true` (or `DD_LOG_CAPTURE_ENABLED=true`). By default the sender targets `localhost:10517`; override with `logCaptureHost`/`DD_LOG_CAPTURE_HOST` and `logCapturePort`/`DD_LOG_CAPTURE_PORT` when needed.
543
+
544
+
Optional tuning knobs map 1:1 with the configuration API:
// host and port default to localhost:10517; override if needed:
561
+
logCaptureHost:'logs.my-intake.internal',
562
+
logCapturePort:8080,
563
+
logCaptureProtocol:'https:',
564
+
})
565
+
```
566
+
567
+
No additional transports or stream shims are required in user code.
568
+
569
+
538
570
<h3id="span-hooks">Span Hooks</h3>
539
571
540
572
In some cases, it's necessary to update the metadata of a span created by one of the built-in integrations. This is possible using span hooks registered by integration. Each hook provides the span as the first argument and other contextual objects as additional arguments.
0 commit comments