Skip to content

Commit

Permalink
Updated DimensionKey
Browse files Browse the repository at this point in the history
  • Loading branch information
kinelski committed Jun 22, 2021
1 parent 259b0d3 commit e8979d7
Show file tree
Hide file tree
Showing 41 changed files with 2,559 additions and 1,829 deletions.
11 changes: 11 additions & 0 deletions sdk/metricsadvisor/Azure.AI.MetricsAdvisor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

## 1.0.0-beta.5 (Unreleased)

### New Features
- `DimensionKey` now implements the `IEnumerable<KeyValuePair<string, string>>` interface. Dimension columns can now be enumerated.
- Added method `Contains` to `DimensionKey` to check whether or not a dimension column is present.
- Added a property setter to `MetricSeriesGroupDetectionCondition.SeriesGroupKey` and to `MetricSingleSeriesDetectionCondition.SeriesKey`.

### Breaking Changes
- Removed methods `AddDimensionColumn` and `RemoveDimensionColumn` from `DimensionKey`. In order to access elements, the new method `TryGetValue` must be used. Once the instance has been created, the columns can't be modified anymore.
- `DimensionKey` is not an `IEquatable` anymore. Equality will be calculated based on reference only.
- The whole `DatasourceCredential` API has been renamed to `DataSourceCredential`. This includes renames in types, methods, and properties.
- `DimensionKey` constructor now takes the required `dimension` parameter.
- Split the method `GetAnomalies` into two different methods: `GetAnomaliesForAlert` and `GetAnomaliesForDetectionConfiguration`.
- Split the method `GetIncidents` into two different methods: `GetIncidentsForAlert` and `GetIncidentsForDetectionConfiguration`.
- `DataFeedIngestionSettings` constructor now takes the required `ingestionStartTime` parameter. For this reason, the property `IngestionStartTime` is not nullable anymore.
- `DataFeedMissingDataPointFillSettings` constructor now takes the required `fillType` parameter. For this reason, the property `FillType` is not nullable anymore.
- `EmailNotificationHook` constructor now takes the required `name` parameter.
- `WebNotificationHook` constructor now takes the required `name` and `endpoint` parameters.
- `MetricSeriesGroupDetectionCondition` constructor now takes the required `seriesGroupKey` parameter.
- `MetricSingleSeriesDetectionCondition` constructor now takes the required `seriesKey` parameter.
- In `MetricSeriesData`, removed the `Definition` property. Now, properties `MetricId` and `SeriesKey` can be accessed directly from `MetricSeriesData`.
- In `DataPointAnomaly`, renamed property `AnomalyDetectionConfigurationId` to `DetectionConfigurationId`.
- In `DataFeedMetric`, renamed constructor parameter `metricName` to `name` only.
Expand All @@ -18,6 +28,7 @@
- Moved `DatasourceCredential`, `DataFeedSource`, `NotificationHook`, and all of their concrete child types to the `Azure.AI.MetricsAdvisor.Administration` namespace.
- Moved `MetricFeedback` and all of its concrete child types to the `Azure.AI.MetricsAdvisor` namespace.
- Changed order of parameters of `MetricsAdvisorClient.GetMetricEnrichedSeriesData`. Now, `detectionConfigurationId` appears first.
- Optional properties `GetAllFeedbackOptions.Filter`, `GetAnomalyDimensionValuesOptions.DimensionToFilter`, and `FeedbackDimensionFilter.DimensionFilter` must now be manually added with setters to be used.
- In `MetricsAdvisorKeyCredential`, merged `UpdateSubscriptionKey` and `UpdateApiKey` into a single method, `Update`, to make it an atomic operation.

