Class MetricsAdvisorAdministrationAsyncClient
Instantiating a asynchronous Metrics Advisor Administration Client
MetricsAdvisorAdministrationAsyncClient metricsAdvisorAdminAsyncClient = new MetricsAdvisorAdministrationClientBuilder() .credential(new MetricsAdvisorKeyCredential("{subscription_key}", "{api_key}")) .endpoint("{endpoint}") .buildAsyncClient();
-
Method Summary
Modifier and TypeMethodDescriptioncreateAlertConfig
(AnomalyAlertConfiguration alertConfiguration) Create a configuration to trigger alert when anomalies are detected.createAlertConfigWithResponse
(AnomalyAlertConfiguration alertConfiguration) Code samplecreateDataFeed
(DataFeed dataFeed) Create a new data feed.createDataFeedWithResponse
(DataFeed dataFeed) Create a new data feed with REST response.createDataSourceCredential
(DataSourceCredentialEntity dataSourceCredential) Create a data source credential entity.createDataSourceCredentialWithResponse
(DataSourceCredentialEntity dataSourceCredential) Create a data source credential entity with REST response.createDetectionConfig
(String metricId, AnomalyDetectionConfiguration detectionConfiguration) Create a configuration to detect anomalies in the time series of a metric.createDetectionConfigWithResponse
(String metricId, AnomalyDetectionConfiguration detectionConfiguration) Create a configuration to detect anomalies in the time series of a metric.createHook
(NotificationHook notificationHook) Creates a notificationHook that receives anomaly incident alerts.createHookWithResponse
(NotificationHook notificationHook) Creates a notificationHook that receives anomaly incident alerts.deleteAlertConfig
(String alertConfigurationId) Deletes the anomaly alert configuration identified byalertConfigurationId
.deleteAlertConfigWithResponse
(String alertConfigurationId) Deletes the anomaly alert configuration identified byalertConfigurationId
.deleteDataFeed
(String dataFeedId) Delete a data feed.deleteDataFeedWithResponse
(String dataFeedId) Delete a data feed with REST response.deleteDataSourceCredential
(String credentialId) Deletes the data source credential entity identified bycredentialId
.deleteDataSourceCredentialWithResponse
(String credentialId) Deletes the data source credential entity identified bycredentialId
.deleteDetectionConfig
(String detectionConfigurationId) Delete a metric anomaly detection configuration.deleteDetectionConfigWithResponse
(String detectionConfigurationId) Delete a metric anomaly detection configuration.deleteHook
(String hookId) Delete a hook.deleteHookWithResponse
(String hookId) Delete a hook.getAlertConfig
(String alertConfigurationId) Get the anomaly alert configuration identified byalertConfigurationId
.getAlertConfigWithResponse
(String alertConfigurationId) Get the anomaly alert configuration identified byalertConfigurationId
.getDataFeed
(String dataFeedId) Get a data feed by its id.getDataFeedIngestionProgress
(String dataFeedId) Retrieve the ingestion progress of a data feed.getDataFeedIngestionProgressWithResponse
(String dataFeedId) Retrieve the ingestion progress of a data feed.getDataFeedWithResponse
(String dataFeedId) Get a data feed by its id with REST response.getDataSourceCredential
(String credentialId) Get a data source credential entity by its id.getDataSourceCredentialWithResponse
(String credentialId) Get a data source credential entity by its id with REST response.getDetectionConfig
(String detectionConfigurationId) Get the anomaly detection configuration by its id.getDetectionConfigWithResponse
(String detectionConfigurationId) Get the anomaly detection configuration by its id.Get a hook by its id.getHookWithResponse
(String hookId) Get a hook by its id.listAlertConfigs
(String detectionConfigurationId, ListAnomalyAlertConfigsOptions listAnomalyAlertConfigsOptions) Fetch the anomaly alert configurations associated with a detection configuration.listDataFeedIngestionStatus
(String dataFeedId, ListDataFeedIngestionOptions listDataFeedIngestionOptions) Fetch the ingestion status of a data feed.List information of all data feeds on the metrics advisor account.listDataFeeds
(ListDataFeedOptions listDataFeedOptions) List information of all data feeds on the metrics advisor account.List information of all data source credential entities on the metrics advisor account.listDataSourceCredentials
(ListCredentialEntityOptions listCredentialEntityOptions) List information of all data source credential entities on the metrics advisor account.listDetectionConfigs
(String metricId) Given a metric id, retrieve all anomaly detection configurations applied to it.listDetectionConfigs
(String metricId, ListDetectionConfigsOptions listDetectionConfigsOptions) Given a metric id, retrieve all anomaly detection configurations applied to it.List information of hooks on the metrics advisor account.listHooks
(ListHookOptions listHookOptions) List information of hooks.refreshDataFeedIngestion
(String dataFeedId, OffsetDateTime startTime, OffsetDateTime endTime) Refresh data ingestion for a period.refreshDataFeedIngestionWithResponse
(String dataFeedId, OffsetDateTime startTime, OffsetDateTime endTime) Refresh data ingestion for a period.updateAlertConfig
(AnomalyAlertConfiguration alertConfiguration) Update anomaly alert configuration.updateAlertConfigWithResponse
(AnomalyAlertConfiguration alertConfiguration) Update anomaly alert configuration.updateDataFeed
(DataFeed dataFeed) Update an existing data feed.updateDataFeedWithResponse
(DataFeed dataFeed) Update an existing data feed with REST response.updateDataSourceCredential
(DataSourceCredentialEntity dataSourceCredential) Update a data source credential entity.updateDataSourceCredentialWithResponse
(DataSourceCredentialEntity dataSourceCredential) Update a data source credential entity with REST response.updateDetectionConfig
(AnomalyDetectionConfiguration detectionConfiguration) Update a configuration to detect anomalies in the time series of a metric.updateDetectionConfigWithResponse
(AnomalyDetectionConfiguration detectionConfiguration) Update a configuration to detect anomalies in the time series of a metric.updateHook
(NotificationHook notificationHook) Update an existing notificationHook.updateHookWithResponse
(NotificationHook notificationHook) Update an existing notification hook.
-
Method Details
-
createDataFeed
Create a new data feed.Code sample
DataFeed dataFeed = new DataFeed() .setName("dataFeedName") .setSource(new MySqlDataFeedSource("conn-string", "query")) .setGranularity(new DataFeedGranularity().setGranularityType(DataFeedGranularityType.DAILY)) .setSchema(new DataFeedSchema( Arrays.asList( new DataFeedMetric("cost"), new DataFeedMetric("revenue") )).setDimensions( Arrays.asList( new DataFeedDimension("city"), new DataFeedDimension("category") )) ) .setIngestionSettings(new DataFeedIngestionSettings(OffsetDateTime.parse("2020-01-01T00:00:00Z"))) .setOptions(new DataFeedOptions() .setDescription("data feed description") .setRollupSettings(new DataFeedRollupSettings() .setRollupType(DataFeedRollupType.AUTO_ROLLUP))); metricsAdvisorAdminAsyncClient.createDataFeed(dataFeed) .subscribe(createdDataFeed -> { System.out.printf("Data feed Id: %s%n", createdDataFeed.getId()); System.out.printf("Data feed description: %s%n", createdDataFeed.getOptions().getDescription()); System.out.printf("Data feed source type: %s%n", createdDataFeed.getSourceType()); System.out.printf("Data feed creator: %s%n", createdDataFeed.getCreator()); });
- Parameters:
dataFeed
- The data feed to be created.- Returns:
- A
Mono
containing the created data feed. - Throws:
NullPointerException
- IfdataFeed
,dataFeedName
,dataFeedSource
,metrics
,granularityType
oringestionStartTime
is null.
-
createDataFeedWithResponse
Create a new data feed with REST response.Code sample
DataFeed dataFeed = new DataFeed() .setName("dataFeedName") .setSource(new MySqlDataFeedSource("conn-string", "query")) .setGranularity(new DataFeedGranularity().setGranularityType(DataFeedGranularityType.DAILY)) .setSchema(new DataFeedSchema( Arrays.asList( new DataFeedMetric("metric1"), new DataFeedMetric("metric2") ) )) .setIngestionSettings(new DataFeedIngestionSettings(OffsetDateTime.parse("2020-01-01T00:00:00Z"))) .setOptions(new DataFeedOptions() .setDescription("data feed description") .setRollupSettings(new DataFeedRollupSettings() .setRollupType(DataFeedRollupType.AUTO_ROLLUP))); metricsAdvisorAdminAsyncClient.createDataFeedWithResponse(dataFeed) .subscribe(dataFeedResponse -> { System.out.printf("Data feed create operation status: %s%n", dataFeedResponse.getStatusCode()); DataFeed createdDataFeed = dataFeedResponse.getValue(); System.out.printf("Data feed Id: %s%n", createdDataFeed.getId()); System.out.printf("Data feed description: %s%n", createdDataFeed.getOptions().getDescription()); System.out.printf("Data feed source type: %s%n", createdDataFeed.getSourceType()); System.out.printf("Data feed creator: %s%n", createdDataFeed.getCreator()); });
- Parameters:
dataFeed
- The data feed to be created.- Returns:
- A
Response
of aMono
containing the createddata feed
. - Throws:
NullPointerException
- IfdataFeed
,dataFeedName
,dataFeedSource
,metrics
,granularityType
oringestionStartTime
is null.
-
getDataFeed
Get a data feed by its id.Code sample
final String dataFeedId = "r47053f1-9080-09lo-bacf-8dccf2e86f"; metricsAdvisorAdminAsyncClient.getDataFeed(dataFeedId) .subscribe(dataFeed -> { System.out.printf("Data feed Id: %s%n", dataFeed.getId()); System.out.printf("Data feed description: %s%n", dataFeed.getOptions().getDescription()); System.out.printf("Data feed source type: %s%n", dataFeed.getSourceType()); System.out.printf("Data feed creator: %s%n", dataFeed.getCreator()); });
- Parameters:
dataFeedId
- The data feed unique id.- Returns:
- The data feed for the provided id.
- Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- thrown if thedataFeedId
is null.
-
getDataFeedWithResponse
Get a data feed by its id with REST response.Code sample
final String dataFeedId = "r47053f1-9080-09lo-bacf-8dccf2e86f"; metricsAdvisorAdminAsyncClient.getDataFeedWithResponse(dataFeedId) .subscribe(dataFeedResponse -> { System.out.printf("Data feed get operation status: %s%n", dataFeedResponse.getStatusCode()); DataFeed dataFeed = dataFeedResponse.getValue(); System.out.printf("Data feed Id: %s%n", dataFeed.getId()); System.out.printf("Data feed description: %s%n", dataFeed.getOptions().getDescription()); System.out.printf("Data feed source type: %s%n", dataFeed.getSourceType()); System.out.printf("Data feed creator: %s%n", dataFeed.getCreator()); });
- Parameters:
dataFeedId
- The data feed unique id.- Returns:
- The data feed for the provided id.
- Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- thrown if thedataFeedId
is null.
-
updateDataFeed
Update an existing data feed.Code sample
final String dataFeedId = "r47053f1-9080-09lo-bacf-8dccf2e86f"; metricsAdvisorAdminAsyncClient.getDataFeed(dataFeedId) .flatMap(existingDataFeed -> { return metricsAdvisorAdminAsyncClient.updateDataFeed( existingDataFeed .setOptions(new DataFeedOptions() .setDescription("set updated description")) ); }) .subscribe(updatedDataFeed -> { System.out.printf("Data feed Id: %s%n", updatedDataFeed.getId()); System.out.printf("Data feed updated description: %s%n", updatedDataFeed.getOptions().getDescription()); });
- Parameters:
dataFeed
- the data feed that needs to be updated.- Returns:
- the updated data feed.
-
updateDataFeedWithResponse
Update an existing data feed with REST response.Code sample
final String dataFeedId = "r47053f1-9080-09lo-bacf-8dccf2e86f"; metricsAdvisorAdminAsyncClient.getDataFeed(dataFeedId) .flatMap(existingDataFeed -> { return metricsAdvisorAdminAsyncClient.updateDataFeedWithResponse( existingDataFeed .setOptions(new DataFeedOptions() .setDescription("set updated description")) ); }) .subscribe(dataFeedResponse -> { System.out.printf("Data feed update operation status: %s%n", dataFeedResponse.getStatusCode()); DataFeed updatedDataFeed = dataFeedResponse.getValue(); System.out.printf("Data feed Id: %s%n", updatedDataFeed.getId()); System.out.printf("Data feed updated description: %s%n", updatedDataFeed.getOptions().getDescription()); });
-
deleteDataFeed
Delete a data feed.Code sample
final String dataFeedId = "t00853f1-9080-447f-bacf-8dccf2e86f"; metricsAdvisorAdminAsyncClient.deleteDataFeed(dataFeedId);
- Parameters:
dataFeedId
- The data feed unique id.- Returns:
- An empty Mono.
- Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- thrown if thedataFeedId
is null.
-
deleteDataFeedWithResponse
Delete a data feed with REST response.Code sample
final String dataFeedId = "eh0854f1-8927-447f-bacf-8dccf2e86fwe"; metricsAdvisorAdminAsyncClient.deleteDataFeedWithResponse(dataFeedId) .subscribe(response -> System.out.printf("Data feed delete operation status : %s%n", response.getStatusCode()));
- Parameters:
dataFeedId
- The data feed unique id.- Returns:
- A response containing status code and headers returned after the operation.
- Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- thrown if thedataFeedId
is null.
-
listDataFeeds
List information of all data feeds on the metrics advisor account.Code sample
metricsAdvisorAdminAsyncClient.listDataFeeds() .subscribe(dataFeed -> { System.out.printf("Data feed Id: %s%n", dataFeed.getId()); System.out.printf("Data feed description: %s%n", dataFeed.getOptions().getDescription()); System.out.printf("Data feed source type: %s%n", dataFeed.getSourceType()); System.out.printf("Data feed creator: %s%n", dataFeed.getCreator()); });
- Returns:
- A
PagedFlux
containing information of all thedata feeds
in the account.
-
listDataFeeds
List information of all data feeds on the metrics advisor account.Code sample
metricsAdvisorAdminAsyncClient.listDataFeeds( new ListDataFeedOptions() .setListDataFeedFilter( new ListDataFeedFilter() .setDataFeedStatus(DataFeedStatus.ACTIVE) .setDataFeedGranularityType(DataFeedGranularityType.DAILY)) .setMaxPageSize(3)) .subscribe(dataFeed -> { System.out.printf("Data feed Id: %s%n", dataFeed.getId()); System.out.printf("Data feed description: %s%n", dataFeed.getOptions().getDescription()); System.out.printf("Data feed source type: %s%n", dataFeed.getSourceType()); System.out.printf("Data feed creator: %s%n", dataFeed.getCreator()); System.out.printf("Data feed status: %s%n", dataFeed.getStatus()); System.out.printf("Data feed granularity type: %s%n", dataFeed.getGranularity().getGranularityType()); });
- Parameters:
listDataFeedOptions
- The configurableoptions
to pass for filtering the output result.- Returns:
- A
PagedFlux
containing information of all thedata feeds
in the account.
-
listDataFeedIngestionStatus
public PagedFlux<DataFeedIngestionStatus> listDataFeedIngestionStatus(String dataFeedId, ListDataFeedIngestionOptions listDataFeedIngestionOptions) Fetch the ingestion status of a data feed.Code sample
final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-09-09T00:00:00Z"); final ListDataFeedIngestionOptions options = new ListDataFeedIngestionOptions(startTime, endTime); metricsAdvisorAdminAsyncClient.listDataFeedIngestionStatus(dataFeedId, options) .subscribe(ingestionStatus -> { System.out.printf("Timestamp: %s%n", ingestionStatus.getTimestamp()); System.out.printf("Status: %s%n", ingestionStatus.getStatus()); System.out.printf("Message: %s%n", ingestionStatus.getMessage()); });
- Parameters:
dataFeedId
- The data feed id.listDataFeedIngestionOptions
- The additional parameters.- Returns:
- The ingestion statuses.
- Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- IfdataFeedId
,options
,options.startTime
,options.endTime
is null.
-
refreshDataFeedIngestion
public Mono<Void> refreshDataFeedIngestion(String dataFeedId, OffsetDateTime startTime, OffsetDateTime endTime) Refresh data ingestion for a period.The data in the data source for the given period will be reingested and any ingested data for the same period will be overwritten.
Code sample
final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-03-03T00:00:00Z"); metricsAdvisorAdminAsyncClient.refreshDataFeedIngestion(dataFeedId, startTime, endTime).subscribe();
- Parameters:
dataFeedId
- The data feed id.startTime
- The start point of the period.endTime
- The end point of of the period.- Returns:
- A
Mono
indicating ingestion reset success or failure. - Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- IfdataFeedId
,startTime
,endTime
is null.
-
refreshDataFeedIngestionWithResponse
public Mono<Response<Void>> refreshDataFeedIngestionWithResponse(String dataFeedId, OffsetDateTime startTime, OffsetDateTime endTime) Refresh data ingestion for a period.The data in the data source for the given period will be reingested and any ingested data for the same period will be overwritten.
Code sample
final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; final OffsetDateTime startTime = OffsetDateTime.parse("2020-01-01T00:00:00Z"); final OffsetDateTime endTime = OffsetDateTime.parse("2020-03-03T00:00:00Z"); metricsAdvisorAdminAsyncClient.refreshDataFeedIngestionWithResponse(dataFeedId, startTime, endTime) .subscribe(response -> { System.out.printf("Response statusCode: %d%n", response.getStatusCode()); });
- Parameters:
dataFeedId
- The data feed id.startTime
- The start point of the period.endTime
- The end point of of the period.- Returns:
- A
Response
of aMono
with result of reset request. - Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- IfdataFeedId
,startTime
,endTime
is null.
-
getDataFeedIngestionProgress
Retrieve the ingestion progress of a data feed.Code sample
final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; metricsAdvisorAdminAsyncClient.getDataFeedIngestionProgress(dataFeedId) .subscribe(ingestionProgress -> { System.out.printf("Latest active timestamp: %s%n", ingestionProgress.getLatestActiveTimestamp()); System.out.printf("Latest successful timestamp: %s%n", ingestionProgress.getLatestSuccessTimestamp()); });
- Parameters:
dataFeedId
- The data feed id.- Returns:
- A
Mono
containingDataFeedIngestionProgress
of the data feed. - Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- thrown if thedataFeedId
is null.
-
getDataFeedIngestionProgressWithResponse
public Mono<Response<DataFeedIngestionProgress>> getDataFeedIngestionProgressWithResponse(String dataFeedId) Retrieve the ingestion progress of a data feed.Code sample
final String dataFeedId = "4957a2f7-a0f4-4fc0-b8d7-d866c1df0f4c"; metricsAdvisorAdminAsyncClient.getDataFeedIngestionProgressWithResponse(dataFeedId, Context.NONE) .subscribe(response -> { System.out.printf("Response statusCode: %d%n", response.getStatusCode()); DataFeedIngestionProgress ingestionProgress = response.getValue(); System.out.printf("Latest active timestamp: %s%n", ingestionProgress.getLatestActiveTimestamp()); System.out.printf("Latest successful timestamp: %s%n", ingestionProgress.getLatestSuccessTimestamp()); });
- Parameters:
dataFeedId
- The data feed id.- Returns:
- A
Response
of aMono
containingDataFeedIngestionProgress
of the data feed. - Throws:
IllegalArgumentException
- IfdataFeedId
does not conform to the UUID format specification.NullPointerException
- thrown if thedataFeedId
is null.
-
createDetectionConfig
public Mono<AnomalyDetectionConfiguration> createDetectionConfig(String metricId, AnomalyDetectionConfiguration detectionConfiguration) Create a configuration to detect anomalies in the time series of a metric.Code sample
final MetricWholeSeriesDetectionCondition wholeSeriesCondition = new MetricWholeSeriesDetectionCondition() .setConditionOperator(DetectionConditionOperator.OR) .setSmartDetectionCondition(new SmartDetectionCondition( 50, AnomalyDetectorDirection.BOTH, new SuppressCondition(50, 50))) .setHardThresholdCondition(new HardThresholdCondition( AnomalyDetectorDirection.BOTH, new SuppressCondition(5, 5)) .setLowerBound(0.0) .setUpperBound(100.0)) .setChangeThresholdCondition(new ChangeThresholdCondition( 50, 30, true, AnomalyDetectorDirection.BOTH, new SuppressCondition(2, 2))); final String detectionConfigName = "my_detection_config"; final String detectionConfigDescription = "anomaly detection config for metric"; final AnomalyDetectionConfiguration detectionConfig = new AnomalyDetectionConfiguration(detectionConfigName) .setDescription(detectionConfigDescription) .setWholeSeriesDetectionCondition(wholeSeriesCondition); final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; metricsAdvisorAdminAsyncClient .createDetectionConfig(metricId, detectionConfig) .subscribe(createdDetectionConfig -> { System.out.printf("Detection config Id: %s%n", createdDetectionConfig.getId()); System.out.printf("Name: %s%n", createdDetectionConfig.getName()); System.out.printf("Description: %s%n", createdDetectionConfig.getDescription()); System.out.printf("MetricId: %s%n", createdDetectionConfig.getMetricId()); });
- Parameters:
metricId
- The metric id to associate the configuration with.detectionConfiguration
- The anomaly detection configuration.- Returns:
- A
Mono
containing the createdAnomalyDetectionConfiguration
. - Throws:
IllegalArgumentException
- IfmetricId
does not conform to the UUID format specification, ordetectionConfiguration.name
is not set.NullPointerException
- thrown if themetricId
is null ordetectionConfiguration
is null ordetectionConfiguration.wholeSeriesCondition
is null orseriesKey
is missing for anyMetricSingleSeriesDetectionCondition
in the configuration orseriesGroupKey
is missing for anyMetricSeriesGroupDetectionCondition
in the configuration orconditionOperator
is missing when multiple nested conditions are set in aMetricSingleSeriesDetectionCondition
orMetricSeriesGroupDetectionCondition
.
-
createDetectionConfigWithResponse
public Mono<Response<AnomalyDetectionConfiguration>> createDetectionConfigWithResponse(String metricId, AnomalyDetectionConfiguration detectionConfiguration) Create a configuration to detect anomalies in the time series of a metric.Code sample
final MetricWholeSeriesDetectionCondition wholeSeriesCondition = new MetricWholeSeriesDetectionCondition() .setConditionOperator(DetectionConditionOperator.OR) .setSmartDetectionCondition(new SmartDetectionCondition( 50, AnomalyDetectorDirection.BOTH, new SuppressCondition(50, 50))) .setHardThresholdCondition(new HardThresholdCondition( AnomalyDetectorDirection.BOTH, new SuppressCondition(5, 5)) .setLowerBound(0.0) .setUpperBound(100.0)) .setChangeThresholdCondition(new ChangeThresholdCondition( 50, 30, true, AnomalyDetectorDirection.BOTH, new SuppressCondition(2, 2))); final String detectionConfigName = "my_detection_config"; final String detectionConfigDescription = "anomaly detection config for metric"; final AnomalyDetectionConfiguration detectionConfig = new AnomalyDetectionConfiguration(detectionConfigName) .setDescription(detectionConfigDescription) .setWholeSeriesDetectionCondition(wholeSeriesCondition); final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; metricsAdvisorAdminAsyncClient .createDetectionConfigWithResponse(metricId, detectionConfig) .subscribe(response -> { System.out.printf("Response statusCode: %d%n", response.getStatusCode()); AnomalyDetectionConfiguration createdDetectionConfig = response.getValue(); System.out.printf("Detection config Id: %s%n", createdDetectionConfig.getId()); System.out.printf("Name: %s%n", createdDetectionConfig.getName()); System.out.printf("Description: %s%n", createdDetectionConfig.getDescription()); System.out.printf("MetricId: %s%n", createdDetectionConfig.getMetricId()); });
- Parameters:
metricId
- The metric id to associate the configuration with.detectionConfiguration
- The anomaly detection configuration.- Returns:
- A
Response
of aMono
containing the createdAnomalyDetectionConfiguration
. - Throws:
IllegalArgumentException
- IfmetricId
does not conform to the UUID format specification, ordetectionConfiguration.name
is not set.NullPointerException
- thrown if themetricId
is null ordetectionConfiguration
is null ordetectionConfiguration.wholeSeriesCondition
is null orseriesKey
is missing for anyMetricSingleSeriesDetectionCondition
in the configuration orseriesGroupKey
is missing for anyMetricSeriesGroupDetectionCondition
in the configuration orconditionOperator
is missing when multiple nested conditions are set in aMetricSingleSeriesDetectionCondition
orMetricSeriesGroupDetectionCondition
.
-
getDetectionConfig
Get the anomaly detection configuration by its id.Code sample
final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab"; metricsAdvisorAdminAsyncClient .getDetectionConfig(detectionConfigId) .subscribe(detectionConfig -> { 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.getConditionOperator()); 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().stream().toArray()); System.out.printf("- Series Key: %s%n", seriesKeyStr); System.out.printf(" - Use %s operator for multiple detection conditions:%n", seriesDetectionCondition.getConditionOperator()); 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().stream().toArray()); System.out.printf("- Series Group Key: %s%n", seriesGroupKeyStr); System.out.printf(" - Use %s operator for multiple detection conditions:%n", seriesGroupDetectionCondition.getConditionOperator()); 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()); } });
- Parameters:
detectionConfigurationId
- The anomaly detection configuration id.- Returns:
- A
Mono
containing theAnomalyDetectionConfiguration
for the provided id. - Throws:
IllegalArgumentException
- IfdetectionConfigurationId
does not conform to the UUID format specification.NullPointerException
- thrown if thedetectionConfigurationId
is null.
-
getDetectionConfigWithResponse
public Mono<Response<AnomalyDetectionConfiguration>> getDetectionConfigWithResponse(String detectionConfigurationId) Get the anomaly detection configuration by its id.Code sample
final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab"; metricsAdvisorAdminAsyncClient .getDetectionConfigWithResponse(detectionConfigId) .subscribe(response -> { 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.getConditionOperator()); 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().stream().toArray()); System.out.printf("- Series Key: %s%n", seriesKeyStr); System.out.printf(" - Use %s operator for multiple detection conditions:%n", seriesDetectionCondition.getConditionOperator()); 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().stream().toArray()); System.out.printf("- Series Group Key: %s%n", seriesGroupKeyStr); System.out.printf(" - Use %s operator for multiple detection conditions:%n", seriesGroupDetectionCondition.getConditionOperator()); 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()); } });
- Parameters:
detectionConfigurationId
- The anomaly detection configuration id.- Returns:
- A
Response
of aMono
containing theAnomalyDetectionConfiguration
for the provided id. - Throws:
IllegalArgumentException
- IfdetectionConfigurationId
does not conform to the UUID format specification.NullPointerException
- thrown if thedetectionConfigurationId
is null.
-
updateDetectionConfig
public Mono<AnomalyDetectionConfiguration> updateDetectionConfig(AnomalyDetectionConfiguration detectionConfiguration) Update a configuration to detect anomalies in the time series of a metric.Code sample
final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab"; metricsAdvisorAdminAsyncClient .getDetectionConfig(detectionConfigId) .flatMap(detectionConfig -> { detectionConfig.setName("updated config name"); detectionConfig.setDescription("updated with more detection conditions"); DimensionKey seriesGroupKey = new DimensionKey() .put("city", "Seoul"); detectionConfig.addSeriesGroupDetectionCondition( new MetricSeriesGroupDetectionCondition(seriesGroupKey) .setSmartDetectionCondition(new SmartDetectionCondition( 10.0, AnomalyDetectorDirection.UP, new SuppressCondition(2, 2)))); return metricsAdvisorAdminAsyncClient .updateDetectionConfig(detectionConfig); }) .subscribe(updatedDetectionConfig -> { System.out.printf("Detection config Id: %s%n", updatedDetectionConfig.getId()); System.out.printf("Name: %s%n", updatedDetectionConfig.getName()); System.out.printf("Description: %s%n", updatedDetectionConfig.getDescription()); System.out.printf("MetricId: %s%n", updatedDetectionConfig.getMetricId()); });
- Parameters:
detectionConfiguration
- The anomaly detection configuration.- Returns:
- A
Mono
containing the updatedAnomalyDetectionConfiguration
. - Throws:
NullPointerException
- thrown if thedetectionConfiguration
is null ordetectionConfiguration.id
is null.
-
updateDetectionConfigWithResponse
public Mono<Response<AnomalyDetectionConfiguration>> updateDetectionConfigWithResponse(AnomalyDetectionConfiguration detectionConfiguration) Update a configuration to detect anomalies in the time series of a metric.Code sample
final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab"; metricsAdvisorAdminAsyncClient .getDetectionConfigWithResponse(detectionConfigId) .flatMap(response -> { AnomalyDetectionConfiguration detectionConfig = response.getValue(); detectionConfig.setName("updated config name"); detectionConfig.setDescription("updated with more detection conditions"); DimensionKey seriesGroupKey = new DimensionKey() .put("city", "Seoul"); detectionConfig.addSeriesGroupDetectionCondition( new MetricSeriesGroupDetectionCondition(seriesGroupKey) .setSmartDetectionCondition(new SmartDetectionCondition( 10.0, AnomalyDetectorDirection.UP, new SuppressCondition(2, 2)))); return metricsAdvisorAdminAsyncClient .updateDetectionConfigWithResponse(detectionConfig); }) .subscribe(response -> { AnomalyDetectionConfiguration updatedDetectionConfig = response.getValue(); System.out.printf("Detection config Id: %s%n", updatedDetectionConfig.getId()); System.out.printf("Name: %s%n", updatedDetectionConfig.getName()); System.out.printf("Description: %s%n", updatedDetectionConfig.getDescription()); System.out.printf("MetricId: %s%n", updatedDetectionConfig.getMetricId()); });
- Parameters:
detectionConfiguration
- The anomaly detection configuration.- Returns:
- A
Response
of aMono
containing the updatedAnomalyDetectionConfiguration
. - Throws:
NullPointerException
- thrown if thedetectionConfiguration
is null ordetectionConfiguration.id
is null.
-
deleteDetectionConfig
Delete a metric anomaly detection configuration.- Parameters:
detectionConfigurationId
- The metric anomaly detection configuration unique id.Code sample
final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab"; metricsAdvisorAdminAsyncClient .deleteDetectionConfig(detectionConfigId) .subscribe();
- Returns:
- An empty Mono.
- Throws:
NullPointerException
- thrown if thedetectionConfigurationId
is null.IllegalArgumentException
- IfdetectionConfigurationId
does not conform to the UUID format specification.
-
deleteDetectionConfigWithResponse
Delete a metric anomaly detection configuration.Code sample
final String detectionConfigId = "7b8069a1-1564-46da-9f50-b5d0dd9129ab"; metricsAdvisorAdminAsyncClient .deleteDetectionConfigWithResponse(detectionConfigId) .subscribe(response -> System.out.printf("Response statusCode: %d%n", response.getStatusCode()));
- Parameters:
detectionConfigurationId
- The metric anomaly detection configuration unique id.- Returns:
- A
Response
of aMono
. - Throws:
NullPointerException
- thrown if thedetectionConfigurationId
is null.IllegalArgumentException
- IfdetectionConfigurationId
does not conform to the UUID format specification.
-
listDetectionConfigs
Given a metric id, retrieve all anomaly detection configurations applied to it.Code sample
final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; metricsAdvisorAdminAsyncClient.listDetectionConfigs(metricId) .subscribe(detectionConfig -> { 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()); });
- Parameters:
metricId
- The metric id.- Returns:
- The anomaly detection configurations.
- Throws:
NullPointerException
- thrown if themetricId
is null.IllegalArgumentException
- IfmetricId
does not conform to the UUID format specification.
-
listDetectionConfigs
public PagedFlux<AnomalyDetectionConfiguration> listDetectionConfigs(String metricId, ListDetectionConfigsOptions listDetectionConfigsOptions) Given a metric id, retrieve all anomaly detection configurations applied to it.Code sample
final String metricId = "0b836da8-10e6-46cd-8f4f-28262e113a62"; metricsAdvisorAdminAsyncClient.listDetectionConfigs(metricId, new ListDetectionConfigsOptions()) .subscribe(detectionConfig -> { 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()); });
- Parameters:
metricId
- The metric id.listDetectionConfigsOptions
- the additional configurable options to specify when querying the result.- Returns:
- The anomaly detection configurations.
- Throws:
NullPointerException
- thrown if themetricId
is null.IllegalArgumentException
- IfmetricId
does not conform to the UUID format specification.
-
createHook
Creates a notificationHook that receives anomaly incident alerts.Code sample
NotificationHook emailNotificationHook = new EmailNotificationHook("email hook") .setDescription("my email hook") .setEmailsToAlert(new ArrayList<String>() {{ add("alertme@alertme.com"); }}) .setExternalLink("https://adwiki.azurewebsites.net/articles/howto/alerts/create-hooks.html"); metricsAdvisorAdminAsyncClient.createHook(emailNotificationHook) .subscribe(hook -> { EmailNotificationHook createdEmailHook = (EmailNotificationHook) hook; System.out.printf("NotificationHook Id: %s%n", createdEmailHook.getId()); System.out.printf("NotificationHook Name: %s%n", createdEmailHook.getName()); System.out.printf("NotificationHook Description: %s%n", createdEmailHook.getDescription()); System.out.printf("NotificationHook External Link: %s%n", createdEmailHook.getExternalLink()); System.out.printf("NotificationHook Emails: %s%n", String.join(",", createdEmailHook.getEmailsToAlert())); });
- Parameters:
notificationHook
- The notificationHook.- Returns:
- A
Mono
containing the createdNotificationHook
. - Throws:
NullPointerException
- IfnotificationHook
,notificationHook.name
,notificationHook.endpoint
(for web notificationHook) is null.IllegalArgumentException
- If at least one email not present for email notificationHook.
-
createHookWithResponse
Creates a notificationHook that receives anomaly incident alerts.Code sample
NotificationHook emailNotificationHook = new EmailNotificationHook("email hook") .setDescription("my email hook") .setEmailsToAlert(new ArrayList<String>() {{ add("alertme@alertme.com"); }}) .setExternalLink("https://adwiki.azurewebsites.net/articles/howto/alerts/create-hooks.html"); metricsAdvisorAdminAsyncClient.createHookWithResponse(emailNotificationHook) .subscribe(response -> { System.out.printf("Response statusCode: %d%n", response.getStatusCode()); EmailNotificationHook createdEmailHook = (EmailNotificationHook) response.getValue(); System.out.printf("NotificationHook Id: %s%n", createdEmailHook.getId()); System.out.printf("NotificationHook Name: %s%n", createdEmailHook.getName()); System.out.printf("NotificationHook Description: %s%n", createdEmailHook.getDescription()); System.out.printf("NotificationHook External Link: %s%n", createdEmailHook.getExternalLink()); System.out.printf("NotificationHook Emails: %s%n", String.join(",", createdEmailHook.getEmailsToAlert())); });
- Parameters:
notificationHook
- The notificationHook.- Returns:
- A
Response
of aMono
containing the createdNotificationHook
. - Throws:
NullPointerException
- IfnotificationHook
,notificationHook.name
,notificationHook.endpoint
(for web notificationHook) is null.IllegalArgumentException
- If at least one email not present for email notificationHook.
-
getHook
Get a hook by its id.Code sample
final String hookId = "f00853f1-6627-447f-bacf-8dccf2e86fed"; metricsAdvisorAdminAsyncClient.getHook(hookId) .subscribe(hook -> { if (hook instanceof EmailNotificationHook) { EmailNotificationHook emailHook = (EmailNotificationHook) hook; System.out.printf("Email Hook Id: %s%n", emailHook.getId()); System.out.printf("Email Hook Name: %s%n", emailHook.getName()); System.out.printf("Email Hook Description: %s%n", emailHook.getDescription()); System.out.printf("Email Hook External Link: %s%n", emailHook.getExternalLink()); System.out.printf("Email Hook Emails: %s%n", String.join(",", emailHook.getEmailsToAlert())); } else if (hook instanceof WebNotificationHook) { WebNotificationHook webHook = (WebNotificationHook) hook; System.out.printf("Web Hook Id: %s%n", webHook.getId()); System.out.printf("Web Hook Name: %s%n", webHook.getName()); System.out.printf("Web Hook Description: %s%n", webHook.getDescription()); System.out.printf("Web Hook External Link: %s%n", webHook.getExternalLink()); System.out.printf("Web Hook Endpoint: %s%n", webHook.getEndpoint()); System.out.printf("Web Hook Headers: %s%n", webHook.getHttpHeaders()); } });
- Parameters:
hookId
- The hook unique id.- Returns:
- A
Mono
containing theNotificationHook
for the provided id. - Throws:
IllegalArgumentException
- IfhookId
does not conform to the UUID format specification.NullPointerException
- thrown if thehookId
is null.
-
getHookWithResponse
Get a hook by its id.Code sample
final String hookId = "f00853f1-6627-447f-bacf-8dccf2e86fed"; metricsAdvisorAdminAsyncClient.getHookWithResponse(hookId) .subscribe(response -> { System.out.printf("Response status code: %d%n", response.getStatusCode()); NotificationHook notificationHook = response.getValue(); if (notificationHook instanceof EmailNotificationHook) { EmailNotificationHook emailHook = (EmailNotificationHook) notificationHook; System.out.printf("Email Hook Id: %s%n", emailHook.getId()); System.out.printf("Email Hook Name: %s%n", emailHook.getName()); System.out.printf("Email Hook Description: %s%n", emailHook.getDescription()); System.out.printf("Email Hook External Link: %s%n", emailHook.getExternalLink()); System.out.printf("Email Hook Emails: %s%n", String.join(",", emailHook.getEmailsToAlert())); } else if (notificationHook instanceof WebNotificationHook) { WebNotificationHook webHook = (WebNotificationHook) notificationHook; System.out.printf("Web Hook Id: %s%n", webHook.getId()); System.out.printf("Web Hook Name: %s%n", webHook.getName()); System.out.printf("Web Hook Description: %s%n", webHook.getDescription()); System.out.printf("Web Hook External Link: %s%n", webHook.getExternalLink()); System.out.printf("Web Hook Endpoint: %s%n", webHook.getEndpoint()); System.out.printf("Web Hook Headers: %s%n", webHook.getHttpHeaders()); } });
- Parameters:
hookId
- The hook unique id.- Returns:
- A
Response
of aMono
containing theNotificationHook
for the provided id. - Throws:
IllegalArgumentException
- IfhookId
does not conform to the UUID format specification.NullPointerException
- thrown if thehookId
is null.
-
updateHook
Update an existing notificationHook.Code sample
final String emailHookId = "f00853f1-6627-447f-bacf-8dccf2e86fed"; metricsAdvisorAdminAsyncClient.getHook(emailHookId) .flatMap(hook -> { EmailNotificationHook emailHook = (EmailNotificationHook) hook; List<String> emailsToUpdate = new ArrayList<>(emailHook.getEmailsToAlert()); emailsToUpdate.remove("alertme@alertme.com"); emailsToUpdate.add("alertme2@alertme.com"); emailsToUpdate.add("alertme3@alertme.com"); emailHook.setEmailsToAlert(emailsToUpdate); return metricsAdvisorAdminAsyncClient.updateHook(emailHook); }) .subscribe(hook -> { EmailNotificationHook emailHook = (EmailNotificationHook) hook; System.out.printf("Email Hook Id: %s%n", emailHook.getId()); System.out.printf("Email Hook Name: %s%n", emailHook.getName()); System.out.printf("Email Hook Description: %s%n", emailHook.getDescription()); System.out.printf("Email Hook External Link: %s%n", emailHook.getExternalLink()); System.out.printf("Email Hook Emails: %s%n", String.join(",", emailHook.getEmailsToAlert())); });
- Parameters:
notificationHook
- The notificationHook to update.- Returns:
- A
Mono
containing the updatedNotificationHook
. - Throws:
NullPointerException
- IfnotificationHook.id
is null.
-
updateHookWithResponse
Update an existing notification hook.Code sample
final String emailHookId = "f00853f1-6627-447f-bacf-8dccf2e86fed"; metricsAdvisorAdminAsyncClient.getHookWithResponse(emailHookId) .flatMap(response -> { EmailNotificationHook emailHook = (EmailNotificationHook) response.getValue(); List<String> emailsToUpdate = new ArrayList<>(emailHook.getEmailsToAlert()); emailsToUpdate.remove("alertme@alertme.com"); emailsToUpdate.add("alertme2@alertme.com"); emailsToUpdate.add("alertme3@alertme.com"); emailHook.setEmailsToAlert(emailsToUpdate); return metricsAdvisorAdminAsyncClient.updateHookWithResponse(emailHook); }) .subscribe(response -> { System.out.printf("Response statusCode: %d%n", response.getStatusCode()); EmailNotificationHook emailHook = (EmailNotificationHook) response.getValue(); System.out.printf("Email Hook Id: %s%n", emailHook.getId()); System.out.printf("Email Hook Name: %s%n", emailHook.getName()); System.out.printf("Email Hook Description: %s%n", emailHook.getDescription()); System.out.printf("Email Hook External Link: %s%n", emailHook.getExternalLink()); System.out.printf("Email Hook Emails: %s%n", String.join(",", emailHook.getEmailsToAlert())); });
- Parameters:
notificationHook
- The notificationHook to update.- Returns:
- A
Response
of aMono
containing the updatedNotificationHook
. - Throws:
NullPointerException
- IfnotificationHook.id
is null.IllegalArgumentException
- IfnotificationHook.Id
does not conform to the UUID format specification.
-
deleteHook
Delete a hook.Code sample
final String emailHookId = "f00853f1-6627-447f-bacf-8dccf2e86fed"; metricsAdvisorAdminAsyncClient.deleteHook(emailHookId);
- Parameters:
hookId
- The hook unique id.- Returns:
- An empty Mono.
- Throws:
NullPointerException
- thrown if thehookId
is null.IllegalArgumentException
- IfhookId
does not conform to the UUID format specification.
-
deleteHookWithResponse
Delete a hook.Code sample
final String emailHookId = "f00853f1-6627-447f-bacf-8dccf2e86fed"; metricsAdvisorAdminAsyncClient.deleteHookWithResponse(emailHookId) .subscribe(response -> { System.out.printf("Response statusCode: %d%n", response.getStatusCode()); });
- Parameters:
hookId
- The hook unique id.- Returns:
- A
Response
of aMono
. - Throws:
NullPointerException
- thrown if thehookId
is null.IllegalArgumentException
- IfhookId
does not conform to the UUID format specification.
-
listHooks
List information of hooks on the metrics advisor account.Code sample
metricsAdvisorAdminAsyncClient.listHooks() .subscribe(hook -> { if (hook instanceof EmailNotificationHook) { EmailNotificationHook emailHook = (EmailNotificationHook) hook; System.out.printf("Email Hook Id: %s%n", emailHook.getId()); System.out.printf("Email Hook Name: %s%n", emailHook.getName()); System.out.printf("Email Hook Description: %s%n", emailHook.getDescription()); System.out.printf("Email Hook External Link: %s%n", emailHook.getExternalLink()); System.out.printf("Email Hook Emails: %s%n", String.join(",", emailHook.getEmailsToAlert())); } else if (hook instanceof WebNotificationHook) { WebNotificationHook webHook = (WebNotificationHook) hook; System.out.printf("Web Hook Id: %s%n", webHook.getId()); System.out.printf("Web Hook Name: %s%n", webHook.getName()); System.out.printf("Web Hook Description: %s%n", webHook.getDescription()); System.out.printf("Web Hook External Link: %s%n", webHook.getExternalLink()); System.out.printf("Web Hook Endpoint: %s%n", webHook.getEndpoint()); System.out.printf("Web Hook Headers: %s%n", webHook.getHttpHeaders()); } });
- Returns:
- A
PagedFlux
containing information of all theNotificationHook
in the account.
-
listHooks
List information of hooks.Code sample
ListHookOptions options = new ListHookOptions() .setSkip(100) .setMaxPageSize(20); int[] pageCount = new int[1]; metricsAdvisorAdminAsyncClient.listHooks(options).byPage() .subscribe(hookPage -> { System.out.printf("Page: %d%n", pageCount[0]++); for (NotificationHook notificationHook : hookPage.getElements()) { if (notificationHook instanceof EmailNotificationHook) { EmailNotificationHook emailHook = (EmailNotificationHook) notificationHook; System.out.printf("Email Hook Id: %s%n", emailHook.getId()); System.out.printf("Email Hook Name: %s%n", emailHook.getName()); System.out.printf("Email Hook Description: %s%n", emailHook.getDescription()); System.out.printf("Email Hook External Link: %s%n", emailHook.getExternalLink()); System.out.printf("Email Hook Emails: %s%n", String.join(",", emailHook.getEmailsToAlert())); System.out.printf("Email Hook Admins: %s%n", String.join(",", emailHook.getAdmins())); } else if (notificationHook instanceof WebNotificationHook) { WebNotificationHook webHook = (WebNotificationHook) notificationHook; System.out.printf("Web Hook Id: %s%n", webHook.getId()); System.out.printf("Web Hook Name: %s%n", webHook.getName()); System.out.printf("Web Hook Description: %s%n", webHook.getDescription()); System.out.printf("Web Hook External Link: %s%n", webHook.getExternalLink()); System.out.printf("Web Hook Endpoint: %s%n", webHook.getEndpoint()); System.out.printf("Web Hook Headers: %s%n", webHook.getHttpHeaders()); System.out.printf("Web Hook Admins: %s%n", String.join(",", webHook.getAdmins())); } } });
- Parameters:
listHookOptions
- the additional configurable options to specify when listing hooks.- Returns:
- A
PagedFlux
containing information of theNotificationHook
resources.
-
createAlertConfig
public Mono<AnomalyAlertConfiguration> createAlertConfig(AnomalyAlertConfiguration alertConfiguration) Create a configuration to trigger alert when anomalies are detected.Code sample
String detectionConfigurationId1 = "9ol48er30-6e6e-4391-b78f-b00dfee1e6f5"; String detectionConfigurationId2 = "3e58er30-6e6e-4391-b78f-b00dfee1e6f5"; String hookId1 = "5f48er30-6e6e-4391-b78f-b00dfee1e6f5"; String hookId2 = "8i48er30-6e6e-4391-b78f-b00dfee1e6f5"; metricsAdvisorAdminAsyncClient.createAlertConfig( new AnomalyAlertConfiguration("My AnomalyAlert config name") .setDescription("alert config description") .setMetricAlertConfigurations(Arrays.asList( new MetricAlertConfiguration(detectionConfigurationId1, MetricAnomalyAlertScope.forWholeSeries()), new MetricAlertConfiguration(detectionConfigurationId2, MetricAnomalyAlertScope.forWholeSeries()) .setAlertConditions(new MetricAnomalyAlertConditions() .setSeverityRangeCondition(new SeverityCondition(AnomalySeverity.HIGH, AnomalySeverity.HIGH))))) .setCrossMetricsOperator(MetricAlertConfigurationsOperator.AND) .setHookIdsToAlert(Arrays.asList(hookId1, hookId2))) .subscribe(anomalyAlertConfiguration -> { System.out.printf("DataPoint Anomaly alert configuration Id: %s%n", anomalyAlertConfiguration.getId()); System.out.printf("DataPoint Anomaly alert configuration description: %s%n", anomalyAlertConfiguration.getDescription()); System.out.printf("DataPoint Anomaly alert configuration hook ids: %s%n", anomalyAlertConfiguration.getHookIdsToAlert()); System.out.printf("DataPoint Anomaly alert configuration cross metrics operator: %s%n", anomalyAlertConfiguration.getCrossMetricsOperator().toString()); });
- Parameters:
alertConfiguration
- The anomaly alerting configuration.- Returns:
- A
Mono
containing the createdAnomalyAlertConfiguration
. - Throws:
NullPointerException
- thrown if thealertConfiguration
oralertConfiguration.metricAnomalyAlertConfigurations
is null.
-
createAlertConfigWithResponse
public Mono<Response<AnomalyAlertConfiguration>> createAlertConfigWithResponse(AnomalyAlertConfiguration alertConfiguration) Code sample
String detectionConfigurationId1 = "9ol48er30-6e6e-4391-b78f-b00dfee1e6f5"; String detectionConfigurationId2 = "3e58er30-6e6e-4391-b78f-b00dfee1e6f5"; String hookId1 = "5f48er30-6e6e-4391-b78f-b00dfee1e6f5"; String hookId2 = "8i48er30-6e6e-4391-b78f-b00dfee1e6f5"; metricsAdvisorAdminAsyncClient.createAlertConfigWithResponse( new AnomalyAlertConfiguration("My AnomalyAlert config name") .setDescription("alert config description") .setMetricAlertConfigurations(Arrays.asList( new MetricAlertConfiguration(detectionConfigurationId1, MetricAnomalyAlertScope.forWholeSeries()), new MetricAlertConfiguration(detectionConfigurationId2, MetricAnomalyAlertScope.forWholeSeries()) .setAlertConditions(new MetricAnomalyAlertConditions() .setSeverityRangeCondition(new SeverityCondition(AnomalySeverity.HIGH, AnomalySeverity.HIGH))))) .setCrossMetricsOperator(MetricAlertConfigurationsOperator.AND) .setHookIdsToAlert(Arrays.asList(hookId1, hookId2))) .subscribe(alertConfigurationResponse -> { System.out.printf("DataPoint Anomaly alert creation operation status: %s%n", alertConfigurationResponse.getStatusCode()); final AnomalyAlertConfiguration anomalyAlertConfiguration = alertConfigurationResponse.getValue(); System.out.printf("DataPoint Anomaly alert configuration Id: %s%n", anomalyAlertConfiguration.getId()); System.out.printf("DataPoint Anomaly alert configuration description: %s%n", anomalyAlertConfiguration.getDescription()); System.out.printf("DataPoint Anomaly alert configuration hook ids: %s%n", anomalyAlertConfiguration.getHookIdsToAlert()); System.out.printf("DataPoint Anomaly alert configuration cross metrics operator: %s%n", anomalyAlertConfiguration.getCrossMetricsOperator().toString()); });
- Parameters:
alertConfiguration
- The anomaly alerting configuration.- Returns:
- A
Response
of aMono
containing the createdAnomalyAlertConfiguration
. - Throws:
NullPointerException
- thrown if thealertConfiguration
oralertConfiguration.metricAnomalyAlertConfigurations
is null.
-
getAlertConfig
Get the anomaly alert configuration identified byalertConfigurationId
.Code sample
String alertConfigId = "1p0f8er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.getAlertConfig(alertConfigId) .subscribe(anomalyAlertConfiguration -> { System.out.printf("DataPoint Anomaly alert configuration Id: %s%n", anomalyAlertConfiguration.getId()); System.out.printf("DataPoint Anomaly alert configuration description: %s%n", anomalyAlertConfiguration.getDescription()); System.out.printf("DataPoint Anomaly alert configuration hook ids: %s%n", anomalyAlertConfiguration.getHookIdsToAlert()); System.out.printf("DataPoint Anomaly alert configuration cross metrics operator: %s%n", anomalyAlertConfiguration.getCrossMetricsOperator().toString()); });
- Parameters:
alertConfigurationId
- The anomaly alert configuration id.- Returns:
- A
Mono
containing theAnomalyAlertConfiguration
identified by the given id. - Throws:
IllegalArgumentException
- IfalertConfigurationId
does not conform to the UUID format specification.NullPointerException
- thrown if thealertConfigurationId
is null.
-
getAlertConfigWithResponse
public Mono<Response<AnomalyAlertConfiguration>> getAlertConfigWithResponse(String alertConfigurationId) Get the anomaly alert configuration identified byalertConfigurationId
.Code sample
String alertConfigId = "1p0f8er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.getAlertConfigWithResponse(alertConfigId) .subscribe(alertConfigurationResponse -> { System.out.printf("DataPointAnomaly alert creation operation status: %s%n", alertConfigurationResponse.getStatusCode()); final AnomalyAlertConfiguration anomalyAlertConfiguration = alertConfigurationResponse.getValue(); System.out.printf("DataPoint Anomaly alert configuration Id: %s%n", anomalyAlertConfiguration.getId()); System.out.printf("DataPoint Anomaly alert configuration description: %s%n", anomalyAlertConfiguration.getDescription()); System.out.printf("DataPoint Anomaly alert configuration hook ids: %s%n", anomalyAlertConfiguration.getHookIdsToAlert()); System.out.printf("DataPoint Anomaly alert configuration cross metrics operator: %s%n", anomalyAlertConfiguration.getCrossMetricsOperator().toString()); });
- Parameters:
alertConfigurationId
- The anomaly alert configuration id.- Returns:
- A
response
of aMono
containing theAnomalyAlertConfiguration
identified by the given id. - Throws:
IllegalArgumentException
- IfalertConfigurationId
does not conform to the UUID format specification.NullPointerException
- thrown if thealertConfigurationId
is null.
-
updateAlertConfig
public Mono<AnomalyAlertConfiguration> updateAlertConfig(AnomalyAlertConfiguration alertConfiguration) Update anomaly alert configuration.Code sample
String alertConfigId = "1p0f8er30-6e6e-4391-b78f-bpfdfee1e6f5"; String additionalHookId = "2gh8er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.getAlertConfig(alertConfigId) .flatMap(existingAnomalyConfig -> { List<String> hookIds = new ArrayList<>(existingAnomalyConfig.getHookIdsToAlert()); hookIds.add(additionalHookId); return metricsAdvisorAdminAsyncClient.updateAlertConfig( existingAnomalyConfig .setHookIdsToAlert(hookIds) .setDescription("updated to add more hook ids")); }).subscribe(updateAnomalyAlertConfiguration -> { System.out.printf("Updated anomaly alert configuration Id: %s%n", updateAnomalyAlertConfiguration.getId()); System.out.printf("Updated anomaly alert configuration description: %s%n", updateAnomalyAlertConfiguration.getDescription()); System.out.printf("Updated anomaly alert configuration hook ids: %s%n", updateAnomalyAlertConfiguration.getHookIdsToAlert()); });
- Parameters:
alertConfiguration
- The anomaly alert configuration to update.- Returns:
- A
Mono
containing theAnomalyAlertConfiguration
that was updated. - Throws:
NullPointerException
- thrown ifalertConfiguration
oralertConfiguration.metricAnomalyAlertConfigurations
is null or empty.
-
updateAlertConfigWithResponse
public Mono<Response<AnomalyAlertConfiguration>> updateAlertConfigWithResponse(AnomalyAlertConfiguration alertConfiguration) Update anomaly alert configuration.Code sample
String alertConfigId = "1p0f8er30-6e6e-4391-b78f-bpfdfee1e6f5"; String additionalHookId = "2gh8er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.getAlertConfig(alertConfigId) .flatMap(existingAnomalyConfig -> { List<String> hookIds = new ArrayList<>(existingAnomalyConfig.getHookIdsToAlert()); hookIds.add(additionalHookId); return metricsAdvisorAdminAsyncClient.updateAlertConfigWithResponse( existingAnomalyConfig .setHookIdsToAlert(hookIds) .setDescription("updated to add more hook ids")); }).subscribe(alertConfigurationResponse -> { System.out.printf("Update anomaly alert operation status: %s%n", alertConfigurationResponse.getStatusCode()); final AnomalyAlertConfiguration updatAnomalyAlertConfiguration = alertConfigurationResponse.getValue(); System.out.printf("Updated anomaly alert configuration Id: %s%n", updatAnomalyAlertConfiguration.getId()); System.out.printf("Updated anomaly alert configuration description: %s%n", updatAnomalyAlertConfiguration.getDescription()); System.out.printf("Updated anomaly alert configuration hook ids: %s%n", updatAnomalyAlertConfiguration.getHookIdsToAlert()); });
- Parameters:
alertConfiguration
- The anomaly alert configuration to update.- Returns:
- A
Response
of aMono
containing theAnomalyAlertConfiguration
that was updated. - Throws:
NullPointerException
- thrown ifalertConfiguration
oralertConfiguration.metricAnomalyAlertConfigurations
is null or empty.
-
deleteAlertConfig
Deletes the anomaly alert configuration identified byalertConfigurationId
.Code sample
String alertConfigId = "1p0f8er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.deleteAlertConfig(alertConfigId);
- Parameters:
alertConfigurationId
- The anomaly alert configuration id.- Returns:
- An empty Mono.
- Throws:
IllegalArgumentException
- IfalertConfigurationId
does not conform to the UUID format specification.NullPointerException
- thrown if thealertConfigurationId
is null.
-
deleteAlertConfigWithResponse
Deletes the anomaly alert configuration identified byalertConfigurationId
.Code sample
String alertConfigId = "1p0f8er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.deleteAlertConfigWithResponse(alertConfigId) .subscribe(response -> { System.out.printf("DataPoint Anomaly alert config delete operation status : %s%n", response.getStatusCode()); });
- Parameters:
alertConfigurationId
- The anomaly alert configuration id.- Returns:
- A response containing status code and headers returned after the operation.
- Throws:
IllegalArgumentException
- IfalertConfigurationId
does not conform to the UUID format specification.NullPointerException
- thrown if thealertConfigurationId
is null.
-
listAlertConfigs
public PagedFlux<AnomalyAlertConfiguration> listAlertConfigs(String detectionConfigurationId, ListAnomalyAlertConfigsOptions listAnomalyAlertConfigsOptions) Fetch the anomaly alert configurations associated with a detection configuration.Code sample
String detectionConfigId = "3rt98er30-6e6e-4391-b78f-bpfdfee1e6f5"; metricsAdvisorAdminAsyncClient.listAlertConfigs(detectionConfigId, new ListAnomalyAlertConfigsOptions()) .subscribe(anomalyAlertConfiguration -> { System.out.printf("DataPoint Anomaly alert configuration Id: %s%n", anomalyAlertConfiguration.getId()); System.out.printf("DataPoint Anomaly alert configuration description: %s%n", anomalyAlertConfiguration.getDescription()); System.out.printf("DataPoint Anomaly alert configuration hook ids: %s%n", anomalyAlertConfiguration.getHookIdsToAlert()); System.out.printf("DataPoint Anomaly alert configuration cross metrics operator: %s%n", anomalyAlertConfiguration.getCrossMetricsOperator().toString()); });
- Parameters:
detectionConfigurationId
- The id of the detection configuration.listAnomalyAlertConfigsOptions
- th e additional configurable options to specify when querying the result.- Returns:
- A
PagedFlux
containing information of all theanomaly alert configurations
for the specified detection configuration. - Throws:
NullPointerException
- thrown if thedetectionConfigurationId
is null.IllegalArgumentException
- IfdetectionConfigurationId
does not conform to the UUID format specification.
-
createDataSourceCredential
public Mono<DataSourceCredentialEntity> createDataSourceCredential(DataSourceCredentialEntity dataSourceCredential) Create a data source credential entity.Code sample
DataSourceCredentialEntity datasourceCredential; final String name = "sample_name" + UUID.randomUUID(); final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; datasourceCredential = new DataSourceServicePrincipalInKeyVault() .setName(name) .setKeyVaultForDataSourceSecrets("kv", cId, mockSecr) .setTenantId(tId) .setSecretNameForDataSourceClientId("DSClientID_1") .setSecretNameForDataSourceClientSecret("DSClientSer_1"); metricsAdvisorAdminAsyncClient.createDataSourceCredential(datasourceCredential) .subscribe(credentialEntity -> { if (credentialEntity instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) credentialEntity; System.out .printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault client Id: %s%n", actualCredentialSPInKV.getKeyVaultClientId()); System.out.printf("Actual credential entity key vault secret name for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientId()); System.out.printf("Actual credential entity key vault secret for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientSecret()); } });
- Parameters:
dataSourceCredential
- The credential entity.- Returns:
- A
Mono
containing the createdDataSourceCredentialEntity
. - Throws:
NullPointerException
- thrown if thecredentialEntity
is null
-
createDataSourceCredentialWithResponse
public Mono<Response<DataSourceCredentialEntity>> createDataSourceCredentialWithResponse(DataSourceCredentialEntity dataSourceCredential) Create a data source credential entity with REST response.Code sample
DataSourceCredentialEntity datasourceCredential; final String name = "sample_name" + UUID.randomUUID(); final String cId = "f45668b2-bffa-11eb-8529-0246ac130003"; final String tId = "67890ded-5e07-4e52-b225-4ae8f905afb5"; final String mockSecr = "890hy69-5e07-4e52-b225-4ae8f905afb5"; datasourceCredential = new DataSourceServicePrincipalInKeyVault() .setName(name) .setKeyVaultForDataSourceSecrets("kv", cId, mockSecr) .setTenantId(tId) .setSecretNameForDataSourceClientId("DSClientID_1") .setSecretNameForDataSourceClientSecret("DSClientSer_1"); metricsAdvisorAdminAsyncClient.createDataSourceCredentialWithResponse(datasourceCredential) .subscribe(credentialEntityWithResponse -> { System.out.printf("Credential Entity creation operation status: %s%n", credentialEntityWithResponse.getStatusCode()); if (credentialEntityWithResponse.getValue() instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); System.out .printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault client Id: %s%n", actualCredentialSPInKV.getKeyVaultClientId()); System.out.printf("Actual credential entity key vault secret name for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientId()); System.out.printf("Actual credential entity key vault secret for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientSecret()); } });
- Parameters:
dataSourceCredential
- The credential entity.- Returns:
- A
Mono
containing the createdDataSourceCredentialEntity
. - Throws:
NullPointerException
- thrown if thecredentialEntity
is null
-
updateDataSourceCredential
public Mono<DataSourceCredentialEntity> updateDataSourceCredential(DataSourceCredentialEntity dataSourceCredential) Update a data source credential entity.Code sample
String credentialId = ""; metricsAdvisorAdminAsyncClient.getDataSourceCredential(credentialId) .flatMap(existingDatasourceCredential -> { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = null; if (existingDatasourceCredential instanceof DataSourceServicePrincipalInKeyVault) { actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) existingDatasourceCredential; } return metricsAdvisorAdminAsyncClient.updateDataSourceCredential( actualCredentialSPInKV.setDescription("set updated description")); }) .subscribe(credentialEntity -> { if (credentialEntity instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) credentialEntity; System.out.printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault updated description: %s%n", actualCredentialSPInKV.getDescription()); } });
- Parameters:
dataSourceCredential
- The credential entity.- Returns:
- A
Mono
containing the updatedDataSourceCredentialEntity
. - Throws:
NullPointerException
- thrown if thecredentialEntity
is null
-
updateDataSourceCredentialWithResponse
public Mono<Response<DataSourceCredentialEntity>> updateDataSourceCredentialWithResponse(DataSourceCredentialEntity dataSourceCredential) Update a data source credential entity with REST response.Code sample
String credentialId = ""; metricsAdvisorAdminAsyncClient.getDataSourceCredential(credentialId) .flatMap(existingDatasourceCredential -> { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = null; if (existingDatasourceCredential instanceof DataSourceServicePrincipalInKeyVault) { actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) existingDatasourceCredential; } return metricsAdvisorAdminAsyncClient.updateDataSourceCredentialWithResponse( actualCredentialSPInKV.setDescription("set updated description")); }) .subscribe(credentialEntityWithResponse -> { System.out.printf("Credential Entity creation operation status: %s%n", credentialEntityWithResponse.getStatusCode()); if (credentialEntityWithResponse.getValue() instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); System.out.printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault updated description: %s%n", actualCredentialSPInKV.getDescription()); } });
- Parameters:
dataSourceCredential
- The credential entity.- Returns:
- A
Mono
containing the updatedDataSourceCredentialEntity
. - Throws:
NullPointerException
- thrown if thecredentialEntity
is null
-
getDataSourceCredential
Get a data source credential entity by its id.Code sample
final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; metricsAdvisorAdminAsyncClient.getDataSourceCredential(datasourceCredentialId) .subscribe(credentialEntity -> { if (credentialEntity instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) credentialEntity; System.out .printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault client Id: %s%n", actualCredentialSPInKV.getKeyVaultClientId()); System.out.printf("Actual credential entity key vault secret name for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientId()); System.out.printf("Actual credential entity key vault secret for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientSecret()); } });
- Parameters:
credentialId
- The data source credential entity unique id.- Returns:
- The data source credential entity for the provided id.
- Throws:
IllegalArgumentException
- IfcredentialId
does not conform to the UUID format specification.NullPointerException
- thrown if thecredentialId
is null.
-
getDataSourceCredentialWithResponse
public Mono<Response<DataSourceCredentialEntity>> getDataSourceCredentialWithResponse(String credentialId) Get a data source credential entity by its id with REST response.Code sample
final String datasourceCredentialId = "f45668b2-bffa-11eb-8529-0246ac130003"; metricsAdvisorAdminAsyncClient.getDataSourceCredentialWithResponse(datasourceCredentialId) .subscribe(credentialEntityWithResponse -> { System.out.printf("Credential Entity creation operation status: %s%n", credentialEntityWithResponse.getStatusCode()); if (credentialEntityWithResponse.getValue() instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) credentialEntityWithResponse.getValue(); System.out .printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault client Id: %s%n", actualCredentialSPInKV.getKeyVaultClientId()); System.out.printf("Actual credential entity key vault secret name for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientId()); System.out.printf("Actual credential entity key vault secret for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientSecret()); } });
- Parameters:
credentialId
- The data source credential entity unique id.- Returns:
- The data source credential entity for the provided id.
- Throws:
IllegalArgumentException
- IfcredentialId
does not conform to the UUID format specification.NullPointerException
- thrown if thecredentialId
is null.
-
deleteDataSourceCredential
Deletes the data source credential entity identified bycredentialId
.Code sample
final String datasourceCredentialId = "t00853f1-9080-447f-bacf-8dccf2e86f"; metricsAdvisorAdminAsyncClient.deleteDataFeed(datasourceCredentialId);
- Parameters:
credentialId
- The data source credential entity id.- Returns:
- An empty Mono.
- Throws:
IllegalArgumentException
- IfcredentialId
does not conform to the UUID format specification.NullPointerException
- thrown if thecredentialId
is null.
-
deleteDataSourceCredentialWithResponse
Deletes the data source credential entity identified bycredentialId
.Code sample
final String datasourceCredentialId = "eh0854f1-8927-447f-bacf-8dccf2e86fwe"; metricsAdvisorAdminAsyncClient.deleteDataSourceCredentialWithResponse(datasourceCredentialId) .subscribe(response -> System.out.printf("Datasource credential delete operation status : %s%n", response.getStatusCode()));
- Parameters:
credentialId
- The data source credential entity id.- Returns:
- A response containing status code and headers returned after the operation.
- Throws:
IllegalArgumentException
- IfcredentialId
does not conform to the UUID format specification.NullPointerException
- thrown if thecredentialId
is null.
-
listDataSourceCredentials
List information of all data source credential entities on the metrics advisor account.Code sample
metricsAdvisorAdminAsyncClient.listDataSourceCredentials() .subscribe(datasourceCredentialEntity -> { if (datasourceCredentialEntity instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) datasourceCredentialEntity; System.out .printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault client Id: %s%n", actualCredentialSPInKV.getKeyVaultClientId()); System.out.printf("Actual credential entity key vault secret name for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientId()); System.out.printf("Actual credential entity key vault secret for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientSecret()); } });
- Returns:
- A
PagedFlux
containing information of all thedata feeds
in the account.
-
listDataSourceCredentials
public PagedFlux<DataSourceCredentialEntity> listDataSourceCredentials(ListCredentialEntityOptions listCredentialEntityOptions) List information of all data source credential entities on the metrics advisor account.Code sample
metricsAdvisorAdminAsyncClient.listDataSourceCredentials( new ListCredentialEntityOptions() .setMaxPageSize(3)) .subscribe(datasourceCredentialEntity -> { if (datasourceCredentialEntity instanceof DataSourceServicePrincipalInKeyVault) { DataSourceServicePrincipalInKeyVault actualCredentialSPInKV = (DataSourceServicePrincipalInKeyVault) datasourceCredentialEntity; System.out .printf("Actual credential entity key vault endpoint: %s%n", actualCredentialSPInKV.getKeyVaultEndpoint()); System.out.printf("Actual credential entity key vault client Id: %s%n", actualCredentialSPInKV.getKeyVaultClientId()); System.out.printf("Actual credential entity key vault secret name for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientId()); System.out.printf("Actual credential entity key vault secret for data source: %s%n", actualCredentialSPInKV.getSecretNameForDataSourceClientSecret()); } });
- Parameters:
listCredentialEntityOptions
- The configurableoptions
to pass for filtering the output result.- Returns:
- A
PagedFlux
containing information of all thedata feeds
in the account.
-