Skip to content

Update span attributes to use @sentry/conventions #18895

Description

@Lms24

Description

For the next Major SDK version, we should stop sending attributes we deprecated in our conventions and (if not done already) replace them with their stable replacements.

Overall, we should likely move to our @sentry/conventions package generally and unify usage there. We need to make sure that we do not remove anything users may heavily rely on (or that this is backfilled or similar, …)

Locations marked (reads) only consume the deprecated attribute for back-compat and can likely stay (or be dropped last); everything else actively sets it.


AI Attributes (ai.*)

Deprecated Attribute Replacement Files (Source Code)
ai.pipeline.name gen_ai.pipeline.name server-utils/src/ai/vercel-ai/index.ts (L424, raw string)
ai.streaming gen_ai.response.streaming server-utils/src/ai/vercel-ai/index.ts (L437, raw string)

packages/server-utils/src/ai/langgraph/index.ts already uses GEN_AI_PIPELINE_NAME — Vercel AI is the only holdout.


Code Attributes (code.*)

Deprecated Attribute Replacement Files (Source Code)
code.filepath code.file.path browser-utils/src/performance/entries.ts (L143, raw string)
code.function code.function.name browser-utils/src/performance/entries.ts (L146, raw string)

Note: as of @sentry/conventions@0.19.0, code.function is not yet flagged @deprecated (it and code.function.name are listed as aliases), but it will be deprecated in favor of code.function.name — so migrate it along with code.filepath. The packages/remix/src/server/integrations/opentelemetry.ts occurrence from the original audit is gone with the file.


Database Attributes (db.*)

Almost all of these moved into packages/server-utils/src/ when the OTel DB instrumentations were vendored. They are set via the deprecated @sentry/conventions constants (DB_SYSTEM, DB_STATEMENT, …) or via local ATTR_DB_* string constants.

Deprecated Attribute Replacement Files (Source Code)
db.name db.namespace server-utils/src/integrations/aws-sdk/services/dynamodb.ts, server-utils/src/integrations/knex.ts, server-utils/src/integrations/mongodb/mongodb-span.ts, server-utils/src/integrations/mysql.ts, server-utils/src/integrations/mysql2.ts, server-utils/src/integrations/postgres.ts, server-utils/src/integrations/tedious.ts, server-utils/src/mongoose/mongoose-legacy-span.ts
db.operation db.operation.name core/src/integrations/supabase.ts (L280, L440, raw strings), server-utils/src/integrations/aws-sdk/services/dynamodb.ts, server-utils/src/integrations/knex.ts, server-utils/src/integrations/mongodb/mongodb-span.ts, server-utils/src/mongoose/mongoose-legacy-span.ts
db.statement db.query.text server-utils/src/integrations/ioredis.ts, server-utils/src/integrations/knex.ts, server-utils/src/integrations/mongodb/mongodb-span.ts, server-utils/src/integrations/mysql.ts, server-utils/src/integrations/mysql2.ts, server-utils/src/integrations/postgres.ts, server-utils/src/integrations/redis.ts, server-utils/src/integrations/tedious.ts, server-utils/src/prisma/tracing-helper.ts (reads)
db.system db.system.name core/src/integrations/supabase.ts (L279, L439, raw strings), server-utils/src/integrations/aws-sdk/services/dynamodb.ts, server-utils/src/integrations/ioredis.ts, server-utils/src/integrations/knex.ts, server-utils/src/integrations/mongodb/mongodb-span.ts, server-utils/src/integrations/mysql.ts, server-utils/src/integrations/mysql2.ts, server-utils/src/integrations/postgres.ts, server-utils/src/integrations/redis.ts, server-utils/src/integrations/tedious.ts, server-utils/src/mongoose/mongoose-legacy-span.ts, server-utils/src/prisma/tracing-helper.ts (backfill)
db.mongodb.collection (newly deprecated) db.collection.name server-utils/src/integrations/mongodb/mongodb-span.ts, server-utils/src/mongoose/mongoose-legacy-span.ts

packages/server-utils/src/integrations/ioredis.ts and redis.ts already carry TODO(v11) comments for exactly this migration.

Note: db.user, db.connection_string and db.sql.table are not deprecated in @sentry/conventions@0.19.0 — no action needed there.


HTTP Attributes (http.*)

The old node-core HTTP integration is gone. Server-side HTTP attributes now live in packages/core/src/integrations/http/ and packages/node/src/integrations/http/httpServerSpansIntegration.ts (the latter sets them deliberately, guarded by eslint-disable typescript/no-deprecated, for compatibility with what @opentelemetry/instrumentation-http used to emit).

Deprecated Attribute Replacement Files (Source Code)
http.client_ip client.address core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
http.flavor network.protocol.version core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
http.host server.address core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
http.method http.request.method Sets: browser/src/tracing/request.ts, browser/src/integrations/fetchStreamPerformance.ts, core/src/fetch.ts, core/src/integrations/http/add-outgoing-request-breadcrumb.ts, core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, core/src/types/request.ts (type), nestjs/src/integrations/wrap-route.ts, node/src/integrations/http/httpServerSpansIntegration.ts, node/src/utils/outgoingFetchRequest.ts, react-router/src/server/createServerInstrumentation.ts, remix/src/server/integrations/tracing-channel.ts, server-utils/src/integrations/hapi-utils.ts, sveltekit/src/server-common/handle.ts, sveltekit/src/server-common/load.ts. Reads: browser/src/integrations/graphqlClient.ts, nextjs/src/common/utils/getNormalizedRequestFromAttributes.ts, nextjs/src/edge/enhanceRunHandlerRootSpan.ts, nextjs/src/server/enhanceHandleRequestRootSpan.ts, nextjs/src/server/handleOnSpanStart.ts, server-utils/src/utils/setHttpServerSpanRouteAttribute.ts
http.response_content_length http.response.body.size browser-utils/src/performance/entries.ts, core/src/fetch.ts, core/src/integrations/http/get-outgoing-span-data.ts
http.response_transfer_size http.response.size browser-utils/src/performance/entries.ts
http.scheme url.scheme core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
http.status_code http.response.status_code Sets: core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts, remix/src/server/integrations/tracing-channel.ts, server-utils/src/integrations/aws-sdk/index.ts. Reads: nextjs/src/common/utils/backfillHttpResponseStatusCode.ts, nextjs/src/common/utils/backfillHttpServerStatus.ts
http.target url.path Sets: core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts. Reads / filters: nextjs/src/common/utils/dropMiddlewareTunnelRequests.ts, nextjs/src/common/utils/getNormalizedRequestFromAttributes.ts, nextjs/src/common/utils/setUrlProcessingMetadata.ts, nextjs/src/server/enhanceHandleRequestRootSpan.ts, nextjs/src/server/index.ts, react-router/src/server/integration/lowQualityTransactionsFilterIntegration.ts, solidstart/src/server/withServerActionInstrumentation.ts, tanstackstart-react/src/server/tunnelRoute.ts
http.user_agent user_agent.original core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts

Network Attributes (net.*)

Deprecated Attribute Replacement Files (Source Code)
net.host.ip network.local.address core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
net.host.name server.address core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
net.host.port server.port core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
net.peer.ip network.peer.address core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts
net.peer.name server.address core/src/integrations/http/get-outgoing-span-data.ts, node/src/integrations/tracing/redis/cache.ts (reads), server-utils/src/integrations/amqplib.ts, server-utils/src/integrations/ioredis.ts, server-utils/src/integrations/knex.ts, server-utils/src/integrations/mongodb/mongodb-span.ts, server-utils/src/integrations/mysql.ts, server-utils/src/integrations/mysql2.ts, server-utils/src/integrations/postgres.ts, server-utils/src/integrations/redis.ts, server-utils/src/integrations/tedious.ts, server-utils/src/mongoose/mongoose-legacy-span.ts
net.peer.port server.port same set as net.peer.name, plus core/src/integrations/http/server-subscription.ts and node/src/integrations/http/httpServerSpansIntegration.ts
net.transport network.transport core/src/integrations/http/get-outgoing-span-data.ts, core/src/integrations/http/server-subscription.ts, node/src/integrations/http/httpServerSpansIntegration.ts, server-utils/src/integrations/knex.ts

GenAI Attributes (gen_ai.*)

All AI instrumentation moved to packages/server-utils/src/ai/ and grew from 2 providers to 7+. These are set via the deprecated constants from @sentry/conventions/attributes.

Deprecated Attribute Replacement Files (Source Code)
gen_ai.prompt gen_ai.input.messages server-utils/src/ai/anthropic-ai/index.ts
gen_ai.response.text gen_ai.output.messages server-utils/src/ai/anthropic-ai/index.ts, server-utils/src/ai/core/utils.ts, server-utils/src/ai/google-genai/index.ts, server-utils/src/ai/langchain/utils.ts, server-utils/src/ai/langgraph/utils.ts, server-utils/src/ai/openai/utils.ts, server-utils/src/ai/workers-ai/utils.ts
gen_ai.response.tool_calls gen_ai.output.messages same set as gen_ai.response.text

Caveat documented in server-utils/src/ai/workers-ai/utils.ts: Relay migrates gen_ai.response.text into gen_ai.output.messages, but not the tool-calls half — so dropping gen_ai.response.tool_calls needs product-side coordination before it can be removed.


Other Deprecated Attributes

Deprecated Attribute Replacement Files (Source Code)
fs_error error.type node/src/integrations/fs/vendored/instrumentation.ts (L313)

Already resolved since the original audit

These rows from the original audit no longer apply and were removed:

  • ai.model.provider — no longer emitted; Vercel AI now sets gen_ai.provider.name plus the non-deprecated vercel.ai.model.provider. server-utils/src/ai/vercel-ai/index.ts even renames incoming gen_ai.systemgen_ai.provider.name.
  • http.url — zero occurrences left in packages/*/src; fully migrated to url.full.
  • gen_ai.request.messages / gen_ai.request.available_tools — zero occurrences left; migrated to gen_ai.input.messages / gen_ai.tool.definitions.
  • profile_id — migrated to sentry.profile_id (core/src/semanticAttributes.ts, core/src/tracing/spans/scopeContextAttributes.ts). Remaining profile_id hits are event/context payload fields, not span attributes.
  • replay_id — the span-attribute case is sentry.replay_id (replay-internal/src/integration.ts, browser-utils/src/web-vitals/spans.ts, core/src/logs/internal.ts, core/src/metrics/internal.ts). Remaining replay_id hits are DSC / feedback-context fields and doc comments, not span attributes.
  • The entire "OpenTelemetry Semantic Convention Constants Used (Deprecated)" section@opentelemetry/semantic-conventions and all SEMATTRS_* constants have been removed from the repo (zero hits in packages/ and dev-packages/). Everything now goes through @sentry/conventions/attributes.

Test fixtures

Beyond source, deprecated attributes are asserted on in integration test fixtures across dev-packages/node-integration-tests/suites/{tracing,express,aws-serverless}, dev-packages/deno-integration-tests/suites/orchestrion-* (mongo, mongoose, mysql, mysql2, postgres, tedious), dev-packages/browser-integration-tests/suites/{tracing,integrations}, dev-packages/bun-integration-tests/suites/fetch and dev-packages/cloudflare-integration-tests/suites/vite-autoinstrument. These will need updating alongside each source change.

Metadata

Metadata

Assignees

Projects

Status
No status

Relationships

None yet

Development

No branches or pull requests

Issue actions