Azure Quantum client: Add environment variable to set User-Agent prefix (#805)

* Add environment variable to set User-Agent prefix

* Reuse QuantumJobClientOptions to pass the user-agent prefix
This commit is contained in:
XField 2021-08-25 06:54:49 -07:00 коммит произвёл GitHub
Родитель 7bf27f0b3b
Коммит 85190d2bec
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -196,7 +196,7 @@ Tests will be marked as Inconclusive if the pre-reqs are not correctly setup.";
} }
var options = new QuantumJobClientOptions(); var options = new QuantumJobClientOptions();
options.Diagnostics.ApplicationId = "ClientTests"; options.Diagnostics.ApplicationId = Environment.GetEnvironmentVariable("AZURE_QUANTUM_NET_APPID") ?? "ClientTests";
var credential = Authentication.CredentialFactory.CreateCredential(Authentication.CredentialType.Default); var credential = Authentication.CredentialFactory.CreateCredential(Authentication.CredentialType.Default);

Просмотреть файл

@ -51,6 +51,8 @@ namespace Microsoft.Azure.Quantum
// Optional parameters: // Optional parameters:
credential ??= CredentialFactory.CreateCredential(CredentialType.Default, subscriptionId); credential ??= CredentialFactory.CreateCredential(CredentialType.Default, subscriptionId);
options ??= new QuantumJobClientOptions(); options ??= new QuantumJobClientOptions();
options.Diagnostics.ApplicationId = options.Diagnostics.ApplicationId
?? Environment.GetEnvironmentVariable("AZURE_QUANTUM_NET_APPID");
this.ResourceGroupName = resourceGroupName; this.ResourceGroupName = resourceGroupName;
this.WorkspaceName = workspaceName; this.WorkspaceName = workspaceName;