feat(logging, ai): add log capture with native transport injection - #7522
feat(logging, ai): add log capture with native transport injection #7522litianningdatadog wants to merge 1 commit into
Conversation
Overall package sizeSelf size: 4.89 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 816.75 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
✨ Fix all issues with BitsAI or with Cursor
|
BenchmarksBenchmark execution time: 2026-03-03 23:24:24 Comparing candidate commit 4bb3175 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 229 metrics, 31 unstable metrics. |
fbc3011 to
97d90fa
Compare
97d90fa to
df6a242
Compare
Code reviewFound 9 issues: Bugs
dd-trace-js/packages/dd-trace/src/plugins/log_plugin.js Lines 97 to 102 in df6a242
dd-trace-js/packages/datadog-instrumentations/src/winston.js Lines 55 to 61 in df6a242
dd-trace-js/packages/dd-trace/src/plugins/log_plugin.js Lines 261 to 270 in df6a242
dd-trace-js/packages/dd-trace/src/plugins/bunyan_http_stream.js Lines 18 to 21 in df6a242 CLAUDE.md violations
dd-trace-js/packages/dd-trace/src/plugins/pino_http_transport.js Lines 89 to 93 in df6a242
dd-trace-js/packages/datadog-instrumentations/src/pino.js Lines 13 to 17 in df6a242
dd-trace-js/packages/dd-trace/src/plugins/bunyan_http_stream.js Lines 85 to 95 in df6a242 dd-trace-js/packages/dd-trace/src/plugins/pino_http_transport.js Lines 60 to 69 in df6a242
dd-trace-js/packages/dd-trace/src/plugins/pino_http_transport.js Lines 97 to 103 in df6a242
dd-trace-js/packages/dd-trace/src/config/defaults.js Lines 129 to 133 in df6a242 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
df6a242 to
9739b77
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7522 +/- ##
==========================================
- Coverage 80.28% 76.22% -4.07%
==========================================
Files 738 643 -95
Lines 31897 27194 -4703
==========================================
- Hits 25610 20729 -4881
- Misses 6287 6465 +178
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f4219f9 to
84f060f
Compare
All have been addressed |
Implements automatic log forwarding for Winston, Bunyan, and Pino by injecting native HTTP transports/streams directly into logger instances. Features: - Zero-configuration automatic injection via diagnostic channels - Native performance using logger-specific transports - Full trace correlation (trace_id, span_id, service, env, version) - Non-invasive (logs still go to original destinations) - Single intake endpoint with automatic format detection - Configurable batching and buffering Implementation: - Winston: Uses native winston.transports.Http - Bunyan: Custom Writable stream in object mode - Pino: Custom transport with NDJSON parsing Configuration: 9 new options (DD_LOG_CAPTURE_*) Performance: ~1.5-2μs per log overhead Package size: +33 KB (+0.13%) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
84f060f to
4bb3175
Compare
Background:
https://datadoghq.atlassian.net/browse/SVLS-8572
The AWS Serverless team is exploring an approach that leverages dd-trace log injection to collect logs without depending on CloudWatch or the Log Forwarder. This would:
• Simplify the Datadog log ingestion setup
• Provide customers with potential cost savings
What does this PR do?
This PR implements native logger transport injection that automatically forwards application logs to a custom intake service by injecting HTTP transports/streams directly into Winston, Bunyan, and Pino loggers.
Implements automatic log forwarding for Winston, Bunyan, and Pino by injecting native HTTP transports/streams directly into logger instances.
Component Architecture

Key Features:
Implementation Approach:
Performance:
Test Coverage:
additions
Motivation
Business Value:
Why Native Transport Injection?
Use Cases: