Skip to content

Commit af9b4bb

Browse files
msonnbclaude
andcommitted
ref(fastify): Set hook op via sentry.op attribute only
The shared fastify hook wrapper set its op through the `op:` shorthand; it now sets `sentry.op` in attributes instead, matching koa/hono/ tanstackstart. The op is only added when defined so route-hooks (which carry no op) stay unchanged; instance hooks keep `middleware` and the handler hook keeps `request_handler.fastify`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent efd5e6e commit af9b4bb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎packages/server-utils/src/integrations/tracing-channel/fastify/instrumentation.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
/* eslint-disable max-lines */
1616

1717
import * as diagnosticsChannel from 'node:diagnostics_channel';
18-
import { HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, HTTP_ROUTE, URL_PATH } from '@sentry/conventions/attributes';
18+
import {
19+
HTTP_REQUEST_METHOD,
20+
HTTP_RESPONSE_STATUS_CODE,
21+
HTTP_ROUTE,
22+
SENTRY_OP,
23+
URL_PATH,
24+
} from '@sentry/conventions/attributes';
1925
import { WEB_SERVER_MIDDLEWARE_SPAN_OP } from '@sentry/conventions/op';
2026
import type { Span } from '@sentry/core';
2127
import {
@@ -345,9 +351,9 @@ function handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record
345351
return startSpan(
346352
{
347353
name,
348-
op,
349354
attributes: {
350355
...spanAttributes,
356+
...(op ? { [SENTRY_OP]: op } : {}),
351357
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
352358
},
353359
parentSpan,

0 commit comments

Comments
 (0)