feat(nuxt): Emit low cardinality db span names - #23605
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8524d24. Configure here.
size-limit report 📦
|
8524d24 to
333e1e3
Compare
333e1e3 to
3a46f48
Compare
There was a problem hiding this comment.
this file has span name adjustments (besides the span streaming conversion)
There was a problem hiding this comment.
this file has span name adjustments (besides the span streaming conversion)
5ae518d to
311f1d2
Compare
| const clientSpansPromise = collectStreamedSpans('nuxt-3', spans => { | ||
| return ( | ||
| spans.some(span => span.name === '/test-param/user/:userId()' && span.is_segment) && | ||
| spans.some(span => span.name === `GET /api/user/${PARAM}` && getSpanOp(span) === 'http.client') |
There was a problem hiding this comment.
heads up that some span.names are not low cardinality here (all with ${PARAM}, but not sure if this is part of this PR as the PR is just about db spans
There was a problem hiding this comment.
I think this should be addressed with #23682 since these are http.client spans. Will rebase and check if CI still passes
With span streaming, `db0` query spans are named after their `db.query.summary` (`SELECT users`) instead of the full SQL statement, and report that summary as a new `db.query.summary` attribute. The statement is sanitized before it is summarized, so a string literal containing `from`/`join` cannot leak a value into the name. db0 reports no db system, so a statement that cannot be summarized falls back to `db.namespace` and then to the static `Database operation`. `traceLifecycle: 'static'` keeps the existing names. Refs #23523 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
311f1d2 to
c49da01
Compare

With span streaming enabled:
db0query spans are named afterdb.query.summarySELECT * FROM users WHERE id = ?becomesSELECT usersdb.namespace, then toDatabase operationdb.query.summaryattribute, set in both trace lifecyclestraceLifecycle: 'static'keeps the existing namesI converted the
nuxt-3e2e test app to span streaming since there were no other tests testing database instrumentation. This produced quite a few changes to the test app unrelated to span name changes. I audited all of them for correctness but would of course appreciate a 2nd pair of eyes. I did mark the two test files in this PR that actually test against the span name changes.Refs #23523