feat(node)!: Stop inferring name for spans - #22712
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 920920a. Configure here.
andreiborza
left a comment
There was a problem hiding this comment.
Could we add a bugbot rule to call out that we might need to re-set source after calling span.updateName?
Also, do we still need this function? 🤔
sentry-javascript/packages/core/src/utils/spanUtils.ts
Lines 460 to 482 in 9c8bc95
| const ATTR_DB_MONGODB_COLLECTION = 'db.mongodb.collection'; | ||
| const ATTR_DB_CONNECTION_STRING = 'db.connection_string'; | ||
| const ATTR_NET_PEER_NAME = 'net.peer.name'; | ||
| const ATTR_NET_PEER_PORT = 'net.peer.port'; | ||
| const DB_SYSTEM_VALUE_MONGODB = 'mongodb'; |
There was a problem hiding this comment.
q: Can we add these to sentry conventions?
There was a problem hiding this comment.
probably should revisit these generally, yes!
|
|
||
| const tediousSpan = parent.spans?.find(s => s.op === 'db'); | ||
| assertExists(tediousSpan, `expected a db child span, got ops: ${parent.spans?.map(s => s.op).join(', ')}`); | ||
| assertEquals(tediousSpan!.description, 'execSql mydb'); |
There was a problem hiding this comment.
l/m: IIRC descriptions should be low cardinality and be sanitized. So the output should be SELECT ? in this case.
There was a problem hiding this comment.
this is fine because 1 is static - this is just the content of DB_STATEMENT!
yes, good idea!
not really, we can probably deprecate this for the v11 cycle then. |
more fixes moar fixes fixxx
…22797) Stacked on top of #22712. With the span name/source inference reworked in #22712, core's `getDynamicSamplingContext` now derives the DSC transaction name from the root span and applies the `url` source guard itself. That makes the OpenTelemetry-specific `createDsc` handler `enhanceDscWithOpenTelemetryRootSpanName` redundant — it was only there to re-derive the name/source via `parseSpanDescription` before core did so natively. This removes the util along with its call sites in `@sentry/node`, `@sentry/vercel-edge`, and the opentelemetry test helper, and drops it from the package's public exports. Since the enhancer is a public export of `@sentry/opentelemetry`, its removal is technically breaking for anyone importing it directly — which is why this targets the breaking-change branch #22712. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Instead, we make sure to properly set the name directly whenever we start spans.