Skip to content

feat(v10/cloudflare): Add Spotlight integration for local dev event forwarding - #22796

Merged
JPeer264 merged 2 commits into
v10from
backport-v10/cloudflare-spotlight-integration
Jul 29, 2026
Merged

feat(v10/cloudflare): Add Spotlight integration for local dev event forwarding#22796
JPeer264 merged 2 commits into
v10from
backport-v10/cloudflare-spotlight-integration

Conversation

@JPeer264

@JPeer264 JPeer264 commented Jul 29, 2026

Copy link
Copy Markdown
Member

Backport of: #22490

And reverted dev/prod bundle split, as wrangler on its own doesn't support that

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.76 kB added added
@sentry/browser - with treeshaking flags 26.2 kB added added
@sentry/browser (incl. Tracing) 46.6 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.39 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.36 kB added added
@sentry/browser (incl. Tracing, Replay) 85.85 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.48 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 90.56 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.21 kB added added
@sentry/browser (incl. Feedback) 44.93 kB added added
@sentry/browser (incl. sendFeedback) 32.55 kB added added
@sentry/browser (incl. FeedbackAsync) 37.69 kB added added
@sentry/browser (incl. Metrics) 28.84 kB added added
@sentry/browser (incl. Logs) 29.07 kB added added
@sentry/browser (incl. Metrics & Logs) 29.77 kB added added
@sentry/react 29.56 kB added added
@sentry/react (incl. Tracing) 48.87 kB added added
@sentry/vue 33.19 kB added added
@sentry/vue (incl. Tracing) 48.56 kB added added
@sentry/svelte 27.79 kB added added
CDN Bundle 30.16 kB added added
CDN Bundle (incl. Tracing) 48.56 kB added added
CDN Bundle (incl. Logs, Metrics) 31.73 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 49.86 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71 kB added added
CDN Bundle (incl. Tracing, Replay) 86.06 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.37 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 91.86 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.13 kB added added
CDN Bundle - uncompressed 89.91 kB added added
CDN Bundle (incl. Tracing) - uncompressed 146.79 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.62 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.77 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.38 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.02 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.99 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.73 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.68 kB added added
@sentry/nextjs (client) 51.41 kB added added
@sentry/sveltekit (client) 47.02 kB added added
@sentry/core/server 80.44 kB added added
@sentry/core/browser 66.78 kB added added
@sentry/node-core 63.26 kB added added
@sentry/node 125.9 kB added added
@sentry/node (incl. diagnostics channel injection) 151.33 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB added added
@sentry/node/light 51.42 kB added added
@sentry/node - without tracing 74.94 kB added added
@sentry/aws-serverless 84.22 kB added added
@sentry/cloudflare (withSentry) - minified 200.49 kB added added
@sentry/cloudflare (withSentry) 492.69 kB added added

@JPeer264
JPeer264 marked this pull request as ready for review July 29, 2026 06:38
@JPeer264
JPeer264 requested a review from a team as a code owner July 29, 2026 06:38
@JPeer264
JPeer264 requested review from isaacs and mydea and removed request for a team July 29, 2026 06:38
Comment on lines +70 to +72
failCount = 0;
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Spotlight integration's circuit breaker does not trigger on HTTP 4xx/5xx errors, only on network failures, preventing it from disabling requests to a failing but reachable sidecar.
Severity: LOW

Suggested Fix

Modify the fetch() success callback to check the response status. If the status is outside the 200-399 range, increment the failCount. This ensures that both network errors and HTTP error responses contribute to triggering the circuit breaker, aligning with its intended purpose of handling all failure modes.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/cloudflare/src/integrations/spotlight.ts#L70-L72

Potential issue: The circuit-breaker logic in `spotlight.ts` is designed to stop sending
data to the Spotlight sidecar after repeated failures. However, it only increments the
`failCount` when the `fetch()` call is rejected (e.g., a network error). It does not
increment the count for successful `fetch` calls that result in an HTTP 4xx or 5xx
status code. As a result, if the sidecar is reachable but consistently returning errors,
the `failCount` will never increase, and the circuit breaker will fail to engage. This
leads to the integration continuously sending requests to a broken endpoint.

Did we get this right? 👍 / 👎 to inform future reviews.

@JPeer264
JPeer264 requested a review from andreiborza July 29, 2026 06:42
@JPeer264 JPeer264 self-assigned this Jul 29, 2026
@JPeer264
JPeer264 force-pushed the backport-v10/cloudflare-spotlight-integration branch from a1e4135 to 2d23219 Compare July 29, 2026 08:04
@JPeer264
JPeer264 force-pushed the backport-v10/cloudflare-spotlight-integration branch from 2d23219 to 0e163d1 Compare July 29, 2026 08:57
@JPeer264
JPeer264 enabled auto-merge (squash) July 29, 2026 08:59
@JPeer264
JPeer264 merged commit e96e15e into v10 Jul 29, 2026
606 of 610 checks passed
@JPeer264
JPeer264 deleted the backport-v10/cloudflare-spotlight-integration branch July 29, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants