Skip to content

Structured logs, part 1#576

Merged
peter-leonov-ch merged 13 commits intomainfrom
structured_logs
Feb 25, 2026
Merged

Structured logs, part 1#576
peter-leonov-ch merged 13 commits intomainfrom
structured_logs

Conversation

@peter-leonov-ch
Copy link
Copy Markdown
Collaborator

@peter-leonov-ch peter-leonov-ch commented Feb 24, 2026

Summary

Before moving forward with OTEL, let's use as much from the current logging subsystem as possible.

  • provide as much context in args as possible
  • sort args keys to ease sorting raw logs
  • stick to low cardinality message allowing the end user to decide on the final format
  • provide solid examples in the changelog

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@peter-leonov-ch peter-leonov-ch marked this pull request as ready for review February 25, 2026 08:48
Copilot AI review requested due to automatic review settings February 25, 2026 08:48
Copy link
Copy Markdown
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 updates logging to be more “structured” by moving variable context into args (e.g., IDs and operation metadata) while keeping message relatively stable, and adjusts configuration/tests to match the updated logging setup.

Changes:

  • Enriches NodeBaseConnection logs with structured args fields such as connection_id, operation, request_id, and socket_id.
  • Refactors log ID variables to snake_case (request_id, socket_id) and removes some high-cardinality identifiers from log messages.
  • Updates LogWriter construction and related tests/config wiring to pass an explicit ClickHouseLogLevel.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/client-node/src/connection/node_base_connection.ts Adds more structured context to HTTP/socket lifecycle logs and reduces message cardinality.
packages/client-node/tests/utils/http_stubs.ts Updates test stubs to construct LogWriter with an explicit log level and set related params.
packages/client-node/tests/unit/node_default_logger.test.ts Updates tests to pass an explicit ClickHouseLogLevel to LogWriter.
packages/client-node/tests/unit/node_config.test.ts Updates config-related unit test to pass explicit ClickHouseLogLevel to LogWriter.
packages/client-node/tests/unit/node_client.test.ts Updates client unit test connection params to pass explicit ClickHouseLogLevel to LogWriter.
packages/client-node/tests/integration/node_exec.test.ts Updates integration test logger setup to pass explicit ClickHouseLogLevel to LogWriter.
packages/client-common/src/logger.ts Changes LogWriter constructor to require a log level argument.
packages/client-common/src/config.ts Normalizes default log_level computation and passes it to both log_level and LogWriter.

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

Copy link
Copy Markdown
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


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

@peter-leonov-ch peter-leonov-ch changed the title Structured logs Structured logs, part 1 Feb 25, 2026
@peter-leonov-ch peter-leonov-ch merged commit 761e29e into main Feb 25, 2026
48 checks passed
@peter-leonov-ch peter-leonov-ch deleted the structured_logs branch February 25, 2026 14:05
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