Skip to content

Commit 2b45c1a

Browse files
msonnbclaude
andauthored
ref(core)!: Replace deprecated code.* and fs_error span attributes (#23401)
- `code.filepath` -> `code.file.path` and `code.function` -> `code.function.name` on `ui.long_animation_frame` spans. - `fs_error` -> `error.type` on `file` spans. part of #18895 --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 2f60022 commit 2b45c1a

8 files changed

Lines changed: 23 additions & 18 deletions

File tree

  • dev-packages
    • browser-integration-tests/suites/tracing/browserTracingIntegration
      • long-animation-frame-enabled-streamed
      • long-animation-frame-enabled
      • long-tasks-and-animation-frame-enabled-streamed
      • long-tasks-and-animation-frame-enabled
    • node-integration-tests/suites/fs-instrumentation
  • docs/migration
  • packages

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled-streamed/test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sentryTest(
3838
name: 'Main UI thread blocked',
3939
parent_span_id: pageloadSpan.span_id,
4040
attributes: expect.objectContaining({
41-
'code.filepath': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
41+
'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
4242
'browser.script.source_char_position': expect.objectContaining({ value: 0 }),
4343
'browser.script.invoker': {
4444
type: 'string',
@@ -93,7 +93,7 @@ sentryTest('captures long animation frame span for event listener.', async ({ br
9393
attributes: expect.objectContaining({
9494
'browser.script.invoker': { type: 'string', value: 'BUTTON#clickme.onclick' },
9595
'browser.script.invoker_type': { type: 'string', value: 'event-listener' },
96-
'code.filepath': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
96+
'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
9797
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' },
9898
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
9999
}),

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ sentryTest(
4040
description: 'Main UI thread blocked',
4141
parent_span_id: eventData.contexts?.trace?.span_id,
4242
data: {
43-
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
43+
'code.file.path': 'https://sentry-test-site.example/path/to/script.js',
4444
'browser.script.source_char_position': 0,
4545
'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js',
4646
'browser.script.invoker_type': 'classic-script',
@@ -97,7 +97,7 @@ sentryTest(
9797
data: {
9898
'browser.script.invoker': 'BUTTON#clickme.onclick',
9999
'browser.script.invoker_type': 'event-listener',
100-
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
100+
'code.file.path': 'https://sentry-test-site.example/path/to/script.js',
101101
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long_animation_frame',
102102
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
103103
},

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled-streamed/test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ sentryTest(
4040
name: 'Main UI thread blocked',
4141
parent_span_id: pageloadSpan.span_id,
4242
attributes: expect.objectContaining({
43-
'code.filepath': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
43+
'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
4444
'browser.script.source_char_position': expect.objectContaining({ value: 0 }),
4545
'browser.script.invoker': {
4646
type: 'string',
@@ -95,7 +95,7 @@ sentryTest('captures long animation frame span for event listener.', async ({ br
9595
attributes: expect.objectContaining({
9696
'browser.script.invoker': { type: 'string', value: 'BUTTON#clickme.onclick' },
9797
'browser.script.invoker_type': { type: 'string', value: 'event-listener' },
98-
'code.filepath': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
98+
'code.file.path': { type: 'string', value: 'https://sentry-test-site.example/path/to/script.js' },
9999
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: { type: 'string', value: 'ui.long_animation_frame' },
100100
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: { type: 'string', value: 'auto.ui.browser.metrics' },
101101
}),

‎dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ sentryTest(
4242
description: 'Main UI thread blocked',
4343
parent_span_id: eventData.contexts?.trace?.span_id,
4444
data: {
45-
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
45+
'code.file.path': 'https://sentry-test-site.example/path/to/script.js',
4646
'browser.script.source_char_position': 0,
4747
'browser.script.invoker': 'https://sentry-test-site.example/path/to/script.js',
4848
'browser.script.invoker_type': 'classic-script',
@@ -99,7 +99,7 @@ sentryTest(
9999
data: {
100100
'browser.script.invoker': 'BUTTON#clickme.onclick',
101101
'browser.script.invoker_type': 'event-listener',
102-
'code.filepath': 'https://sentry-test-site.example/path/to/script.js',
102+
'code.file.path': 'https://sentry-test-site.example/path/to/script.js',
103103
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.long_animation_frame',
104104
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
105105
},

‎dev-packages/node-integration-tests/suites/fs-instrumentation/test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('fs instrumentation', () => {
2424
op: 'file',
2525
status: 'internal_error',
2626
data: {
27-
fs_error: expect.stringMatching('ENOENT: no such file or directory,'),
27+
'error.type': 'ENOENT',
2828
path_argument: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'),
2929
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file',
3030
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs',
@@ -335,7 +335,7 @@ describe('fs instrumentation', () => {
335335
description: 'fs.readFile',
336336
op: 'file',
337337
status: 'internal_error',
338-
// `path_argument` is recorded, but `fs_error` is NOT, since `recordErrorMessagesAsSpanAttributes` is off
338+
// `path_argument` is recorded, but `error.type` is NOT, since `recordErrorMessagesAsSpanAttributes` is off
339339
data: {
340340
path_argument: expect.stringMatching('/fixtures/some-file-that-doesnt-exist.txt'),
341341
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file',
@@ -372,9 +372,9 @@ describe('fs instrumentation', () => {
372372
description: 'fs.readFile',
373373
op: 'file',
374374
status: 'internal_error',
375-
// `fs_error` is recorded, but `path_argument` is NOT, since `recordFilePaths` is off
375+
// `error.type` is recorded, but `path_argument` is NOT, since `recordFilePaths` is off
376376
data: {
377-
fs_error: expect.stringMatching('ENOENT: no such file or directory,'),
377+
'error.type': 'ENOENT',
378378
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file',
379379
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs',
380380
},
@@ -399,7 +399,7 @@ describe('fs instrumentation', () => {
399399
description: 'fs.readFile',
400400
op: 'file',
401401
status: 'ok',
402-
// Neither `path_argument` nor `fs_error` are recorded
402+
// Neither `path_argument` nor `error.type` are recorded
403403
data: {
404404
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'file',
405405
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.file.fs',

‎docs/migration/v11-end-state.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ Affected SDKs: All SDKs.
539539
- The deprecated `gen_ai.tool.type` span attribute is no longer set on tool spans.
540540
- The `ai.pipeline.name` and `ai.streaming` span attributes on Vercel AI spans were renamed to `gen_ai.pipeline.name` and `gen_ai.response.streaming`.
541541
- The `gen_ai.prompt` span attribute is no longer set by the Anthropic integration. The legacy Completions API's `prompt` is now reported as a user message on `gen_ai.input.messages`, like every other request shape.
542+
- The `code.filepath` and `code.function` span attributes on `ui.long_animation_frame` spans were renamed to `code.file.path` and `code.function.name`.
543+
- The `fs_error` span attribute on `file` spans was replaced by `error.type`. The value changed from the full error message to just the syscall's error code instead (`ENOENT`).
542544
- Span attributes now use the shared `@sentry/conventions` package under the hood.
543545
544546
If you reference these attributes in custom instrumentation, `beforeSendSpan`, dashboards, or alerts, update them to the new names.

‎packages/browser-utils/src/performance/entries.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
spanToJSON,
1111
filterCollectedUrl,
1212
} from '@sentry/core';
13-
import { SENTRY_OP, URL_FULL } from '@sentry/conventions/attributes';
13+
import { CODE_FILE_PATH, CODE_FUNCTION_NAME, SENTRY_OP, URL_FULL } from '@sentry/conventions/attributes';
1414
import { BROWSER_BROWSER_PAINT_SPAN_OP } from '@sentry/conventions/op';
1515
import { htmlTreeAsString } from '../htmlTreeAsString';
1616
import {
@@ -140,10 +140,10 @@ export function startTrackingLongAnimationFrames(): void {
140140
attributes['browser.script.invoker'] = invoker;
141141
attributes['browser.script.invoker_type'] = invokerType;
142142
if (sourceURL) {
143-
attributes['code.filepath'] = sourceURL;
143+
attributes[CODE_FILE_PATH] = sourceURL;
144144
}
145145
if (sourceFunctionName) {
146-
attributes['code.function'] = sourceFunctionName;
146+
attributes[CODE_FUNCTION_NAME] = sourceFunctionName;
147147
}
148148
if (sourceCharPosition !== -1) {
149149
attributes['browser.script.source_char_position'] = sourceCharPosition;

‎packages/node/src/integrations/fs/vendored/instrumentation.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
* and the configurable `createHook`/`endHook`/`requireParentSpan` options were removed in favor of inlined,
1111
* Sentry-specific span attributes.
1212
* - Completely reworked to no longer reference OpenTelemetry.
13+
* - The upstream `fs_error` span attribute (the error message) was replaced with the conventions-backed
14+
* `error.type` (the syscall error code, e.g. `ENOENT`).
1315
*/
1416

17+
import { ERROR_TYPE } from '@sentry/conventions/attributes';
1518
import type { Span, SpanAttributes } from '@sentry/core';
1619
import {
1720
SEMANTIC_ATTRIBUTE_SENTRY_OP,
@@ -305,11 +308,11 @@ export function enableFsInstrumentation(config: FsInstrumentationConfig = {}): v
305308
}
306309

307310
/**
308-
* Sets the error status on the span and, if configured, records the error message as a span attribute.
311+
* Sets the error status on the span and, if configured, records the error type as a span attribute.
309312
*/
310313
function recordError(span: Span, error: unknown, config: FsInstrumentationConfig): void {
311314
span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });
312315
if (config.recordErrorMessagesAsSpanAttributes && error instanceof Error) {
313-
span.setAttribute('fs_error', error.message);
316+
span.setAttribute(ERROR_TYPE, (error as NodeJS.ErrnoException).code ?? error.name);
314317
}
315318
}

0 commit comments

Comments
 (0)