Skip to content

Ability to pass additional info to sdk header#783

Merged
vgvoleg merged 1 commit intomainfrom
additional_sdk_info
Mar 18, 2026
Merged

Ability to pass additional info to sdk header#783
vgvoleg merged 1 commit intomainfrom
additional_sdk_info

Conversation

@vgvoleg
Copy link
Collaborator

@vgvoleg vgvoleg commented Mar 18, 2026

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Fixes: #784

What is the new behavior?

Other information

@vgvoleg vgvoleg requested a review from Copilot March 18, 2026 12:59
@vgvoleg vgvoleg force-pushed the additional_sdk_info branch 2 times, most recently from 9f7607d to a420baa Compare March 18, 2026 13:09
Copy link

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 extends the SDK build-info gRPC metadata header to optionally include additional client/library identifiers, allowing callers to append extra “sdk-like” segments to the x-ydb-sdk-build-info value.

Changes:

  • Add additional_sdk_headers to DriverConfig and propagate it into request metadata construction (sync + aio).
  • Update _utilities.x_ydb_sdk_build_info_header to append additional entries to the header value.
  • Add unit tests covering the new header formatting behavior.

Reviewed changes

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

Show a summary per file
File Description
ydb/driver.py Adds additional_sdk_headers field to driver configuration.
ydb/connection.py Passes additional_sdk_headers into SDK build-info header for sync metadata.
ydb/aio/connection.py Passes additional_sdk_headers into SDK build-info header for async metadata.
ydb/_utilities.py Extends SDK build-info header builder to join additional segments.
ydb/_utilities_test.py Adds tests for header formatting with 0/1/N additional segments.
Comments suppressed due to low confidence (1)

ydb/driver.py:162

  • additional_sdk_headers was added to DriverConfig.__init__, but it is not described in the constructor docstring alongside the other parameters. Please document what format is expected (e.g., ("lib/1.2.3", ...)) and how it affects the x-ydb-sdk-build-info header.
        """
        A driver config to initialize a driver instance

        :param endpoint: A endpoint specified in pattern host:port to be used for initial channel initialization and for YDB endpoint discovery mechanism
        :param database: A name of the database
        :param ca_cert: A CA certificate when SSL should be used
        :param auth_token: A authentication token
        :param credentials: An instance of AbstractCredentials
        :param use_all_nodes: A balancing policy that forces to use all available nodes.
        :param root_certificates: The PEM-encoded root certificates as a byte string.
        :param private_key: The PEM-encoded private key as a byte string, or None if no\
        private key should be used.
        :param certificate_chain: The PEM-encoded certificate chain as a byte string\
        to use or or None if no certificate chain should be used.
        :param grpc_keep_alive_timeout: GRpc KeepAlive timeout, ms
        :param ydb.Tracer tracer: ydb.Tracer instance to trace requests in driver.\
        If tracing aio ScopeManager must be ContextVarsScopeManager
        :param grpc_lb_policy_name: A load balancing policy to be used for discovery channel construction. Default value is `round_round`
        :param discovery_request_timeout: A default timeout to complete the discovery. The default value is 10 seconds.
        :param disable_discovery: If True, endpoint discovery is disabled and only the start endpoint is used for all requests.

        """

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

@vgvoleg vgvoleg force-pushed the additional_sdk_info branch 2 times, most recently from ec6f6d3 to cc3dd41 Compare March 18, 2026 16:04
@vgvoleg vgvoleg requested a review from Copilot March 18, 2026 16:40
Copy link

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

Adds support for SDK integrations (e.g., DBAPI/SQLAlchemy) to append additional build-info fragments into the x-ydb-sdk-build-info request metadata header.

Changes:

  • Extends DriverConfig to carry _additional_sdk_headers for integration-specific header fragments.
  • Updates sync/async connection metadata construction to include these additional fragments.
  • Updates _utilities.x_ydb_sdk_build_info_header and adds unit tests for the new formatting behavior.

Reviewed changes

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

Show a summary per file
File Description
ydb/driver.py Stores integration-provided additional SDK header fragments on DriverConfig.
ydb/connection.py Passes additional fragments into the build-info header during metadata construction (sync).
ydb/aio/connection.py Passes additional fragments into the build-info header during metadata construction (async).
ydb/_utilities.py Changes header builder to concatenate base SDK info + optional additional fragments.
ydb/_utilities_test.py Adds tests validating formatting with 0/1/N additional fragments.

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

@@ -135,6 +136,7 @@ def __init__(
discovery_request_timeout: int = 10,
compression: Optional[grpc.Compression] = None,
disable_discovery: bool = False,
self.discovery_request_timeout = discovery_request_timeout
self.compression = compression
self.disable_discovery = disable_discovery
self._additional_sdk_headers = _additional_sdk_headers
@vgvoleg vgvoleg force-pushed the additional_sdk_info branch from cc3dd41 to ba19c54 Compare March 18, 2026 16:46
@vgvoleg vgvoleg merged commit acbee60 into main Mar 18, 2026
33 of 34 checks passed
@vgvoleg vgvoleg deleted the additional_sdk_info branch March 18, 2026 16:56
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.

feature: ability to extend x-ydb-sdk-build-info header

2 participants