Skip to content

Request activity#41013

Merged
bambriz merged 10 commits intoAzure:mainfrom
bambriz:request-activity-id
May 28, 2025
Merged

Request activity#41013
bambriz merged 10 commits intoAzure:mainfrom
bambriz:request-activity-id

Conversation

@bambriz
Copy link
Copy Markdown
Member

@bambriz bambriz commented May 9, 2025

Description

Adds Client Generated Activity ID to each request. Also adds Activity ID to log record in diagnostics.

Copilot AI review requested due to automatic review settings May 9, 2025 21:10
@bambriz bambriz requested a review from a team as a code owner May 9, 2025 21:10
@github-actions github-actions Bot added the Cosmos label May 9, 2025
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 adds client-generated Activity IDs to each request, making diagnostics easier by associating a unique ID with every request and response.

  • Updated the HTTP logging policy to log the Activity ID.
  • Modified header generation in the base module to include the Activity ID.
  • Updated the CHANGELOG to document the new functionality.

Reviewed Changes

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

File Description
sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_http_logging_policy.py Added logging of the Activity ID in both the structured logger and the built log string.
sdk/cosmos/azure-cosmos/azure/cosmos/_base.py Added a header for the Activity ID using a generated GUID.
sdk/cosmos/azure-cosmos/CHANGELOG.md Updated changelog to note the Activity ID change.

Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_http_logging_policy.py
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_http_logging_policy.py
@azure-sdk
Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

Copy link
Copy Markdown
Member

@simorenoh simorenoh left a comment

Choose a reason for hiding this comment

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

now that we can track the activity id, let's please add tests verifying that it is being sent from the SDK now - should be able to use the raw_response_hook to verify the request sent

Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_http_logging_policy.py
Copy link
Copy Markdown
Member

@tvaron3 tvaron3 left a comment

Choose a reason for hiding this comment

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

LGTM besides one small comment. THanks Bryan

Copy link
Copy Markdown
Contributor

@allenkim0129 allenkim0129 left a comment

Choose a reason for hiding this comment

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

LGTM

bambriz added 3 commits May 16, 2025 13:10
Added tests to verify Activity id is generated client side. Proof of client generated activity id can be seen from seeing it in the request headers.
Copy link
Copy Markdown
Member

@tvaron3 tvaron3 left a comment

Choose a reason for hiding this comment

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

LGTM

@bambriz bambriz merged commit 91b5017 into Azure:main May 28, 2025
17 checks passed
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.

6 participants