## 1.0.0-beta.4 (2021-06-07)
Expand Down
4 changes: 2 additions & 2 deletions sdk/metricsadvisor/Azure.AI.MetricsAdvisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ await foreach (DataPointAnomaly anomaly in client.GetAnomaliesForAlertAsync(aler
Console.WriteLine($"Severity: {anomaly.Severity}");
Console.WriteLine("Series key:");

foreach (KeyValuePair<string, string> keyValuePair in anomaly.SeriesKey.AsDictionary())
foreach (KeyValuePair<string, string> dimensionColumn in anomaly.SeriesKey)
{
Console.WriteLine($" Dimension '{keyValuePair.Key}': {keyValuePair.Value}");
Console.WriteLine($" Dimension '{dimensionColumn.Key}': {dimensionColumn.Value}");
}

Console.WriteLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public partial class GetAllFeedbackOptions
public GetAllFeedbackOptions() { }
public System.DateTimeOffset? EndTime { get { throw null; } set { } }
public Azure.AI.MetricsAdvisor.Models.FeedbackType? FeedbackType { get { throw null; } set { } }
public Azure.AI.MetricsAdvisor.Models.DimensionKey Filter { get { throw null; } }
public Azure.AI.MetricsAdvisor.Models.DimensionKey Filter { get { throw null; } set { } }
public int? MaxPageSize { get { throw null; } set { } }
public int? Skip { get { throw null; } set { } }
public System.DateTimeOffset? StartTime { get { throw null; } set { } }
Expand Down Expand Up @@ -83,7 +83,7 @@ public GetAnomaliesForDetectionConfigurationOptions(System.DateTimeOffset startT
public partial class GetAnomalyDimensionValuesOptions
{
public GetAnomalyDimensionValuesOptions(System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionToFilter { get { throw null; } }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionToFilter { get { throw null; } set { } }
public System.DateTimeOffset EndTime { get { throw null; } }
public int? MaxPageSize { get { throw null; } set { } }
public int? Skip { get { throw null; } set { } }
Expand Down Expand Up @@ -988,19 +988,13 @@ internal DataPointAnomaly() { }
public static bool operator !=(Azure.AI.MetricsAdvisor.Models.DetectionConditionsOperator left, Azure.AI.MetricsAdvisor.Models.DetectionConditionsOperator right) { throw null; }
public override string ToString() { throw null; }
}
public partial class DimensionKey : System.IEquatable<Azure.AI.MetricsAdvisor.Models.DimensionKey>
public partial class DimensionKey : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, System.Collections.IEnumerable
{
public DimensionKey() { }
public void AddDimensionColumn(string dimensionColumnName, string dimensionColumnValue) { }
public System.Collections.Generic.Dictionary<string, string> AsDictionary() { throw null; }
public bool Equals(Azure.AI.MetricsAdvisor.Models.DimensionKey other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.AI.MetricsAdvisor.Models.DimensionKey left, Azure.AI.MetricsAdvisor.Models.DimensionKey right) { throw null; }
public static bool operator !=(Azure.AI.MetricsAdvisor.Models.DimensionKey left, Azure.AI.MetricsAdvisor.Models.DimensionKey right) { throw null; }
public void RemoveDimensionColumn(string dimensionColumnName) { }
public DimensionKey(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>> dimension) { }
public bool Contains(string columnName) { throw null; }
public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string, string>> GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public bool TryGetValue(string columnName, out string value) { throw null; }
}
public partial class EnrichmentStatus
{
Expand All @@ -1012,7 +1006,7 @@ internal EnrichmentStatus() { }
public partial class FeedbackDimensionFilter
{
public FeedbackDimensionFilter() { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionFilter { get { throw null; } }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionFilter { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct FeedbackType : System.IEquatable<Azure.AI.MetricsAdvisor.Models.FeedbackType>
Expand Down Expand Up @@ -1181,13 +1175,13 @@ internal MetricSeriesDefinition() { }
}
public partial class MetricSeriesGroupDetectionCondition : Azure.AI.MetricsAdvisor.Models.MetricWholeSeriesDetectionCondition
{
public MetricSeriesGroupDetectionCondition() { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey SeriesGroupKey { get { throw null; } }
public MetricSeriesGroupDetectionCondition(Azure.AI.MetricsAdvisor.Models.DimensionKey seriesGroupKey) { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey SeriesGroupKey { get { throw null; } set { } }
}
public partial class MetricSingleSeriesDetectionCondition : Azure.AI.MetricsAdvisor.Models.MetricWholeSeriesDetectionCondition
{
public MetricSingleSeriesDetectionCondition() { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey SeriesKey { get { throw null; } }
public MetricSingleSeriesDetectionCondition(Azure.AI.MetricsAdvisor.Models.DimensionKey seriesKey) { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey SeriesKey { get { throw null; } set { } }
}
public partial class MetricWholeSeriesDetectionCondition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ public class GetAllFeedbackOptions
/// </summary>
public GetAllFeedbackOptions()
{
Filter = new DimensionKey();
}

/// <summary> The dimension filter. </summary>
internal FeedbackDimensionFilter DimensionFilter => Filter.Dimension.Count == 0 ? null : new FeedbackDimensionFilter(Filter.Dimension);
internal FeedbackDimensionFilter DimensionFilter => Filter.Dimension == null ? null : new FeedbackDimensionFilter(Filter.Dimension);

/// <summary>
/// Filters the result by series. Only feedbacks for the series in the time series group specified will
/// be returned.
/// </summary>
public DimensionKey Filter { get; }
public DimensionKey Filter { get; set; }

/// <summary>
/// Filters the result by <see cref="MetricFeedback.Type"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public GetAnomalyDimensionValuesOptions(DateTimeOffset startTime, DateTimeOffset
{
StartTime = startTime;
EndTime = endTime;
DimensionToFilter = new DimensionKey();
}

/// <summary>
Expand All @@ -38,7 +37,7 @@ public GetAnomalyDimensionValuesOptions(DateTimeOffset startTime, DateTimeOffset
/// Filters the result by series. Only anomalies detected in the time series group specified will
/// be returned.
/// </summary>
public DimensionKey DimensionToFilter { get; }
public DimensionKey DimensionToFilter { get; set; }

/// <summary>
/// If set, skips the first set of items returned. This property specifies the amount of items to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Core;

namespace Azure.AI.MetricsAdvisor.Models
Expand All @@ -16,16 +17,20 @@ public partial class MetricSeriesGroupDetectionCondition : MetricWholeSeriesDete
/// <summary>
/// Initializes a new instance of the <see cref="MetricSeriesGroupDetectionCondition"/> class.
/// </summary>
public MetricSeriesGroupDetectionCondition()
/// <param name="seriesGroupKey">The key that identifies the group of time series to which these conditions apply within a metric. A subset of the possible dimensions of the associated data feed must be set.</param>
/// <exception cref="ArgumentNullException"><paramref name="seriesGroupKey"/> is <c>null</c>.</exception>
public MetricSeriesGroupDetectionCondition(DimensionKey seriesGroupKey)
{
SeriesGroupKey = new DimensionKey();
Argument.AssertNotNull(seriesGroupKey, nameof(seriesGroupKey));

SeriesGroupKey = seriesGroupKey;
}

/// <summary>
/// The key that identifies the group of time series to which these conditions apply within a metric.
/// A subset of the possible dimensions of the associated data feed must be set.
/// </summary>
[CodeGenMember("Group")]
public DimensionKey SeriesGroupKey { get; }
public DimensionKey SeriesGroupKey { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Core;

namespace Azure.AI.MetricsAdvisor.Models
Expand All @@ -16,9 +17,13 @@ public partial class MetricSingleSeriesDetectionCondition : MetricWholeSeriesDet
/// <summary>
/// Initializes a new instance of the <see cref="MetricSingleSeriesDetectionCondition"/> class.
/// </summary>
public MetricSingleSeriesDetectionCondition()
/// <param name="seriesKey">The key that uniquely identifies the time series to which these conditions apply within a metric. Every dimension contained in the associated <see cref="DataFeed"/> must be assigned a value.</param>
/// <exception cref="ArgumentNullException"><paramref name="seriesKey"/> is <c>null</c>.</exception>
public MetricSingleSeriesDetectionCondition(DimensionKey seriesKey)
{
SeriesKey = new DimensionKey();
Argument.AssertNotNull(seriesKey, nameof(seriesKey));

SeriesKey = seriesKey;
}

internal MetricSingleSeriesDetectionCondition(DetectionConditionsOperator? crossConditionsOperator, SmartDetectionCondition smartDetectionCondition, HardThresholdCondition hardThresholdCondition, ChangeThresholdCondition changeThresholdCondition, SeriesIdentity series)
Expand All @@ -31,7 +36,7 @@ internal MetricSingleSeriesDetectionCondition(DetectionConditionsOperator? cross
/// The key that uniquely identifies the time series to which these conditions apply within a metric.
/// Every dimension contained in the associated <see cref="DataFeed"/> must be assigned a value.
/// </summary>
public DimensionKey SeriesKey { get; }
public DimensionKey SeriesKey { get; set; }

/// <summary>
/// Used by CodeGen during serialization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public partial class FeedbackDimensionFilter
/// </summary>
public FeedbackDimensionFilter()
{
DimensionFilter = new DimensionKey();
}

/// <summary> Initializes a new instance of FeedbackDimensionFilter. </summary>
Expand All @@ -36,14 +35,14 @@ internal FeedbackDimensionFilter(IDictionary<string, string> dimension)
/// Filters the result by series. Only feedbacks for the series in the time series group specified will
/// be returned.
/// </summary>
public DimensionKey DimensionFilter { get; private set; }
public DimensionKey DimensionFilter { get; set; }

/// <summary>
/// Used by CodeGen during serialization.
/// </summary>
internal IDictionary<string, string> Dimension
{
get => DimensionFilter.Dimension;
get => DimensionFilter?.Dimension ?? new Dictionary<string, string>();
set => DimensionFilter = new DimensionKey(value);
}
}
Expand Down
Loading

0 comments on commit e8979d7

Please sign in to comment.