Migrate from Azure.Monitor.Query (deprecated) to Azure.Monitor.Query.Metrics#5147
Migrate from Azure.Monitor.Query (deprecated) to Azure.Monitor.Query.Metrics#5147jasontaylordev merged 8 commits intomasterfrom
Conversation
|
@jasontaylordev I just want to confirm that the guidance in https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/MigrationGuide_Query.md is incorrect? |
johnsimons
left a comment
There was a problem hiding this comment.
The changes LGTM, but I am unsure about the move of the client initialisation to the GetQueueNames method?
| client = new MetricsClient( | ||
| metricsEndpoint, | ||
| credential!, | ||
| new MetricsClientOptions | ||
| { | ||
| Audience = metricsQueryAudience, | ||
| Transport = new HttpClientTransport( | ||
| new HttpClient(new SocketsHttpHandler | ||
| { | ||
| PooledConnectionIdleTimeout = TimeSpan.FromMinutes(2) | ||
| })) | ||
| }); |
There was a problem hiding this comment.
I don't understand the motivation to move the initialisation of the client to this method?
There was a problem hiding this comment.
The metricsEndpoint needs to specify the region which can only be done once we have the ASB resource. Currently, that information is not available in InitializeCore. As per discussion, we are considering alternative options.
Yes, it is incorrect. The |
Co-authored-by: John Simons <john.simons@particular.net>
Updated the `BuildMetricsEndpoint` method to ensure the region is consistently formatted in lowercase when constructing the URI. Removed the unused `BuildMetricsEndpointFromAudience` method.
This change migrates from the deprecated
Azure.Monitor.Querypackage to the newAzure.Monitor.Query.Metricspackage as outlined within #5148.