Skip to content

Conversation

@mshustov
Copy link
Member

@mshustov mshustov commented Jan 8, 2026

Summary

A short description of the changes with a link to an open issue.

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@mshustov mshustov requested a review from Copilot January 8, 2026 20:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds experimental tracing/logging instrumentation to the command execution flow to help diagnose stream handling and timing issues. The changes introduce detailed trace logging at key points during command execution and stream draining operations.

Key changes:

  • Enhanced drainStream function with optional logging parameters to trace stream drain lifecycle events
  • Added comprehensive logging throughout the command execution pipeline including timing metrics and stream state information
  • Modified parameter passing to ensure query_id is propagated consistently through the execution flow

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/client-node/src/connection/stream.ts Added logging to track stream drain operations including chunk counts, bytes received, and duration metrics
packages/client-node/src/connection/node_base_connection.ts Instrumented command execution flow with trace logging for timing, stream states, and error conditions; adjusted query_id handling
Comments suppressed due to low confidence (1)

packages/client-node/src/connection/stream.ts:99

  • The event name in removeListener should be 'close' not 'onClose'. This typo means the close event listener will never be properly removed, potentially causing a memory leak in long-running applications.
    function removeListeners() {
      stream.removeListener('data', dropData)
      stream.removeListener('end', onEnd)
      stream.removeListener('error', onError)
      stream.removeListener('onClose', onClose)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants