internal IncidentRootCause(DimensionKey dimensionKey, IReadOnlyList <string> paths, double score, string description) { DimensionKey = dimensionKey; Paths = paths; Score = score; Description = description; }
internal IncidentRootCause(DimensionKey seriesKey, IReadOnlyList <string> paths, double contributionScore, string description) { SeriesKey = seriesKey; Paths = paths; ContributionScore = contributionScore; Description = description; }
internal static MetricSeriesGroupDetectionCondition DeserializeMetricSeriesGroupDetectionCondition(JsonElement element) { DimensionKey group = default; Optional <DetectionConditionsOperator> conditionOperator = default; Optional <SmartDetectionCondition> smartDetectionCondition = default; Optional <HardThresholdCondition> hardThresholdCondition = default; Optional <ChangeThresholdCondition> changeThresholdCondition = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("group")) { group = DimensionKey.DeserializeDimensionKey(property.Value); continue; } if (property.NameEquals("conditionOperator")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } conditionOperator = new DetectionConditionsOperator(property.Value.GetString()); continue; } if (property.NameEquals("smartDetectionCondition")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } smartDetectionCondition = Models.SmartDetectionCondition.DeserializeSmartDetectionCondition(property.Value); continue; } if (property.NameEquals("hardThresholdCondition")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } hardThresholdCondition = Models.HardThresholdCondition.DeserializeHardThresholdCondition(property.Value); continue; } if (property.NameEquals("changeThresholdCondition")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } changeThresholdCondition = Models.ChangeThresholdCondition.DeserializeChangeThresholdCondition(property.Value); continue; } } return(new MetricSeriesGroupDetectionCondition(Optional.ToNullable(conditionOperator), smartDetectionCondition.Value, hardThresholdCondition.Value, changeThresholdCondition.Value, group)); }
internal static MetricAnomalyAlertConfiguration DeserializeMetricAnomalyAlertConfiguration(JsonElement element) { string anomalyDetectionConfigurationId = default; MetricAnomalyAlertScopeType anomalyScopeType = default; Optional <bool> negationOperation = default; Optional <DimensionKey> dimensionAnomalyScope = default; Optional <TopNGroupScope> topNAnomalyScope = default; Optional <SeverityCondition> severityFilter = default; Optional <MetricAnomalyAlertSnoozeCondition> snoozeFilter = default; Optional <MetricBoundaryCondition> valueFilter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("anomalyDetectionConfigurationId")) { anomalyDetectionConfigurationId = property.Value.GetString(); continue; } if (property.NameEquals("anomalyScopeType")) { anomalyScopeType = new MetricAnomalyAlertScopeType(property.Value.GetString()); continue; } if (property.NameEquals("negationOperation")) { negationOperation = property.Value.GetBoolean(); continue; } if (property.NameEquals("dimensionAnomalyScope")) { dimensionAnomalyScope = DimensionKey.DeserializeDimensionKey(property.Value); continue; } if (property.NameEquals("topNAnomalyScope")) { topNAnomalyScope = TopNGroupScope.DeserializeTopNGroupScope(property.Value); continue; } if (property.NameEquals("severityFilter")) { severityFilter = SeverityCondition.DeserializeSeverityCondition(property.Value); continue; } if (property.NameEquals("snoozeFilter")) { snoozeFilter = MetricAnomalyAlertSnoozeCondition.DeserializeMetricAnomalyAlertSnoozeCondition(property.Value); continue; } if (property.NameEquals("valueFilter")) { valueFilter = MetricBoundaryCondition.DeserializeMetricBoundaryCondition(property.Value); continue; } } return(new MetricAnomalyAlertConfiguration(anomalyDetectionConfigurationId, anomalyScopeType, Optional.ToNullable(negationOperation), dimensionAnomalyScope.Value, topNAnomalyScope.Value, severityFilter.Value, snoozeFilter.Value, valueFilter.Value)); }
/// <summary> /// Initializes a new instance of <see cref="Models.MetricSeriesData"/> for mocking purposes. /// </summary> /// <param name="metricId">Sets the <see cref="MetricSeriesData.MetricId"/> property.</param> /// <param name="seriesKey">Sets the <see cref="MetricSeriesData.SeriesKey"/> property.</param> /// <param name="timestamps">Sets the <see cref="MetricSeriesData.Timestamps"/> property.</param> /// <param name="metricValues">Sets the <see cref="MetricSeriesData.MetricValues"/> property.</param> /// <returns>A new instance of <see cref="Models.MetricSeriesData"/> for mocking purposes.</returns> public static MetricSeriesData MetricSeriesData(string metricId = null, DimensionKey seriesKey = null, IEnumerable <DateTimeOffset> timestamps = null, IEnumerable <double> metricValues = null) { timestamps ??= new List <DateTimeOffset>(); metricValues ??= new List <double>(); Dictionary <string, string> dimensions = seriesKey?.ToDictionary(key => key.Key, key => key.Value); MetricSeriesDefinition definition = new MetricSeriesDefinition(metricId, dimensions); return(new MetricSeriesData(definition, timestamps?.ToList(), metricValues?.ToList())); }
internal AnomalyIncident(string metricId, string detectionConfigurationId, string id, DateTimeOffset startTime, DateTimeOffset endTime, SeriesIdentity rootNode, IncidentProperty property) { MetricId = metricId; DetectionConfigurationId = detectionConfigurationId; Id = id; StartTime = startTime; LastTime = endTime; DimensionKey = new DimensionKey(rootNode.Dimension); Severity = property.MaxSeverity; Status = property.IncidentStatus; }
internal MetricEnrichedSeriesData(SeriesIdentity series, IReadOnlyList <DateTimeOffset> timestamps, IReadOnlyList <double> values, IReadOnlyList <bool?> isAnomaly, IReadOnlyList <int?> periods, IReadOnlyList <double?> expectedValues, IReadOnlyList <double?> lowerBoundaries, IReadOnlyList <double?> upperBoundaries) { SeriesKey = new DimensionKey(series.Dimension); Timestamps = timestamps; MetricValues = values; IsAnomaly = isAnomaly; Periods = periods; ExpectedMetricValues = expectedValues; LowerBoundaryValues = lowerBoundaries; UpperBoundaryValues = upperBoundaries; }
internal DataAnomaly(string metricId, string anomalyDetectionConfigurationId, DateTimeOffset timestamp, DateTimeOffset?createdTime, DateTimeOffset?modifiedTime, IReadOnlyDictionary <string, string> dimension, AnomalyProperty property) { MetricId = metricId; AnomalyDetectionConfigurationId = anomalyDetectionConfigurationId; Timestamp = timestamp; CreatedTime = createdTime; ModifiedTime = modifiedTime; SeriesKey = new DimensionKey(dimension); Severity = property.AnomalySeverity; AnomalyStatus = property.AnomalyStatus; }
internal AnomalyIncident(string dataFeedId, string metricId, string detectionConfigurationId, string id, DateTimeOffset startedOn, DateTimeOffset lastDetectedOn, SeriesIdentity rootNode, IncidentProperty property) { DataFeedId = dataFeedId; MetricId = metricId; DetectionConfigurationId = detectionConfigurationId; Id = id; StartedOn = startedOn; LastDetectedOn = lastDetectedOn; RootSeriesKey = new DimensionKey(rootNode.Dimension); Severity = property.MaxSeverity; Status = property.IncidentStatus; ValueOfRootNode = property.ValueOfRootNode; ExpectedValueOfRootNode = property.ExpectedValueOfRootNode; }
/// <summary> /// Initializes a new instance of <see cref="Models.MetricEnrichedSeriesData"/> for mocking purposes. /// </summary> /// <param name="seriesKey">Sets the <see cref="MetricEnrichedSeriesData.SeriesKey"/> property.</param> /// <param name="timestamps">Sets the <see cref="MetricEnrichedSeriesData.Timestamps"/> property.</param> /// <param name="metricValues">Sets the <see cref="MetricEnrichedSeriesData.MetricValues"/> property.</param> /// <param name="isAnomaly">Sets the <see cref="MetricEnrichedSeriesData.IsAnomaly"/> property.</param> /// <param name="periods">Sets the <see cref="MetricEnrichedSeriesData.Periods"/> property.</param> /// <param name="expectedMetricValues">Sets the <see cref="MetricEnrichedSeriesData.ExpectedMetricValues"/> property.</param> /// <param name="lowerBoundaryValues">Sets the <see cref="MetricEnrichedSeriesData.LowerBoundaryValues"/> property.</param> /// <param name="upperBoundaryValues">Sets the <see cref="MetricEnrichedSeriesData.UpperBoundaryValues"/> property.</param> /// <returns>A new instance of <see cref="Models.MetricEnrichedSeriesData"/> for mocking purposes.</returns> public static MetricEnrichedSeriesData MetricEnrichedSeriesData(DimensionKey seriesKey = null, IEnumerable <DateTimeOffset> timestamps = null, IEnumerable <double> metricValues = null, IEnumerable <bool?> isAnomaly = null, IEnumerable <int?> periods = null, IEnumerable <double?> expectedMetricValues = null, IEnumerable <double?> lowerBoundaryValues = null, IEnumerable <double?> upperBoundaryValues = null) { timestamps ??= new List <DateTimeOffset>(); metricValues ??= new List <double>(); isAnomaly ??= new List <bool?>(); periods ??= new List <int?>(); expectedMetricValues ??= new List <double?>(); lowerBoundaryValues ??= new List <double?>(); upperBoundaryValues ??= new List <double?>(); Dictionary <string, string> dimensions = seriesKey?.ToDictionary(key => key.Key, key => key.Value); return(new MetricEnrichedSeriesData(new SeriesIdentity(dimensions), timestamps?.ToList(), metricValues?.ToList(), isAnomaly?.ToList(), periods?.ToList(), expectedMetricValues?.ToList(), lowerBoundaryValues?.ToList(), upperBoundaryValues?.ToList())); }
internal DataPointAnomaly(string dataFeedId, string metricId, string anomalyDetectionConfigurationId, DateTimeOffset timestamp, DateTimeOffset?createdOn, DateTimeOffset?lastModified, IReadOnlyDictionary <string, string> dimension, AnomalyProperty property) { DataFeedId = dataFeedId; MetricId = metricId; DetectionConfigurationId = anomalyDetectionConfigurationId; Timestamp = timestamp; CreatedOn = createdOn; LastModified = lastModified; SeriesKey = new DimensionKey(dimension); Severity = property.AnomalySeverity; Status = property.AnomalyStatus; Value = property.Value; ExpectedValue = property.ExpectedValue; }
internal IncidentRootCause(DimensionKey dimensionKey, IEnumerable <string> paths, double score, string description) { if (dimensionKey == null) { throw new ArgumentNullException(nameof(dimensionKey)); } if (paths == null) { throw new ArgumentNullException(nameof(paths)); } if (description == null) { throw new ArgumentNullException(nameof(description)); } DimensionKey = dimensionKey; Paths = paths.ToList(); Score = score; Description = description; }
internal IncidentRootCause(DimensionKey seriesKey, IEnumerable <string> paths, double contributionScore, string description) { if (seriesKey == null) { throw new ArgumentNullException(nameof(seriesKey)); } if (paths == null) { throw new ArgumentNullException(nameof(paths)); } if (description == null) { throw new ArgumentNullException(nameof(description)); } SeriesKey = seriesKey; Paths = paths.ToList(); ContributionScore = contributionScore; Description = description; }
internal static IncidentRootCause DeserializeIncidentRootCause(JsonElement element) { DimensionKey rootCause = default; IReadOnlyList <string> path = default; double score = default; string description = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rootCause")) { rootCause = DimensionKey.DeserializeDimensionKey(property.Value); continue; } if (property.NameEquals("path")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } path = array; continue; } if (property.NameEquals("score")) { score = property.Value.GetDouble(); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } } return(new IncidentRootCause(rootCause, path, score, description)); }
/// <summary> /// Initializes a new instance of <see cref="MetricsAdvisor.MetricAnomalyFeedback"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="MetricFeedback.Id"/> property.</param> /// <param name="createdOn">Sets the <see cref="MetricFeedback.CreatedOn"/> property.</param> /// <param name="userPrincipal">Sets the <see cref="MetricFeedback.UserPrincipal"/> property.</param> /// <param name="metricId">Sets the <see cref="MetricFeedback.MetricId"/> property.</param> /// <param name="dimensionKey">Sets the <see cref="MetricFeedback.DimensionKey"/> property.</param> /// <param name="startsOn">Sets the <see cref="MetricAnomalyFeedback.StartsOn"/> property.</param> /// <param name="endsOn">Sets the <see cref="MetricAnomalyFeedback.EndsOn"/> property.</param> /// <param name="anomalyValue">Sets the <see cref="MetricAnomalyFeedback.AnomalyValue"/> property.</param> /// <param name="detectionConfigurationId">Sets the <see cref="MetricAnomalyFeedback.DetectionConfigurationId"/> property.</param> /// <param name="detectionConfigurationSnapshot">Sets the <see cref="MetricAnomalyFeedback.DetectionConfigurationSnapshot"/> property.</param> /// <returns>A new instance of <see cref="MetricsAdvisor.MetricAnomalyFeedback"/> for mocking purposes.</returns> public static MetricAnomalyFeedback MetricAnomalyFeedback(string id = null, DateTimeOffset?createdOn = null, string userPrincipal = null, string metricId = null, DimensionKey dimensionKey = null, DateTimeOffset startsOn = default, DateTimeOffset endsOn = default, AnomalyValue anomalyValue = default, string detectionConfigurationId = null, AnomalyDetectionConfiguration detectionConfigurationSnapshot = null) { Dictionary <string, string> dimensions = dimensionKey?.ToDictionary(key => key.Key, key => key.Value); FeedbackFilter filter = new FeedbackFilter(dimensions); AnomalyFeedbackValue feedbackValue = new AnomalyFeedbackValue(anomalyValue); return(new MetricAnomalyFeedback(MetricFeedbackKind.Anomaly, id, createdOn, userPrincipal, metricId, filter, startsOn, endsOn, feedbackValue, detectionConfigurationId, detectionConfigurationSnapshot)); }
internal MetricAnomalyAlertConfiguration(string detectionConfigurationId, MetricAnomalyAlertScopeType anomalyScopeType, bool? useDetectionResultToFilterAnomalies, DimensionKey dimensionAnomalyScope, TopNGroupScope topNAnomalyScope, SeverityCondition severityFilter, MetricAnomalyAlertSnoozeCondition alertSnoozeCondition, MetricBoundaryCondition valueFilter) { DetectionConfigurationId = detectionConfigurationId; AlertScope = new MetricAnomalyAlertScope(anomalyScopeType, dimensionAnomalyScope, topNAnomalyScope); UseDetectionResultToFilterAnomalies = useDetectionResultToFilterAnomalies; AlertConditions = new MetricAnomalyAlertConditions() { MetricBoundaryCondition = valueFilter, SeverityCondition = severityFilter }; AlertSnoozeCondition = alertSnoozeCondition; }
internal MetricSingleSeriesDetectionCondition(DetectionConditionsOperator?crossConditionsOperator, SmartDetectionCondition smartDetectionCondition, HardThresholdCondition hardThresholdCondition, ChangeThresholdCondition changeThresholdCondition, SeriesIdentity series) : base(crossConditionsOperator, smartDetectionCondition, hardThresholdCondition, changeThresholdCondition) { SeriesKey = new DimensionKey(series.Dimension); }
/// <summary> /// Initializes a new instance of the <see cref="MetricSingleSeriesDetectionCondition"/> class. /// </summary> public MetricSingleSeriesDetectionCondition() { SeriesKey = new DimensionKey(); }
public static IncidentRootCause IncidentRootCause(DimensionKey seriesKey = null, IEnumerable <string> paths = null, double contributionScore = default, string description = null) { paths ??= new List <string>(); return(new IncidentRootCause(seriesKey, paths?.ToList(), contributionScore, description)); }
/// <summary> /// </summary> public MetricSeriesGroupAnomalyDetectionConditions(DimensionKey seriesGroupKey) { Argument.AssertNotNull(seriesGroupKey, nameof(seriesGroupKey)); SeriesGroupKey = seriesGroupKey; }
/// <summary> /// Initializes a new instance of the <see cref="FeedbackDimensionFilter"/> class. /// </summary> public FeedbackDimensionFilter() { DimensionFilter = new DimensionKey(); }
/// <summary> /// Initializes a new instance of the <see cref="FeedbackDimensionFilter"/> class. /// </summary> /// <param name="dimensionFilter">Filters the result by series. Only feedbacks for the series in the time series group specified will be returned.</param> /// <exception cref="ArgumentNullException"><paramref name="dimensionFilter"/> is null.</exception> public FeedbackDimensionFilter(DimensionKey dimensionFilter) { Argument.AssertNotNull(dimensionFilter, nameof(dimensionFilter)); DimensionFilter = dimensionFilter; }
/// <summary> /// Initializes a new instance of the <see cref="GetAllMetricFeedbackOptions"/> class. /// </summary> public GetAllMetricFeedbackOptions() { Filter = new DimensionKey(); }
/// <summary> /// Initializes a new instance of <see cref="Models.DataPointAnomaly"/> for mocking purposes. /// </summary> /// <param name="dataFeedId">Sets the <see cref="DataPointAnomaly.DataFeedId"/> property.</param> /// <param name="metricId">Sets the <see cref="DataPointAnomaly.MetricId"/> property.</param> /// <param name="detectionConfigurationId">Sets the <see cref="DataPointAnomaly.DetectionConfigurationId"/> property.</param> /// <param name="timestamp">Sets the <see cref="DataPointAnomaly.Timestamp"/> property.</param> /// <param name="createdOn">Sets the <see cref="DataPointAnomaly.CreatedOn"/> property.</param> /// <param name="lastModified">Sets the <see cref="DataPointAnomaly.LastModified"/> property.</param> /// <param name="seriesKey">Sets the <see cref="DataPointAnomaly.SeriesKey"/> property.</param> /// <param name="severity">Sets the <see cref="DataPointAnomaly.Severity"/> property.</param> /// <param name="status">Sets the <see cref="DataPointAnomaly.Status"/> property.</param> /// <param name="value">Sets the <see cref="DataPointAnomaly.Value"/> property.</param> /// <param name="expectedValue">Sets the <see cref="DataPointAnomaly.ExpectedValue"/> property.</param> /// <returns>A new instance of <see cref="Models.DataPointAnomaly"/> for mocking purposes.</returns> public static DataPointAnomaly DataPointAnomaly(string dataFeedId = null, string metricId = null, string detectionConfigurationId = null, DateTimeOffset timestamp = default, DateTimeOffset?createdOn = null, DateTimeOffset?lastModified = null, DimensionKey seriesKey = null, AnomalySeverity severity = default, AnomalyStatus?status = null, double value = default, double?expectedValue = null) { Dictionary <string, string> dimensions = seriesKey?.ToDictionary(key => key.Key, key => key.Value); AnomalyProperty anomalyProperty = new AnomalyProperty(severity, status, value, expectedValue); return(new DataPointAnomaly(dataFeedId, metricId, detectionConfigurationId, timestamp, createdOn, lastModified, dimensions, anomalyProperty)); }
/// <summary> /// Initializes a new instance of the <see cref="MetricSingleSeriesDetectionCondition"/> class. /// </summary> /// <param name="seriesKey">The key that uniquely identifies the time series to which these conditions apply within a metric. All possible dimensions must be assigned a value.</param> /// <exception cref="ArgumentNullException"><paramref name="seriesKey"/> is <c>null</c>.</exception> public MetricSingleSeriesDetectionCondition(DimensionKey seriesKey) { Argument.AssertNotNull(seriesKey, nameof(seriesKey)); SeriesKey = seriesKey; }
/// <summary> /// Initializes a new instance of <see cref="MetricsAdvisor.MetricCommentFeedback"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="MetricFeedback.Id"/> property.</param> /// <param name="createdOn">Sets the <see cref="MetricFeedback.CreatedOn"/> property.</param> /// <param name="userPrincipal">Sets the <see cref="MetricFeedback.UserPrincipal"/> property.</param> /// <param name="metricId">Sets the <see cref="MetricFeedback.MetricId"/> property.</param> /// <param name="dimensionKey">Sets the <see cref="MetricFeedback.DimensionKey"/> property.</param> /// <param name="startsOn">Sets the <see cref="MetricCommentFeedback.StartsOn"/> property.</param> /// <param name="endsOn">Sets the <see cref="MetricCommentFeedback.EndsOn"/> property.</param> /// <param name="comment">Sets the <see cref="MetricCommentFeedback.Comment"/> property.</param> /// <returns>A new instance of <see cref="MetricsAdvisor.MetricCommentFeedback"/> for mocking purposes.</returns> public static MetricCommentFeedback MetricCommentFeedback(string id = null, DateTimeOffset?createdOn = null, string userPrincipal = null, string metricId = null, DimensionKey dimensionKey = null, DateTimeOffset?startsOn = null, DateTimeOffset?endsOn = null, string comment = null) { Dictionary <string, string> dimensions = dimensionKey?.ToDictionary(key => key.Key, key => key.Value); FeedbackFilter filter = new FeedbackFilter(dimensions); CommentFeedbackValue feedbackValue = new CommentFeedbackValue(comment); return(new MetricCommentFeedback(MetricFeedbackKind.Comment, id, createdOn, userPrincipal, metricId, filter, startsOn, endsOn, feedbackValue)); }
/// <summary> /// Initializes a new instance of <see cref="Models.MetricSeriesDefinition"/> for mocking purposes. /// </summary> /// <param name="metricId">Sets the <see cref="MetricSeriesDefinition.MetricId"/> property.</param> /// <param name="seriesKey">Sets the <see cref="MetricSeriesDefinition.SeriesKey"/> property.</param> /// <returns>A new instance of <see cref="Models.MetricSeriesDefinition"/> for mocking purposes.</returns> public static MetricSeriesDefinition MetricSeriesDefinition(string metricId = null, DimensionKey seriesKey = null) { Dictionary <string, string> dimensions = seriesKey?.ToDictionary(key => key.Key, key => key.Value); return(new MetricSeriesDefinition(metricId, dimensions)); }
internal MetricAnomalyAlertScope(MetricAnomalyAlertScopeType scopeType, DimensionKey seriesGroupInScope, TopNGroupScope topNGroupInScope) { ScopeType = scopeType; SeriesGroupInScope = seriesGroupInScope; TopNGroupInScope = topNGroupInScope; }
/// <summary> /// Initializes a new instance of <see cref="Models.AnomalyIncident"/> for mocking purposes. /// </summary> /// <param name="dataFeedId">Sets the <see cref="AnomalyIncident.DataFeedId"/> property.</param> /// <param name="metricId">Sets the <see cref="AnomalyIncident.MetricId"/> property.</param> /// <param name="detectionConfigurationId">Sets the <see cref="AnomalyIncident.DetectionConfigurationId"/> property.</param> /// <param name="id">Sets the <see cref="AnomalyIncident.Id"/> property.</param> /// <param name="startedOn">Sets the <see cref="AnomalyIncident.StartedOn"/> property.</param> /// <param name="lastDetectedOn">Sets the <see cref="AnomalyIncident.LastDetectedOn"/> property.</param> /// <param name="rootSeriesKey">Sets the <see cref="AnomalyIncident.RootSeriesKey"/> property.</param> /// <param name="severity">Sets the <see cref="AnomalyIncident.Severity"/> property.</param> /// <param name="status">Sets the <see cref="AnomalyIncident.Status"/> property.</param> /// <param name="valueOfRootNode">Sets the <see cref="AnomalyIncident.ValueOfRootNode"/> property.</param> /// <param name="expectedValueOfRootNode">Sets the <see cref="AnomalyIncident.ExpectedValueOfRootNode"/> property.</param> /// <returns>A new instance of <see cref="Models.AnomalyIncident"/> for mocking purposes.</returns> public static AnomalyIncident AnomalyIncident(string dataFeedId = null, string metricId = null, string detectionConfigurationId = null, string id = null, DateTimeOffset startedOn = default, DateTimeOffset lastDetectedOn = default, DimensionKey rootSeriesKey = null, AnomalySeverity severity = default, AnomalyIncidentStatus status = default, double valueOfRootNode = default, double?expectedValueOfRootNode = null) { Dictionary <string, string> dimensions = rootSeriesKey?.ToDictionary(key => key.Key, key => key.Value); IncidentProperty incidentProperty = new IncidentProperty(severity, status, valueOfRootNode, expectedValueOfRootNode); return(new AnomalyIncident(dataFeedId, metricId, detectionConfigurationId, id, startedOn, lastDetectedOn, new SeriesIdentity(dimensions), incidentProperty)); }
/// <summary> /// Initializes a new instance of <see cref="MetricsAdvisor.MetricPeriodFeedback"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="MetricFeedback.Id"/> property.</param> /// <param name="createdOn">Sets the <see cref="MetricFeedback.CreatedOn"/> property.</param> /// <param name="userPrincipal">Sets the <see cref="MetricFeedback.UserPrincipal"/> property.</param> /// <param name="metricId">Sets the <see cref="MetricFeedback.MetricId"/> property.</param> /// <param name="dimensionKey">Sets the <see cref="MetricFeedback.DimensionKey"/> property.</param> /// <param name="periodType">Sets the <see cref="MetricPeriodFeedback.PeriodType"/> property.</param> /// <param name="periodValue">Sets the <see cref="MetricPeriodFeedback.PeriodValue"/> property.</param> /// <returns>A new instance of <see cref="MetricsAdvisor.MetricPeriodFeedback"/> for mocking purposes.</returns> public static MetricPeriodFeedback MetricPeriodFeedback(string id = null, DateTimeOffset?createdOn = null, string userPrincipal = null, string metricId = null, DimensionKey dimensionKey = null, MetricPeriodType periodType = default, int periodValue = default) { Dictionary <string, string> dimensions = dimensionKey?.ToDictionary(key => key.Key, key => key.Value); FeedbackFilter filter = new FeedbackFilter(dimensions); PeriodFeedbackValue feedbackValue = new PeriodFeedbackValue(periodType, periodValue); return(new MetricPeriodFeedback(MetricFeedbackKind.Period, id, createdOn, userPrincipal, metricId, filter, feedbackValue)); }