Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Uses **Git Flow** (see `docs/gitflow.md`).
- Use `.github/PULL_REQUEST_TEMPLATE.md` for the body (`gh pr create --body` skips it). Ideally 1-2 sentences per field, no AI walkthrough.
- Always open PRs as draft.
- Never apply the `Accept Bundlesize Increase` label.
- When you review, do not ask for a regression test on a `fix(deps)` PR that only bumps a first-party package (`sentry`,
`@sentry/*`) to a version with the fix, or on an early PR of a stack when a later PR of the stack adds the tests.
- **Keep PR descriptions condensed** — usually a few sentences. Explain the _reasoning_: why the change is needed, and any non-obvious decisions or tradeoffs made along the way. Do **not** walk through the implementation or describe what changed file-by-file — the diff already shows that. Only go longer when the decisions genuinely warrant it.

## Architecture
Expand All @@ -77,6 +79,9 @@ Uses **Git Flow** (see `docs/gitflow.md`).
- `Sentry.init()` follows one rule for repeated calls: the first call wins. See
`docs/repeated-init.md` before you add or change an `init()`.

- In the `exports` of a framework SDK, put the `workerd` and `worker` keys before `browser`. Cloudflare bundlers also
set the `browser` condition, and the first key that matches wins.

- Span origins must follow the [trace origin spec](https://develop.sentry.dev/sdk/telemetry/traces/trace-origin/):
`<type>.<category>.<integration_name>.<integration_part>`, at most four parts, no skipped
parts, only `[a-zA-Z0-9_]` within a part. `category` is the span op category
Expand Down
1 change: 1 addition & 0 deletions dev-packages/browser-integration-tests/scripts/clean.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { globSync, rmSync } from 'node:fs';

// `fs.globSync` needs Node 22. This is a local helper, and the repo pins Node 24 in `devEngines`.
for (const path of globSync(['suites/**/dist', 'loader-suites/**/dist', 'tmp'])) {
rmSync(path, { recursive: true, force: true });
}
1 change: 1 addition & 0 deletions dev-packages/node-integration-tests/scripts/clean.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { execSync } = require('child_process');
const { globSync, rmSync } = require('fs');

// `fs.globSync` needs Node 22. This is a local helper, and the repo pins Node 24 in `devEngines`.
for (const path of globSync(['suites/**/node_modules', 'suites/**/tmp_*'])) {
rmSync(path, { recursive: true, force: true });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { instrumentEnv } from './instrumentEnv';

type TailMethod = 'tail' | 'trace' | 'tailStream';

// workerd calls `trace` only when the worker has no `tail`. It is not documented, but it is still in use.
const TAIL_METHODS: TailMethod[] = ['tail', 'trace', 'tailStream'];

const MECHANISM_TYPES: Record<TailMethod, string> = {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/tracing/spans/spanBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ export class SpanBuffer {
* Spans are captured when they end, but the segment span can still be renamed afterwards
* (e.g. once the route is known). Only replace the value we set at capture time, so that
* values set by users or `beforeSendSpan` are kept.
*
* Renames that Next.js applies only when it serializes the segment span (`processSegmentSpan`) come after
* this and are not refreshed.
*/
function refreshSegmentName(
spanJSON: SerializedStreamedSpan,
Expand Down
7 changes: 6 additions & 1 deletion packages/remix/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ export function convertRemixRouteIdToPath(routeId: string): string {
return routePath;
}

/** Check if running in Cloudflare Workers environment. */
/**
* Check if running in Cloudflare Workers environment.
*
* Not `isCloudflareWorkers()` from `@sentry/server-utils`: any import of that package pulls `node:async_hooks`
* into Hydrogen builds.
*/
export function isCloudflareEnv(): boolean {
// eslint-disable-next-line no-restricted-globals
return typeof navigator !== 'undefined' && navigator?.userAgent?.includes('Cloudflare');
Expand Down
2 changes: 2 additions & 0 deletions packages/server-utils/src/integrations/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ function wrapThreadStreamRequest(span: Span, data: AnthropicChannelContext, end:
},
error => {
// An abort is not a failed request. The stream still emits 'end', which sets the status from the caller's signal.
// The thread emits 'abort' and 'end' only after it awaits `_responseProps()` itself, which is after this handler,
// so the listeners cannot miss them.
if (signal.aborted) {
instrumentMessageStream(stream, span, recordOutputs, callerSignal, data._sentryOnSpanEnd);
} else {
Expand Down
2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ allowBuilds:
vue-demi: true
workerd: true
minimumReleaseAgeExclude:
# Globs for the packages this repo publishes, so a new release installs at once. A pinned version stops
# matching at the next bump.
- '@sentry/*'
- sentry
- '@apm-js-collab/code-transformer-bundler-plugins@0.7.6'
Expand Down
Loading