Skip to content

Add x-ms-client-request-id header, use azdext.Run - #7010

Merged
saanikaguptamicrosoft merged 2 commits into
Azure:mainfrom
saanikaguptamicrosoft:saanika/finetune-tracing
Mar 6, 2026
Merged

Add x-ms-client-request-id header, use azdext.Run#7010
saanikaguptamicrosoft merged 2 commits into
Azure:mainfrom
saanikaguptamicrosoft:saanika/finetune-tracing

Conversation

@saanikaguptamicrosoft

@saanikaguptamicrosoft saanikaguptamicrosoft commented Mar 5, 2026

Copy link
Copy Markdown
Member

Fixes #6993

Refer -> #6969

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

Updates the azure.ai.finetune extension to align with the newer azd extension entrypoint and to propagate a Microsoft request/correlation ID header on outbound Azure SDK requests for improved trace correlation.

Changes:

  • Switch extension entrypoint to azdext.Run(cmd.NewRootCommand()) (enables TRACEPARENT propagation, FORCE_COLOR handling, structured error reporting).
  • Add an azsdk policy to set an x-ms-*-request-id header on Azure SDK pipelines used by the extension.

Reviewed changes

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

File Description
cli/azd/extensions/azure.ai.finetune/main.go Replaces manual context + error printing with azdext.Run entrypoint.
cli/azd/extensions/azure.ai.finetune/internal/providers/factory/provider_factory.go Adds azsdk.NewMsClientRequestIdPolicy() to Azure SDK per-call policies.

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

@wbreza Wallace Breza (wbreza) 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.

Code Review - PR #7010

Overall Summary

Clean, focused PR that makes two well-understood changes to the azure.ai.finetune extension:

  1. Adds x-ms-client-request-id header via azsdk.NewMsClientRequestIdPolicy() to both SDK client creation sites
  2. Replaces manual cobra command setup with the standard azdext.Run() entrypoint pattern

No issues found. Net deletion of 14 lines by leveraging the framework.

What Looks Good

  • azdext.Run() migration correctly matches the standard extension entrypoint pattern (same as azure.ai.agents)
  • NewMsClientRequestIdPolicy() added consistently to both SDK client creation sites in provider_factory.go
  • Good code reduction by removing boilerplate

Minor Observations

  1. Sparse PR description - the body only says "Refer -> #6969". A one-liner summarizing the two changes would help reviewers.
  2. FORCE_COLOR handling removed - the init() function in main.go previously handled FORCE_COLOR=1. Presumably azdext.Run() handles this internally - worth confirming.
  3. CI is failing - not related to code quality, but worth investigating before merge.
Priority Count
Critical 0
High 0
Medium 0
Low 0
Total 0

Overall Assessment: Approve

@spboyer

Copy link
Copy Markdown
Member

This PR addresses #6993 — adding x-ms-client-request-id header and switching to azdext.Run for trace correlation in the finetune extension.

Fixes #6993

@wbreza Wallace Breza (wbreza) 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.

Re-review: Approve

The only change since my previous approval is the go.mod/go.sum dependency bump to an azd version (a633d43bb543) that includes NewMsClientRequestIdPolicy(). This resolves the earlier compilation concern. No code logic changes.

All CI checks passing. Looks good to merge! :shipit:

@saanikaguptamicrosoft
saanikaguptamicrosoft merged commit 0384fc8 into Azure:main Mar 6, 2026
19 checks passed
Copilot AI pushed a commit that referenced this pull request Mar 7, 2026
* Add x-ms-client-request-id header, use azdext.Run

* Update `github.com/azure/azure-dev/cli/azd`

---------

Co-authored-by: Jeffrey Chen <jeffreychen@microsoft.com>
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.

[Finetune Extension] Add x-ms-client-request-id header and use azdext.Run for trace correlation

5 participants