diff --git a/docs/platforms/javascript/common/configuration/integrations/graphql.mdx b/docs/platforms/javascript/common/configuration/integrations/graphql.mdx index 9edaeac99c8ba..53f518ec8e867 100644 --- a/docs/platforms/javascript/common/configuration/integrations/graphql.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/graphql.mdx @@ -68,10 +68,10 @@ When a resolver function is not defined on the schema for a field, GraphQL will _Type: `boolean`_ -By default, this option is `true`. +By default, this option is `true`. When enabled, it records GraphQL operations on the enclosing root span in the `sentry.graphql.operation` attribute. Its effect on the root span name depends on the tracing mode: -With this setting enabled, the GraphQL instrumentation dynamically updates the name of the `http.server` root span by appending -the operation names. Instead of generic span names like `POST /graphql`, span names will be more descriptive, such as `POST /graphql (query MyQuery)`. -For requests containing multiple operations, the span names will aggregate operation names, for example `POST /graphql (query Query1, query Query2)` +- In streaming mode, the root span name stays unchanged. Set the option to `false` to skip adding `sentry.graphql.operation` to the root span. -Set the option to `false` to preserve the default `http.server` span name without this additional context. +- In static mode, with `traceLifecycle: "static"`, enabling this option also appends operation names to the `http.server` root span name. For example, `POST /graphql` becomes `POST /graphql (query MyQuery)`. Requests containing multiple operations include each operation name, such as `POST /graphql (query Query1, query Query2)`. Set the option to `false` to skip the root span attribute and preserve the original root span name. + +In both modes, the GraphQL span records `graphql.operation.name` and `graphql.operation.type` when available, regardless of this option. diff --git a/docs/platforms/javascript/common/configuration/integrations/supabase.mdx b/docs/platforms/javascript/common/configuration/integrations/supabase.mdx index 1531e7a70c7dc..4b27965cfb57a 100644 --- a/docs/platforms/javascript/common/configuration/integrations/supabase.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/supabase.mdx @@ -91,7 +91,7 @@ These spans are used to populate Sentry's [pre-built Query Dashboards](/product/ - `db.schema`: The database schema - `db.url`: The Supabase instance URL - `db.sdk`: Client information -- `db.system`: Set to 'postgresql' +- `db.system.name`: Set to 'postgresql' - `db.query`: The query parameters - `db.body`: The request body (for mutations) diff --git a/docs/platforms/javascript/common/migration/v10-to-v11/index.mdx b/docs/platforms/javascript/common/migration/v10-to-v11/index.mdx index 83aa7dbabd85a..aec09d59042a9 100644 --- a/docs/platforms/javascript/common/migration/v10-to-v11/index.mdx +++ b/docs/platforms/javascript/common/migration/v10-to-v11/index.mdx @@ -597,7 +597,7 @@ The Anthropic integration no longer sets `gen_ai.prompt`. The legacy Completions - The TanStack Router integration reports path parameters as `url.path.parameter.` instead of `url.path.params.`. - The Cloudflare-specific `sentry.cloudflare_tracer` attribute is no longer set. - Import attribute constants from `@sentry/core` directly. The `semanticAttributes` re-export was removed. -- `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE` (`sentry.source`) was replaced by `SENTRY_SEGMENT_NAME_SOURCE` (`sentry.segment.name.source`), which is only set on the root span. +- `sentry.source` (`SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`) was replaced by `sentry.segment.name.source`, which is only set on the root span. diff --git a/docs/platforms/javascript/common/tracing/instrumentation/index.mdx b/docs/platforms/javascript/common/tracing/instrumentation/index.mdx index 3bb8112b3e6ed..b3dd3186db461 100644 --- a/docs/platforms/javascript/common/tracing/instrumentation/index.mdx +++ b/docs/platforms/javascript/common/tracing/instrumentation/index.mdx @@ -256,12 +256,9 @@ if (span) { } ``` -Prior to v8.39.0, you had to use `span.updateName('New Name')`, which had some limitations in `@sentry/node` and SDKs depending on it (for example, `@sentry/nextjs`): +Automatically instrumented spans use attributes such as `http.request.method` and `db.system.name` to derive their names. These names are low-cardinality. Raw URL paths, full query statements, and other request-specific details stay in attributes instead of the span name. -- Spans with `http.method` or `http.request.method` attributes would automatically have their name set to the method + the URL path. -- Spans with `db.system` attributes would automatically have their name set to the system + the statement. - -Using `Sentry.updateSpanName()` ensures that the name is updated correctly and no longer overwritten in these cases. +Use `Sentry.updateSpanName()` to override the automatically generated name. Choose a name that groups similar operations, and store request-specific details in span attributes. If you use `@sentry/browser`, `@sentry/react`, and so on in browser environments, `span.updateName()` and `Sentry.updateSpanName()` will function identically, so you can use either one of them. diff --git a/docs/platforms/javascript/common/tracing/instrumentation/requests-module.mdx b/docs/platforms/javascript/common/tracing/instrumentation/requests-module.mdx index 4701c5aaf7a77..1edce4069f9df 100644 --- a/docs/platforms/javascript/common/tracing/instrumentation/requests-module.mdx +++ b/docs/platforms/javascript/common/tracing/instrumentation/requests-module.mdx @@ -36,7 +36,7 @@ async function makeRequest(method, url) { span.setAttribute("http.response.status_code", response.status); span.setAttribute( - "http.response_content_length", + "http.response.body.size", Number(response.headers.get("content-length")) ); diff --git a/includes/migration/javascript-v11/span-attribute-changes.mdx b/includes/migration/javascript-v11/span-attribute-changes.mdx index 4c070d672cb27..cdc9c2c2060b6 100644 --- a/includes/migration/javascript-v11/span-attribute-changes.mdx +++ b/includes/migration/javascript-v11/span-attribute-changes.mdx @@ -98,6 +98,6 @@ The Anthropic integration no longer sets `gen_ai.prompt`. The legacy Completions - The TanStack Router integration reports path parameters as `url.path.parameter.` instead of `url.path.params.`. - The Cloudflare-specific `sentry.cloudflare_tracer` attribute is no longer set. - Import attribute constants from `@sentry/core` directly. The `semanticAttributes` re-export was removed. -- `SEMANTIC_ATTRIBUTE_SENTRY_SOURCE` (`sentry.source`) was replaced by `SENTRY_SEGMENT_NAME_SOURCE` (`sentry.segment.name.source`), which is only set on the root span. +- `sentry.source` (`SEMANTIC_ATTRIBUTE_SENTRY_SOURCE`) was replaced by `sentry.segment.name.source`, which is only set on the root span. diff --git a/platform-includes/performance/add-spans-example/javascript.mdx b/platform-includes/performance/add-spans-example/javascript.mdx index 4092a0bf335c7..800967ac2397f 100644 --- a/platform-includes/performance/add-spans-example/javascript.mdx +++ b/platform-includes/performance/add-spans-example/javascript.mdx @@ -45,7 +45,7 @@ function processItem(item) { http.get(`/items/${item.id}`, (response) => { response.on("data", () => {}); response.on("end", () => { - span.setTag("http.status_code", response.statusCode); + span.setAttribute("http.response.status_code", response.statusCode); span.setAttribute( "http.foobarsessionid", getFoobarSessionid(response) @@ -72,7 +72,7 @@ function processItem(item) { const response = await fetch("/items/${item.id}"); const json = await response.json(); - span.setTag("http.status_code", response.statusCode); + span.setAttribute("http.response.status_code", response.status); span.setAttribute("http.foobarsessionid", getFoobarSessionid(response)); } ); diff --git a/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx b/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx index f1238fabd3b94..99ad8cd43b12e 100644 --- a/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx +++ b/platform-includes/performance/automatic-instrumentation-custom-routing/javascript.mdx @@ -19,7 +19,7 @@ const client = Sentry.init({ let pageLoadSpan = Sentry.startBrowserTracingPageLoadSpan(client, { name: window.location.pathname, attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", + "sentry.segment.name.source": "url", }, }); @@ -29,14 +29,14 @@ myRouter.on("routeChange", (route) => { // After that, each route change should trigger a navigation span (which will automatically finish the previous one) if (pageLoadSpan) { pageLoadSpan.updateName(route.name); - pageLoadSpan.setAttribute(Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "route"); + pageLoadSpan.setAttribute("sentry.segment.name.source", "route"); pageLoadSpan = undefined; } else { Sentry.startBrowserTracingNavigationSpan(client, { op: "navigation", name: route.name, // or what the name of the span should be attributes: { - [Sentry.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route", + "sentry.segment.name.source": "route", }, }); }