Skip to content

Commit fed28de

Browse files
mydeaclaude
andcommitted
ref(remix): Use @sentry/conventions
Source span/attribute keys from `@sentry/conventions` as a regular dependency (externalized at build time, resolved at runtime). No functional change. Maps the `@sentry/conventions/attributes` subpath in the shared TS config for the repo's `node` moduleResolution type builds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e408422 commit fed28de

3 files changed

Lines changed: 14 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
};

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7578,6 +7578,11 @@
75787578
"@sentry/cli-win32-i686" "2.58.6"
75797579
"@sentry/cli-win32-x64" "2.58.6"
75807580

7581+
"@sentry/conventions@^0.11.0":
7582+
version "0.11.0"
7583+
resolved "https://registry.yarnpkg.com/@sentry/conventions/-/conventions-0.11.0.tgz#5a324b8368dc5c141260bd8ccc684756ea3dd843"
7584+
integrity sha512-AQTAKeq9mDpOElDFSPymZTPZF/c50rk355mWTf5Y1ZxZJKKOBli5qTttskJyCxrE5ynNgN1KwcXoU5MRrMSRmQ==
7585+
75817586
"@sentry/node-cpu-profiler@^2.4.2":
75827587
version "2.4.2"
75837588
resolved "https://registry.yarnpkg.com/@sentry/node-cpu-profiler/-/node-cpu-profiler-2.4.2.tgz#d0ba01370545297d015df1497daf7f81e27f2ab5"

0 commit comments

Comments
 (0)