Skip to content

Commit 883de76

Browse files
mydeaclaude
andauthored
ref(remix): Use @sentry/conventions (#21497)
Switches `@sentry/remix` to source span/attribute keys from `@sentry/conventions`, added as a regular runtime `dependency` and externalized at build time (resolved at runtime by the consumer's installed copy). No functional change — the attribute values are identical. Part of splitting the larger `@sentry/conventions` migration into per-package PRs. Ref: #20982 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a1a7026 commit 883de76

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

packages/remix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666
"dependencies": {
6767
"@opentelemetry/api": "^1.9.1",
6868
"@opentelemetry/instrumentation": "^0.214.0",
69-
"@opentelemetry/semantic-conventions": "^1.40.0",
7069
"@remix-run/router": "^1.23.3",
7170
"@sentry/cli": "^2.58.6",
71+
"@sentry/conventions": "^0.11.0",
7272
"@sentry/core": "10.58.0",
7373
"@sentry/node": "10.58.0",
7474
"@sentry/react": "10.58.0",

packages/remix/src/vendor/instrumentation.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
InstrumentationNodeModuleFile,
3333
isWrapped,
3434
} from '@opentelemetry/instrumentation';
35-
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
35+
import { CODE_FUNCTION, HTTP_METHOD, HTTP_ROUTE, HTTP_STATUS_CODE, HTTP_URL } from '@sentry/conventions/attributes';
3636
import type { Params } from '@remix-run/router';
3737
import type * as remixRunServerRuntime from '@remix-run/server-runtime';
3838
import type * as remixRunServerRuntimeData from '@remix-run/server-runtime/dist/data';
@@ -192,7 +192,7 @@ export class RemixInstrumentation extends InstrumentationBase {
192192

193193
const routePath = route?.path;
194194
if (span && routePath) {
195-
span.setAttribute(SemanticAttributes.HTTP_ROUTE, routePath);
195+
span.setAttribute(HTTP_ROUTE, routePath);
196196
span.updateName(`remix.request ${routePath}`);
197197
}
198198

@@ -220,7 +220,7 @@ export class RemixInstrumentation extends InstrumentationBase {
220220
const span = plugin.tracer.startSpan(
221221
'remix.request',
222222
{
223-
attributes: { [SemanticAttributes.CODE_FUNCTION]: 'requestHandler' },
223+
attributes: { [CODE_FUNCTION]: 'requestHandler' },
224224
},
225225
opentelemetry.context.active(),
226226
);
@@ -256,7 +256,7 @@ export class RemixInstrumentation extends InstrumentationBase {
256256

257257
const span = plugin.tracer.startSpan(
258258
`LOADER ${params.routeId}`,
259-
{ attributes: { [SemanticAttributes.CODE_FUNCTION]: 'loader' } },
259+
{ attributes: { [CODE_FUNCTION]: 'loader' } },
260260
opentelemetry.context.active(),
261261
);
262262

@@ -291,7 +291,7 @@ export class RemixInstrumentation extends InstrumentationBase {
291291
const clonedRequest = params.request.clone();
292292
const span = plugin.tracer.startSpan(
293293
`ACTION ${params.routeId}`,
294-
{ attributes: { [SemanticAttributes.CODE_FUNCTION]: 'action' } },
294+
{ attributes: { [CODE_FUNCTION]: 'action' } },
295295
opentelemetry.context.active(),
296296
);
297297

@@ -344,8 +344,8 @@ export class RemixInstrumentation extends InstrumentationBase {
344344

345345
const addRequestAttributesToSpan = (span: Span, request: Request): void => {
346346
span.setAttributes({
347-
[SemanticAttributes.HTTP_METHOD]: request.method,
348-
[SemanticAttributes.HTTP_URL]: request.url,
347+
[HTTP_METHOD]: request.method,
348+
[HTTP_URL]: request.url,
349349
});
350350
};
351351

@@ -362,7 +362,7 @@ const addMatchAttributesToSpan = (span: Span, match: { routeId: string; params:
362362
const addResponseAttributesToSpan = (span: Span, response: Response | null): void => {
363363
if (response) {
364364
span.setAttributes({
365-
[SemanticAttributes.HTTP_STATUS_CODE]: response.status,
365+
[HTTP_STATUS_CODE]: response.status,
366366
});
367367
}
368368
};

0 commit comments

Comments
 (0)