Skip to content

feat: propagate traceparent to all NAPI async entry points#49

Open
sinianluoye wants to merge 1 commit intomainfrom
fix/propagate-traceparent-to-all-napi-entry-points
Open

feat: propagate traceparent to all NAPI async entry points#49
sinianluoye wants to merge 1 commit intomainfrom
fix/propagate-traceparent-to-all-napi-entry-points

Conversation

@sinianluoye
Copy link
Copy Markdown
Collaborator

📝 Description

Propagate traceparent to all remaining async NAPI entry points that perform I/O, so Rust-side tracing spans share the same traceId as the calling TypeScript code. Previously only query.execute, table.add, table.update, table.delete, table.countRows, table.createIndex, and table.optimize received a traceparent — all other async functions produced orphaned traces.

Rust changes

  • connection.rs: Added traceparent: Option<String> + napi_span! + .instrument(span) to 7 functions: table_names, create_table, create_empty_table, open_table, clone_table, drop_table, drop_all_tables
  • iterator.rs: Store traceparent field in RecordBatchIterator, use in next() with napi_span! + .instrument(span)
  • query.rs: Pass traceparent to RecordBatchIterator::new() in all 3 execute() methods (Query, VectorQuery, TakeQuery)
  • merge.rs: Added traceparent to execute() + napi_span! + .instrument(span)

TypeScript changes

  • connection.ts: Import getTraceparent, pass await getTraceparent() to all 7 NAPI calls
  • merge.ts: Import getTraceparent, pass await getTraceparent() to execute()

Verification

  • cargo check passes (both with and without profiling-otlp feature)
  • tsc --noEmit passes
  • All 504 existing tests pass (12/12 test suites)

✅ Checklist

  • My PR title follows the type(scope): description format (lowercase).
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.

🤖 Generated with Claude Code

Add traceparent: Option<String> parameter to all remaining async NAPI
entry points that perform I/O, so Rust-side spans share the same
traceId as the calling TypeScript code.

Rust changes:
- connection.rs: 7 functions (table_names, create_table, create_empty_table,
  open_table, clone_table, drop_table, drop_all_tables)
- iterator.rs: store traceparent in RecordBatchIterator, use in next()
- query.rs: pass traceparent to RecordBatchIterator::new() (3 sites)
- merge.rs: add traceparent to execute()

TypeScript changes:
- connection.ts: pass getTraceparent() to all 7 NAPI calls
- merge.ts: pass getTraceparent() to execute()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sinianluoye sinianluoye requested a review from a team April 13, 2026 13:33
@github-actions github-actions bot added the enhancement New feature or request label Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant