Skip to content

Conversation

@jwtty
Copy link
Contributor

@jwtty jwtty commented Nov 18, 2025

Description of your changes

Set headers for tenantID and clientRequestID in attributeBasedVMSizeRecommender client

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Tested in standalone with a test client: 88caa9

fleet-hub-agent deployment is updated with environment vars:

- name: CAPACITY_ENDPOINT
  value: http://msi-connector.msi-connector.svc.cluster.local/compute
- name: AZURE_TENANT_ID
  value: 72f988bf-86f1-41af-91ab-2d7cd011db47

VMSize recommendation is successfully generated:

I1119 22:21:04.587280       1 hubagent/main.go:185] "Capacity client created successfully" endpoint="http://msi-connector.msi-connector.svc.cluster.local/compute" client={}
I1119 22:21:04.587506       1 hubagent/main.go:199] "Sending GenerateAttributeBasedRecommendations request" request="subscription_id:\"8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8\"  location:\"eastus2\"  regular_priority_profile:{target_capacity:4}  resource_properties:{vm_attributes:{allowed_vm_sizes:\"Standard_D2s_v3\"  allowed_vm_sizes:\"Standard_D4s_v3\"}}"
I1119 22:21:04.587582       1 compute/vmsizerecommenderclient.go:118] "Generating VM size recommendations" subscriptionID="8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8" location="eastus2" clientRequestID="f4543bef-b235-4b26-b9a0-bc30602d219e"
I1119 22:21:17.498671       1 compute/vmsizerecommenderclient.go:124] "Generated VM size recommendations" subscriptionID="8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8" location="eastus2" clientRequestID="f4543bef-b235-4b26-b9a0-bc30602d219e" latency=12911
I1119 22:21:17.498736       1 hubagent/main.go:204] "Received recommendations" response="recommended_vm_sizes:{regular_vm_sizes:{family:\"D\"  name:\"Standard_D2s_v3\"  size:\"D2s_v3\"}  regular_vm_sizes:{family:\"D\"  name:\"Standard_D4s_v3\"  size:\"D4s_v3\"}}"

clientRequestID is properly passed to compute-svc too:

{
  "clientRequestID": "951fa8db-88a7-4ed9-b463-d6ec470546dd",
  "env_epoch": "AONLD",
  "fileName": "pkg/compute/svc/vmsizerecommender_service.go",
  "level": "info",
  "lineNumber": 123,
  "msg": "Generating attribute-based VM size recommendations",
  "region": "eastus2",
  "resourceGroupName": "",
  "resourceName": "",
  "serviceBuild": "omitted",
  "source": "fleetcomputeconnectorcontextactivity",
  "spanID": "38b048fb9a8957cc",
  "subscriptionID": "8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8",
  "time": "2025-11-18T23:46:06Z",
  "traceID": "042f8c8ea378d0aaf4ce038cd179542b"
}
{
  "clientRequestID": "951fa8db-88a7-4ed9-b463-d6ec470546dd",
  "env_epoch": "AONLD",
  "fileName": "pkg/compute/svc/vmsizerecommender_service.go",
  "level": "info",
  "lineNumber": 144,
  "msg": "Successfully generated attribute-based VM size recommendations",
  "region": "eastus2",
  "resourceGroupName": "",
  "resourceName": "",
  "serviceBuild": "omitted",
  "source": "fleetcomputeconnectorcontextactivity",
  "spanID": "38b048fb9a8957cc",
  "subscriptionID": "8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8",
  "time": "2025-11-18T23:46:11Z",
  "traceID": "042f8c8ea378d0aaf4ce038cd179542b"
}

Special notes for your reviewer

Copy link
Contributor

@britaniar britaniar left a comment

Choose a reason for hiding this comment

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

LGTM

@jwtty jwtty merged commit a834313 into Azure:main Nov 20, 2025
22 of 24 checks passed
@jwtty jwtty deleted the headers branch November 20, 2025 07:05
serverAddress string,
httpClient *http.Client,
) (*AttributeBasedVMSizeRecommenderClient, error) {
tenantID := os.Getenv(tenantIDEnvVarName)
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, who set this env?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The env var will be set in the fleet-hub-agent chart.

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.

4 participants