MetricsAdvisorAdministrationClient.getMetricAnomalyDetectionConfigWithResponse(String detectionConfigurationId, Context context) Method

Definition

Get the anomaly detection configuration by its id.

Code sample

final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab";
 Response<AnomalyDetectionConfiguration> response = metricsAdvisorAdminClient
     .getMetricAnomalyDetectionConfigWithResponse(detectionConfigId, Context.NONE);
 System.out.printf("Response statusCode: %d%n", response.getStatusCode());
 AnomalyDetectionConfiguration detectionConfig = response.getValue();
 System.out.printf("Detection config Id: %s%n", detectionConfig.getId());
 System.out.printf("Name: %s%n", detectionConfig.getName());
 System.out.printf("Description: %s%n", detectionConfig.getDescription());
 System.out.printf("MetricId: %s%n", detectionConfig.getMetricId());
 
 System.out.printf("Detection conditions specified for configuration...%n");
 
 System.out.printf("Whole Series Detection Conditions:%n");
 MetricWholeSeriesDetectionCondition wholeSeriesDetectionCondition
     = detectionConfig.getWholeSeriesDetectionCondition();
 
 System.out.printf("- Use %s operator for multiple detection conditions:%n",
     wholeSeriesDetectionCondition.getCrossConditionsOperator());
 
 System.out.printf("- Smart Detection Condition:%n");
 System.out.printf(" - Sensitivity: %s%n",
     wholeSeriesDetectionCondition.getSmartDetectionCondition()
         .getSensitivity());
 System.out.printf(" - Detection direction: %s%n",
     wholeSeriesDetectionCondition.getSmartDetectionCondition()
         .getAnomalyDetectorDirection());
 System.out.printf(" - Suppress conditions: minimum number: %s; minimum ratio: %s%n",
     wholeSeriesDetectionCondition.getSmartDetectionCondition()
         .getSuppressCondition().getMinNumber(),
     wholeSeriesDetectionCondition.getSmartDetectionCondition()
         .getSuppressCondition().getMinRatio());
 
 System.out.printf("- Hard Threshold Condition:%n");
 System.out.printf(" - Lower bound: %s%n",
     wholeSeriesDetectionCondition.getHardThresholdCondition()
         .getLowerBound());
 System.out.printf(" - Upper bound: %s%n",
     wholeSeriesDetectionCondition.getHardThresholdCondition()
         .getUpperBound());
 System.out.printf(" - Suppress conditions: minimum number: %s; minimum ratio: %s%n",
     wholeSeriesDetectionCondition.getHardThresholdCondition()
         .getSuppressCondition().getMinNumber(),
     wholeSeriesDetectionCondition.getHardThresholdCondition()
         .getSuppressCondition().getMinRatio());
 
 System.out.printf("- Change Threshold Condition:%n");
 System.out.printf(" - Change percentage: %s%n",
     wholeSeriesDetectionCondition.getChangeThresholdCondition()
         .getChangePercentage());
 System.out.printf(" - Shift point: %s%n",
     wholeSeriesDetectionCondition.getChangeThresholdCondition()
         .getShiftPoint());
 System.out.printf(" - Detect anomaly if within range: %s%n",
     wholeSeriesDetectionCondition.getChangeThresholdCondition()
         .isWithinRange());
 System.out.printf(" - Suppress conditions: minimum number: %s; minimum ratio: %s%n",
     wholeSeriesDetectionCondition.getChangeThresholdCondition()
         .getSuppressCondition().getMinNumber(),
     wholeSeriesDetectionCondition.getChangeThresholdCondition()
         .getSuppressCondition().getMinRatio());
 
 List<MetricSingleSeriesDetectionCondition> seriesDetectionConditions
     = detectionConfig.getSeriesDetectionConditions();
 System.out.printf("Series Detection Conditions:%n");
 for (MetricSingleSeriesDetectionCondition seriesDetectionCondition : seriesDetectionConditions) {
     DimensionKey seriesKey = seriesDetectionCondition.getSeriesKey();
     final String seriesKeyStr
         = Arrays.toString(seriesKey.asMap().entrySet().toArray());
     System.out.printf("- Series Key:%s%n", seriesKeyStr);
     System.out.printf(" - Use %s operator for multiple detection conditions:%n",
         seriesDetectionCondition.getCrossConditionsOperator());
 
     System.out.printf(" - Smart Detection Condition:%n");
     System.out.printf("  - Sensitivity: %s%n",
         seriesDetectionCondition.getSmartDetectionCondition()
             .getSensitivity());
     System.out.printf("  - Detection direction: %s%n",
         seriesDetectionCondition.getSmartDetectionCondition()
             .getAnomalyDetectorDirection());
     System.out.printf("  - Suppress conditions: minimum number: %s; minimum ratio: %s%n",
         seriesDetectionCondition.getSmartDetectionCondition()
             .getSuppressCondition().getMinNumber(),
         seriesDetectionCondition.getSmartDetectionCondition()
             .getSuppressCondition().getMinRatio());
 
     System.out.printf(" - Hard Threshold Condition:%n");
     System.out.printf("  -  Lower bound: %s%n",
         seriesDetectionCondition.getHardThresholdCondition()
             .getLowerBound());
     System.out.printf("  -  Upper bound: %s%n",
         seriesDetectionCondition.getHardThresholdCondition()
             .getUpperBound());
     System.out.printf("  -  Suppress conditions: minimum number: %s; minimum ratio: %s%n",
         seriesDetectionCondition.getHardThresholdCondition()
             .getSuppressCondition().getMinNumber(),
         seriesDetectionCondition.getHardThresholdCondition()
             .getSuppressCondition().getMinRatio());
 
     System.out.printf(" - Change Threshold Condition:%n");
     System.out.printf("  -  Change percentage: %s%n",
         seriesDetectionCondition.getChangeThresholdCondition()
             .getChangePercentage());
     System.out.printf("  -  Shift point: %s%n",
         seriesDetectionCondition.getChangeThresholdCondition()
             .getShiftPoint());
     System.out.printf("  -  Detect anomaly if within range: %s%n",
         seriesDetectionCondition.getChangeThresholdCondition()
             .isWithinRange());
     System.out.printf("  -  Suppress conditions: minimum number: %s; minimum ratio: %s%n",
         seriesDetectionCondition.getChangeThresholdCondition()
             .getSuppressCondition().getMinNumber(),
         seriesDetectionCondition.getChangeThresholdCondition()
             .getSuppressCondition().getMinRatio());
 }
 
 List<MetricSeriesGroupDetectionCondition> seriesGroupDetectionConditions
     = detectionConfig.getSeriesGroupDetectionConditions();
 System.out.printf("Series Group Detection Conditions:%n");
 for (MetricSeriesGroupDetectionCondition seriesGroupDetectionCondition
     : seriesGroupDetectionConditions) {
     DimensionKey seriesGroupKey = seriesGroupDetectionCondition.getSeriesGroupKey();
     final String seriesGroupKeyStr
         = Arrays.toString(seriesGroupKey.asMap().entrySet().toArray());
     System.out.printf("- Series Group Key:%s%n", seriesGroupKeyStr);
     System.out.printf(" - Use %s operator for multiple detection conditions:%n",
         seriesGroupDetectionCondition.getCrossConditionsOperator());
 
     System.out.printf(" - Smart Detection Condition:%n");
     System.out.printf("  - Sensitivity: %s%n",
         seriesGroupDetectionCondition.getSmartDetectionCondition()
             .getSensitivity());
     System.out.printf("  - Detection direction: %s%n",
         seriesGroupDetectionCondition.getSmartDetectionCondition()
             .getAnomalyDetectorDirection());
     System.out.printf("  - Suppress conditions: minimum number: %s; minimum ratio: %s%n",
         seriesGroupDetectionCondition.getSmartDetectionCondition()
             .getSuppressCondition().getMinNumber(),
         seriesGroupDetectionCondition.getSmartDetectionCondition()
             .getSuppressCondition().getMinRatio());
 
     System.out.printf(" - Hard Threshold Condition:%n");
     System.out.printf("  -  Lower bound: %s%n",
         seriesGroupDetectionCondition.getHardThresholdCondition()
             .getLowerBound());
     System.out.printf("  -  Upper bound: %s%n",
         seriesGroupDetectionCondition.getHardThresholdCondition()
             .getUpperBound());
     System.out.printf("  -  Suppress conditions: minimum number: %s; minimum ratio: %s%n",
         seriesGroupDetectionCondition.getHardThresholdCondition()
             .getSuppressCondition().getMinNumber(),
         seriesGroupDetectionCondition.getHardThresholdCondition()
             .getSuppressCondition().getMinRatio());
 
     System.out.printf(" - Change Threshold Condition:%n");
     System.out.printf("  -  Change percentage: %s%n",
         seriesGroupDetectionCondition.getChangeThresholdCondition()
             .getChangePercentage());
     System.out.printf("  -  Shift point: %s%n",
         seriesGroupDetectionCondition.getChangeThresholdCondition()
             .getShiftPoint());
     System.out.printf("  -  Detect anomaly if within range: %s%n",
         seriesGroupDetectionCondition.getChangeThresholdCondition()
             .isWithinRange());
     System.out.printf("  -  Suppress conditions: minimum number: %s; minimum ratio: %s%n",
         seriesGroupDetectionCondition.getChangeThresholdCondition()
             .getSuppressCondition().getMinNumber(),
         seriesGroupDetectionCondition.getChangeThresholdCondition()
             .getSuppressCondition().getMinRatio());
 }
public Response<AnomalyDetectionConfiguration> getMetricAnomalyDetectionConfigWithResponse(String detectionConfigurationId, Context context)

Parameters

detectionConfigurationId
java.lang.String

The anomaly detection configuration id.

context
Context

Additional context that is passed through the Http pipeline during the service call.

Returns

Applies to