Skip to content

Added User Agent Suffix - #40904

Merged
Andrew Mathew (andrewmathew1) merged 10 commits into
Azure:mainfrom
andrewmathew1:users/andrewmathew1/useragentsuffix
May 27, 2025
Merged

Andrew Mathew (andrewmathew1) merged 10 commits into
Azure:mainfrom
andrewmathew1:users/andrewmathew1/useragentsuffix

Conversation

@andrewmathew1

Copy link
Copy Markdown
Contributor

Description

Added User Agent Suffix keyword argument to the client. Allowing users to pass in their user agent suffix to either the sync or async client.

Copilot AI review requested due to automatic review settings May 6, 2025 00:14
@andrewmathew1
Andrew Mathew (andrewmathew1) requested a review from a team as a code owner May 6, 2025 00:14
@github-actions github-actions Bot added the Cosmos label May 6, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 support for a user agent suffix in both the synchronous and asynchronous Cosmos client implementations, allowing users to customize the user agent string. The key changes include:

  • Introducing an optional user_agent_suffix keyword argument in the client constructors.
  • Updating the internal functions in _utils.py to append the suffix when provided.
  • Adding tests to verify that the user agent strings for both sync and async clients incorporate the specified suffixes.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
sdk/cosmos/azure-cosmos/tests/test_client_user_agent.py Added tests for validating correct user agent suffix behavior.
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client_connection_async.py Modified async connection to use user_agent_suffix through kwargs.
sdk/cosmos/azure-cosmos/azure/cosmos/_utils.py Updated get_user_agent and get_user_agent_async to append suffix.
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py Modified sync connection to use user_agent_suffix through kwargs.

@andrewmathew1
Andrew Mathew (andrewmathew1) force-pushed the users/andrewmathew1/useragentsuffix branch from 3be2283 to 42467c7 Compare May 7, 2025 00:28
@azure-sdk

Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

@tvaron3 Tomas Varon (tvaron3) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changelog but not blocking

@andrewmathew1
Andrew Mathew (andrewmathew1) merged commit e459f14 into Azure:main May 27, 2025
@andrewmathew1
Andrew Mathew (andrewmathew1) deleted the users/andrewmathew1/useragentsuffix branch May 27, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants