Add log.fetch() HTTP auto-instrumentation and W3C traceparent propaga…#188
Conversation
|
Warning Review limit reached
More reviews will be available in 27 minutes and 7 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughVersion 2.3.0 adds W3C trace context support to the Changeslog.fetch() auto-instrumentation and W3C trace context propagation
Sequence Diagram(s)sequenceDiagram
participant Caller
participant LogFetch as log.fetch
participant globalFetch as globalThis.fetch
participant OTLP as OTLP /v1/traces
Caller->>LogFetch: fetch(url, init)
LogFetch->>LogFetch: create nested CLIENT span
LogFetch->>LogFetch: inject traceparent into request headers
LogFetch->>LogFetch: buildUrlFull - redact or strip query
LogFetch->>globalFetch: forward request
globalFetch-->>LogFetch: Response or network error
LogFetch->>LogFetch: record HTTP attrs and url.full
LogFetch->>LogFetch: set error status on 4xx or 5xx
LogFetch->>OTLP: export CLIENT span async via log.end()
LogFetch-->>Caller: return Response or rethrow
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Line 7: The documentation in AGENTS.md overstates the auto-instrumentation
behavior of log.fetch(). Update line 7 to clarify that log.fetch() only
auto-instruments outgoing HTTP requests when provided with string or URL inputs
(as defined by the Log.fetch(input: string | URL) signature in index.ts), and
that other input shapes fall back to raw fetch without creating a client span.
This will accurately reflect the narrower contract of the implementation and
prevent agents from relying on instrumentation that is not guaranteed for all
fetch input types.
In `@README.md`:
- Around line 73-88: The README documentation overstates the capabilities of
log.fetch() by claiming it is a full drop-in replacement for fetch(). However,
based on the actual implementation in index.ts, log.fetch() only supports string
or URL inputs; when given a Request object, it falls back to plain fetch()
without instrumentation. Revise the documentation to clarify that log.fetch() is
a drop-in replacement only for string/URL based fetch calls, and note that
Request-based inputs will not receive OpenTelemetry instrumentation or trace
header injection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 50faa494-cebf-40da-8e31-97e10a222b99
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
AGENTS.mdREADME.mdindex.tspackage.jsontest.ts
…s, drop throwaway-Log span carrier, docs
…ws (no end() hang); document fire-and-forget error semantics
…ang (defense-in-depth)
…tion (v2.3.0)
Summary by CodeRabbit
New Features
log.fetch()method as a drop-infetchreplacement with automatic HTTP tracing and OpenTelemetry span creationDocumentation