protected override void ProcessRecordInternal() { List <MetricDimension> metricDimensions = new List <MetricDimension>(); if (this.DimensionSelection != null && this.DimensionSelection.Length > 0) { foreach (var dimension in this.DimensionSelection) { if (dimension.IncludeValues != null && dimension.IncludeValues.Count() > 0) { metricDimensions.Add(new MetricDimension(dimension.Dimension, "Include", dimension.IncludeValues)); } if (dimension.ExcludeValues != null && dimension.ExcludeValues.Count() > 0) { metricDimensions.Add(new MetricDimension(dimension.Dimension, "Exclude", dimension.ExcludeValues)); } } } else { metricDimensions = null; } IPSMultiMetricCriteria result; if (this.WebTest.IsPresent || !string.IsNullOrWhiteSpace(this.WebTestId)) { WebtestLocationAvailabilityCriteria webtestMetricCriteria = new WebtestLocationAvailabilityCriteria(this.WebTestId, this.ApplicationInsightsId, this.FailedLocationCount); result = new PSWebtestLocationAvailabilityCriteria(webtestMetricCriteria); } else if (this.DynamicThreshold.IsPresent) { DynamicThresholdFailingPeriods failingPeriods = new DynamicThresholdFailingPeriods(this.ExaminedAggregatedPointCount, this.ViolationCount); DynamicMetricCriteria dynamicMetricCriteria = new DynamicMetricCriteria(name: "metric1", metricName: this.MetricName, operatorProperty: this.Operator, timeAggregation: this.TimeAggregation, metricNamespace: this.MetricNamespace, dimensions: metricDimensions, failingPeriods: failingPeriods, alertSensitivity: this.ThresholdSensitivity, ignoreDataBefore: this.IsParameterBound(c => c.IgnoreDataBefore) ? (DateTime?)this.IgnoreDataBefore : null, skipMetricValidation: this.SkipMetricValidation ); result = new PSDynamicMetricCriteria(dynamicMetricCriteria); } else { MetricCriteria metricCriteria = new MetricCriteria(name: "metric1", metricName: this.MetricName, operatorProperty: this.Operator, timeAggregation: this.TimeAggregation, threshold: this.Threshold, metricNamespace: this.MetricNamespace, dimensions: metricDimensions, skipMetricValidation: this.SkipMetricValidation); result = new PSMetricCriteria(metricCriteria); } WriteObject(sendToPipeline: result); }
IWithConditionAttach <MetricAlert.Update.IUpdate> IWithFailingPeriods <MetricAlert.Update.IUpdate> .WithFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) { return(this.WithFailingPeriods(failingPeriods)); }
IUpdateStages IUpdateStages.WithFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) { return(this.WithFailingPeriods(failingPeriods)); }
IWithConditionAttach <MetricAlert.Definition.IWithCreateDynamicCondition> IWithFailingPeriods <MetricAlert.Definition.IWithCreateDynamicCondition> .WithFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) { return(this.WithFailingPeriods(failingPeriods)); }
public MetricDynamicAlertConditionImpl WithFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) { this.Inner.FailingPeriods = failingPeriods; return(this); }