Skip to content
Open
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 .changeset/sentry-v11-segment-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-sentry": patch
---

Support Sentry 11. `@sentry/core` 11 removed `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`, so importing the plugin failed. The plugin now sets the span name source on `sentry.segment.name.source` with Sentry 11 and on `sentry.source` with Sentry 8-10.
13 changes: 13 additions & 0 deletions extensions/plugin-sentry/src/attributes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { SDK_VERSION } from "@sentry/browser";

/**
* Span attribute holding the transaction (segment) name source.
* Sentry 8-10 read `sentry.source`. Sentry 11 reads `sentry.segment.name.source`
* and no longer exports `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`, so the key is chosen
* from the `@sentry/browser` version instead of importing the constant. The spans
* are started through `@sentry/browser`, so its version decides which key is read.
*/
export const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE =
Number.parseInt(SDK_VERSION, 10) >= 11
? "sentry.segment.name.source"
: "sentry.source";
2 changes: 1 addition & 1 deletion extensions/plugin-sentry/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
} from "@sentry/core";
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./attributes";

export function stackflowBrowserTracingIntegration(
options: Parameters<typeof originalBrowserTracingIntegration>[0] = {},
Expand Down
2 changes: 1 addition & 1 deletion extensions/plugin-sentry/src/sentryPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as Sentry from "@sentry/browser";
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
} from "@sentry/core";
import type { StackflowPlugin } from "@stackflow/core";
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./attributes";

type NavigationAction =
| "push"
Expand Down
Loading