Skip to content

Commit 2e13fe4

Browse files
authored
[MetricsAdvisor] Removed getters from collections (Azure#21452)
1 parent 5d71eec commit 2e13fe4

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

sdk/metricsadvisor/Azure.AI.MetricsAdvisor/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Breaking Changes
1111
- `NotificationHook.ExternalLink` and `WebNotificationHook.Endpoint` are now of type `Uri`.
12+
- Removed getter from `GetIncidentsForDetectionConfigurationOptions.DimensionsToFilter`. Elements can be added directly to it without user instantiation.
1213
- Renamed all `SkipCount` listing options to `Skip`. Affected classes include `GetAlertsOptions`, `GetDataFeedsOptions`, `GetHooksOptions`, and others.
1314
- Renamed all `TopCount` listing options to `MaxPageSize`. Affected classes include `GetAlertsOptions`, `GetDataFeedsOptions`, `GetHooksOptions`, and others.
1415
- Removed data feed sources `ElasticsearchDataFeedSource` and `HttpRequestDataFeedSource` as they are not supported by the service anymore. A different type of data feed source must be used for data ingestion instead.

sdk/metricsadvisor/Azure.AI.MetricsAdvisor/api/Azure.AI.MetricsAdvisor.netstandard2.0.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public GetIncidentsForAlertOptions() { }
109109
public partial class GetIncidentsForDetectionConfigurationOptions
110110
{
111111
public GetIncidentsForDetectionConfigurationOptions(System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
112-
public System.Collections.Generic.IList<Azure.AI.MetricsAdvisor.Models.DimensionKey> DimensionsToFilter { get { throw null; } set { } }
112+
public System.Collections.Generic.IList<Azure.AI.MetricsAdvisor.Models.DimensionKey> DimensionsToFilter { get { throw null; } }
113113
public System.DateTimeOffset EndTime { get { throw null; } }
114114
public int? MaxPageSize { get { throw null; } set { } }
115115
public System.DateTimeOffset StartTime { get { throw null; } }

sdk/metricsadvisor/Azure.AI.MetricsAdvisor/src/GetIncidentsForDetectionConfigurationOptions.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ namespace Azure.AI.MetricsAdvisor
1616
/// </summary>
1717
public class GetIncidentsForDetectionConfigurationOptions
1818
{
19-
private IList<DimensionKey> _dimensionsToFilter;
20-
2119
/// <summary>
2220
/// Initializes a new instance of the <see cref="GetIncidentsForDetectionConfigurationOptions"/> class.
2321
/// </summary>
@@ -44,17 +42,7 @@ public GetIncidentsForDetectionConfigurationOptions(DateTimeOffset startTime, Da
4442
/// Filters the result by series. Only incidents detected in the time series groups specified will
4543
/// be returned.
4644
/// </summary>
47-
#pragma warning disable CA2227 // Collection properties should be readonly
48-
public IList<DimensionKey> DimensionsToFilter
49-
{
50-
get => _dimensionsToFilter;
51-
set
52-
{
53-
Argument.AssertNotNull(value, nameof(DimensionsToFilter));
54-
_dimensionsToFilter = value;
55-
}
56-
}
57-
#pragma warning restore CA2227 // Collection properties should be readonly
45+
public IList<DimensionKey> DimensionsToFilter { get; }
5846

5947
/// <summary>
6048
/// If set, specifies the maximum limit of items returned in each page of results. Note:

sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/Samples/Sample08_QueryIncidentsAndRootCauses.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ public async Task GetIncidentsForDetectionConfigurationAsync()
3636

3737
var startTime = DateTimeOffset.Parse("2020-01-01T00:00:00Z");
3838
var endTime = DateTimeOffset.UtcNow;
39-
var options = new GetIncidentsForDetectionConfigurationOptions(startTime, endTime)
40-
{
41-
DimensionsToFilter = new List<DimensionKey>() { groupKey1, groupKey2 },
42-
MaxPageSize = 3
43-
};
39+
var options = new GetIncidentsForDetectionConfigurationOptions(startTime, endTime) { MaxPageSize = 3 };
40+
41+
options.DimensionsToFilter.Add(groupKey1);
42+
options.DimensionsToFilter.Add(groupKey2);
4443

4544
int incidentCount = 0;
4645

0 commit comments

Comments
 (0)