Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set UserAgent for ARM telemetry #428

Merged
merged 3 commits into from
Aug 23, 2024
Merged

Set UserAgent for ARM telemetry #428

merged 3 commits into from
Aug 23, 2024

Conversation

YanaXu
Copy link
Contributor

@YanaXu YanaXu commented Aug 19, 2024

This PR is to set UserAgent for ARM request in case of SDK-based cmdlets.
And it fixes the bug of dumplicated CommandName and ParameterSetName.

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

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

Approve with minor comments

AzureSession.Instance.ClientFactory.AddUserAgent(hostEnv);
}
}
catch (Exception)
Copy link
Member

Choose a reason for hiding this comment

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

If we are try-catch AddUserAgent(), does it make sense to wrap all AddUserAgent() calls in it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we are try-catch AddUserAgent(), does it make sense to wrap all AddUserAgent() calls in it?

Here is AzureSession.Instance.ClientFactory.AddUserAgent(hostEnv);. Below is ClientFactory.RemoveUserAgent(hostEnv);. The Client part is UserAgent += string.Format(" {0}", hostEnv); I can't merge them together.

AzureSession.Instance.ClientFactory.RemoveUserAgent(hostEnv);
}
}
catch (Exception)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I add a catch here just in case the env var is not OK for setting UserAgent, we'll ignore it.

@YanaXu YanaXu merged commit 644538a into main Aug 23, 2024
2 checks passed
@YanaXu YanaXu deleted the yanxu/useragent branch August 23, 2024 03:05
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.

3 participants