Skip to content
Draft
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
6 changes: 3 additions & 3 deletions docs/platforms/javascript/common/agent-tracing/mastra.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ The Sentry exporter captures comprehensive trace data following OpenTelemetry se
#### Model Generation Spans

- `gen_ai.operation.name`: Operation name (e.g., `chat`)
- `gen_ai.system`: Model provider (e.g., OpenAI, Anthropic)
- `gen_ai.provider.name`: Model provider (e.g., OpenAI, Anthropic)
- `gen_ai.request.model`: Model identifier
- `gen_ai.request.messages`: Input messages/prompts (JSON)
- `gen_ai.response.model`: Response model
Expand All @@ -158,8 +158,8 @@ The Sentry exporter captures comprehensive trace data following OpenTelemetry se
- `gen_ai.tool.name`: Tool identifier
- `gen_ai.tool.type`: `function`
- `gen_ai.tool.call.id`: Tool call ID
- `gen_ai.tool.input`: Tool input parameters
- `gen_ai.tool.output`: Tool output result
- `gen_ai.tool.call.arguments`: Tool input parameters
- `gen_ai.tool.call.result`: Tool output result
- `tool.success`: Success flag

#### Agent Run Spans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.SENTRY_SEGMENT_NAME_SOURCE]: "url",
},
});

Expand All @@ -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.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.SENTRY_SEGMENT_NAME_SOURCE]: "route",
},
});
}
Expand Down
Loading