Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.5k stars 4.82k forks source link

[Azure.Monitor.Query] Suppress QueryTimeRange in MetricsQueryResourcesOptions #46454

Open nisha-bhatia opened 1 month ago

nisha-bhatia commented 1 month ago

Currently, https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryResourcesOptions.cs#L20 MetricsQueryResourcesOptions takes in a QueryTimeRange TimeRange property. Using this parameter is confusing as it has three parts: duration, starttime, and endtime. The service only takes in starttime and endtime so we should make TimeRange as EditorBrowseableNever and add two new properties: Starttime and Endtime.

nisha-bhatia commented 1 month ago

With 3 parameters on QueryTimeRange, here are all the combinations and their outcomes:

  1. StartTime and EndTime not set -> service defaults to one hour
  2. StartTime specified -> service sets EndTime to be current Time
  3. StartTime and EndTime both set -> works
  4. Duration needs to be passed in (because of the QueryTimeRange constructor) but is disregarded
nisha-bhatia commented 1 month ago

https://learn.microsoft.com/en-us/rest/api/monitor/metrics-batch/batch?view=rest-monitor-2023-10-01&tabs=HTTP