com.azure.ai.metricsadvisor.administration.package-info Maven / Gradle / Ivy
Show all versions of azure-ai-metricsadvisor Show documentation
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/**
* Azure Metrics Advisor is a
* cloud-based service provided by Microsoft Azure that is designed to help organizations monitor
* and analyze metrics and time-series data from various sources. It is particularly focused on aiding in the
* detection of anomalies, trends, and patterns within this data, which can be invaluable for improving operational
* efficiency, identifying issues early, and making data-driven decisions.
*
* Here are some key features and capabilities of Azure Metrics Advisor:
*
* - Anomaly Detection: Azure Metrics Advisor employs machine learning algorithms to automatically identify
* anomalies in time-series data. It can differentiate between normal variations and unusual patterns, helping
* organizations detect issues or opportunities for improvement.
*
* - Time-Series Data Ingestion: The service allows you to ingest time-series data from various sources, including
* Azure Monitor, Application Insights, IoT Hub, and custom data sources. This flexibility enables you to monitor a wide
* range of metrics.
*
* - Data Exploration: Users can explore their data, view historical trends, and gain insights into the behavior of
* various metrics over time. This can be useful for identifying seasonal patterns and understanding the normal
* behavior of your systems.
*
* - Integration with Azure Services: Azure Metrics Advisor integrates with other Azure services, such as Azure
* Monitor and Azure Data Explorer, making it part of a broader ecosystem for monitoring and analytics.
*
* - Alerts and Notifications: You can set up alerts and notifications based on detected anomalies or specific
* thresholds, ensuring that you are informed promptly when issues arise.
*
*
* Getting Started
*
* The Azure Metrics Advisor library provides advisor clients like
* {@link com.azure.ai.metricsadvisor.MetricsAdvisorAsyncClient}
* and {@link com.azure.ai.metricsadvisor.MetricsAdvisorClient} to connect to the Metrics Advisor
* Azure Cognitive Service to perform data monitoring.
* It also provides administration clients like
* {@link com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient}
* and {@link com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient} to
* build and manage models from custom documents.
*
* Service clients are the point of interaction for developers to use Azure Form Recognizer.
* {@link com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient} is the synchronous service client and
* {@link com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient} is the asynchronous service client.
* The examples shown in this document use a credential object named DefaultAzureCredential for authentication, which is
* appropriate for most scenarios, including local development and production environments. Additionally, we
* recommend using
* managed identity
* for authentication in production environments.
* You can find more information on different ways of authenticating and their corresponding credential types in the
* Azure Identity documentation".
*
*
* Sample: Construct a MetricsAdvisorClient with DefaultAzureCredential
*
* The following code sample demonstrates the creation of a
* {@link com.azure.ai.metricsadvisor.MetricsAdvisorClient}, using
* the `DefaultAzureCredentialBuilder` to configure it.
*
*
*
* MetricsAdvisorAdministrationClient metricsAdvisorAdminClient =
* new MetricsAdvisorAdministrationClientBuilder()
* .credential(new DefaultAzureCredentialBuilder().build())
* .endpoint("{endpoint}")
* .buildClient();
*
*
*
* Further, see the code sample below to use
* {@link com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential MetricsAdvisorKeyCredential} for client creation.
*
*
*
* MetricsAdvisorAdministrationClient metricsAdvisorAdminClient =
* new MetricsAdvisorAdministrationClientBuilder()
* .credential(new MetricsAdvisorKeyCredential("{subscription_key}", "{api_key}"))
* .endpoint("{endpoint}")
* .buildClient();
*
*
*
* Let's take a look at the advisor client scenarios and their respective usage below.
*
*
*
*
* Onboard your data by connecting to an SQL data source
* Metrics Advisor provides connectors for different data sources, such as Azure SQL Database, Azure Data Explorer,
* and Azure Table Storage.
* Sample: Onboard a given SQL source of data to Metrics Advisor service
*
* The following code sample demonstrates to connect data source to create a data feed using an SQL data source
*
*
*
* 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)));
*
* DataFeed createdDataFeed = metricsAdvisorAdminClient.createDataFeed(dataFeed);
*
* 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());
*
*
* Note: For asynchronous sample, refer to {@link com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient#createDataFeed(com.azure.ai.metricsadvisor.administration.models.DataFeed) AsyncCreateDataFeed} API.
*
*
*
*
*
* Subscribe anomalies for notification
*
* After an anomaly is detected by Metrics Advisor, an alert notification will be triggered based on alert settings,
* using a hook. An alert setting can be used with multiple detection configurations, various parameters are available to customize your alert rule.
*
* The following code sample demonstrates how to configure an alert notification for a detected anomaly with multiple detection configurations
* Sample: Configure alerts and get notifications using a hook.
*
```java readme-sample-createHook
*
*
* NotificationHook emailNotificationHook = new EmailNotificationHook("email Hook")
* .setDescription("my email Hook")
* .setEmailsToAlert(Collections.singletonList("alertme@alertme.com"))
* .setExternalLink("https://adwiki.azurewebsites.net/articles/howto/alerts/create-hooks.html");
*
* final NotificationHook notificationHook = metricsAdvisorAdminClient.createHook(emailNotificationHook);
* EmailNotificationHook createdEmailHook = (EmailNotificationHook) notificationHook;
* System.out.printf("Email Hook Id: %s%n", createdEmailHook.getId());
* System.out.printf("Email Hook name: %s%n", createdEmailHook.getName());
* System.out.printf("Email Hook description: %s%n", createdEmailHook.getDescription());
* System.out.printf("Email Hook external Link: %s%n", createdEmailHook.getExternalLink());
* System.out.printf("Email Hook emails to alert: %s%n",
* String.join(",", createdEmailHook.getEmailsToAlert()));
*
*
* Note: For asynchronous sample, refer to {@link com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient#createHook(com.azure.ai.metricsadvisor.administration.models.NotificationHook) AsyncCreateHook} API.
*
* @see com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient
* @see com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient
* @see com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder
*/
package com.azure.ai.metricsadvisor.administration;