Skip to content

Commit

Permalink
minor fix on monitor dynamic criteria (#857)
Browse files Browse the repository at this point in the history
* minor fix on monitor dynamic criteria

* try with trusty for travis
  • Loading branch information
weidongxu-microsoft authored Oct 10, 2019
1 parent 9f60c18 commit 8812fd2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if: branch = master

dist: trusty
language: java
sudo: required
jdk:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,13 @@ interface Definition extends
*/
interface DefinitionMultipleResource extends
DefinitionStages.Blank,
DefinitionStages.WithCreate,
DefinitionStages.WithCreateDynamicCondition,
DefinitionStages.WithScopes,
DefinitionStages.WithWindowSizeMultipleResource,
DefinitionStages.WithEvaluationFrequencyMultipleResource,
DefinitionStages.WithSeverityMultipleResource,
DefinitionStages.WithActionGroupMultipleResource,
DefinitionStages.WithCriteriaDefinitionMultipleResource,
DefinitionStages.WithCreateDynamicCondition {
DefinitionStages.WithCriteriaDefinitionMultipleResource {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,29 @@ interface UpdateStages {
*/
UpdateStages withoutDimension(String dimensionName);

/**
* Sets the failing periods for triggering the alert.
*
* @param failingPeriods the failing periods for triggering the alert.
* @return the next stage of metric alert condition definition.
*/
UpdateStages withFailingPeriods(DynamicThresholdFailingPeriods failingPeriods);

/**
* Sets the date from which to start learning the metric historical data and calculate the dynamic thresholds.
*
* @param date the date from which to start learning the metric historical data and calculate the dynamic thresholds.
* @return the next stage of metric alert condition definition.
*/
UpdateStages withIgnoreDataBefore(DateTime date);

/**
* Removes the date from which to start learning the metric historical data and calculate the dynamic thresholds.
*
* @return the next stage of the metric alert condition update.
*/
UpdateStages withoutIgnoreDataBefore();

/**
* Returns back to the metric alert update flow.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ public MetricAlertImpl withMultipleTargetResources(Collection<? extends Resource

List<String> resourceIds = new ArrayList<>();
String type = resources.iterator().next().type();
String region = resources.iterator().next().regionName();
String regionName = resources.iterator().next().regionName();
for (Resource resource : resources) {
if (!type.equalsIgnoreCase(resource.type()) || !region.equalsIgnoreCase(resource.regionName())) {
throw new IllegalArgumentException("Target resource must be of same resource type and in same region");
if (!type.equalsIgnoreCase(resource.type()) || !regionName.equalsIgnoreCase(resource.regionName())) {
throw new IllegalArgumentException("Target resource must be of the same resource type and in the same region");
}

resourceIds.add(resource.id());
}
return this.withMultipleTargetResources(resourceIds, type, region);
return this.withMultipleTargetResources(resourceIds, type, regionName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,10 @@ public MetricDynamicAlertConditionImpl withIgnoreDataBefore(DateTime date) {
this.inner().withIgnoreDataBefore(date);
return this;
}

@Override
public MetricDynamicAlertConditionImpl withoutIgnoreDataBefore() {
this.inner().withIgnoreDataBefore(null);
return this;
}
}

0 comments on commit 8812fd2

Please sign in to comment.