Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions sdk/metricsadvisor/ai-metrics-advisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,33 +113,33 @@ const adminClient = new MetricsAdvisorAdministrationClient("<endpoint>", credent

`MetricsAdvisorAdministrationClient` is the interface responsible for managing entities in the Metrics Advisor resources, such as managing data feeds, anomaly detection configurations, anomaly alerting configurations.

### DataFeed
### Data Feed

A `DataFeed` is what Metrics Advisor ingests from your data source, such as Cosmos DB or a SQL server. A data feed contains rows of:
A data feed is what Metrics Advisor ingests from your data source, such as Cosmos DB or a SQL server. A data feed contains rows of:

- timestamps
- zero or more dimensions
- one or more measures

### Metric

A `Metric` is a quantifiable measure that is used to monitor and assess the status of a specific business process. It can be a combination of multiple time series values divided into dimensions. For example a web health metric might contain dimensions for user count and the en-us market.
A metric is a quantifiable measure that is used to monitor and assess the status of a specific business process. It can be a combination of multiple time series values divided into dimensions. For example a web health metric might contain dimensions for user count and the en-us market.

### AnomalyDetectionConfiguration

`AnomalyDetectionConfiguration` is required for every time series, and determines whether a point in the time series is an anomaly.

### Anomaly & Incident

After a detection configuration is applied to metrics, `Incident`s are generated whenever any series within it has an `Anomaly`.
After a detection configuration is applied to metrics, `AnomalyIncident`s are generated whenever any series within it has an `DataPointAnomaly`.

### Alert

You can configure which anomalies should trigger an `Alert`. You can set multiple alerts with different settings. For example, you could create an alert for anomalies with lower business impact, and another for more important alerts.
You can configure which anomalies should trigger an `AnomalyAlert`. You can set multiple alerts with different settings. For example, you could create an alert for anomalies with lower business impact, and another for more important alerts.

### Hook

Metrics Advisor lets you create and subscribe to real-time alerts. These alerts are sent over the internet, using a `Hook`.
Metrics Advisor lets you create and subscribe to real-time alerts. These alerts are sent over the internet, using a notification hook.

Please refer to [the Metrics Advisory Glossary][metrics_advisor_glossary] documentation page for a comprehensive list of concepts.

Expand Down Expand Up @@ -465,7 +465,7 @@ async function queryAnomaliesByAlert(client, alert) {
const iterator = client.listAnomaliesForAlert(alert);
for await (const anomaly of iterator) {
console.log(
` Anomaly ${anomaly.severity} ${anomaly.status} ${anomaly.seriesKey.dimension} ${anomaly.timestamp}`
` Anomaly ${anomaly.severity} ${anomaly.status} ${anomaly.seriesKey} ${anomaly.timestamp}`
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,36 +238,14 @@ export interface CredentialsPageResponse extends Array<DataSourceCredentialEntit
};
}

// @public
export type DataFeed = {
id: string;
name: string;
createdOn: Date;
status: DataFeedStatus;
isAdmin: boolean;
creator: string;
source: DataFeedSource;
schema: DataFeedSchema;
metricIds: Record<string, string>;
granularity: DataFeedGranularity;
ingestionSettings: DataFeedIngestionSettings;
description?: string;
rollupSettings?: DataFeedRollupSettings;
missingDataPointFillSettings?: DataFeedMissingDataPointFillSettings;
accessMode?: DataFeedAccessMode;
adminEmails?: string[];
viewerEmails?: string[];
actionLinkTemplate?: string;
};

// @public
export type DataFeedAccessMode = "Private" | "Public";

// @public
export type DataFeedAutoRollupMethod = "None" | "Sum" | "Max" | "Min" | "Avg" | "Count";

// @public
export type DataFeedDescriptor = Omit<DataFeed, "id" | "metricIds" | "isAdmin" | "status" | "creator" | "createdOn">;
export type DataFeedDescriptor = Omit<MetricsAdvisorDataFeed, "id" | "metricIds" | "isAdmin" | "status" | "creator" | "createdOn">;

// @public
export type DataFeedDetailStatus = "Active" | "Paused";
Expand Down Expand Up @@ -364,7 +342,7 @@ export type DataFeedSourcePatch = Partial<DataFeedSource> & {
};

// @public
export interface DataFeedsPageResponse extends Array<DataFeed> {
export interface DataFeedsPageResponse extends Array<MetricsAdvisorDataFeed> {
continuationToken?: string;
_response: coreHttp.HttpResponse & {
bodyAsText: string;
Expand Down Expand Up @@ -575,15 +553,15 @@ export type FeedbackQueryTimeMode = "MetricTimestamp" | "FeedbackCreatedTime";
export type FeedbackType = "Anomaly" | "ChangePoint" | "Period" | "Comment";

// @public
export type GetAnomalyAlertConfigurationResponse = AnomalyAlertConfiguration & {
export type GetAlertConfigResponse = AnomalyAlertConfiguration & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: any;
};
};

// @public
export type GetDataFeedResponse = DataFeed & {
export type GetDataFeedResponse = MetricsAdvisorDataFeed & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: any;
Expand Down Expand Up @@ -751,15 +729,15 @@ export interface ListAnomaliesForAlertConfigurationOptions extends OperationOpti

// @public
export interface ListAnomaliesForDetectionConfigurationOptions extends OperationOptions {
dimensionFilter?: DimensionKey[];
seriesGroupKeys?: DimensionKey[];
severityFilter?: SeverityFilterCondition;
skip?: number;
}

// @public
export interface ListAnomalyDimensionValuesOptions extends OperationOptions {
// (undocumented)
dimensionFilter?: DimensionKey;
seriesGroupKey?: DimensionKey;
skip?: number;
}

Expand Down Expand Up @@ -788,7 +766,7 @@ export interface ListDataSourceCredentialsOptions extends OperationOptions {
// @public
export interface ListFeedbackOptions extends OperationOptions {
filter?: {
dimensionFilter?: DimensionKey;
dimensionKey?: DimensionKey;
feedbackType?: FeedbackType;
startTime?: Date | string;
endTime?: Date | string;
Expand All @@ -810,7 +788,7 @@ export interface ListIncidentsForAlertOptions extends OperationOptions {

// @public
export interface ListIncidentsForDetectionConfigurationOptions extends OperationOptions {
dimensionFilter?: DimensionKey[];
seriesGroupKeys?: DimensionKey[];
}

// @public
Expand Down Expand Up @@ -870,7 +848,7 @@ export type MetricAnomalyAlertScope = {
scopeType: "All";
} | {
scopeType: "Dimension";
dimensionAnomalyScope: DimensionKey;
seriesGroupInScope: DimensionKey;
} | {
scopeType: "TopN";
topNAnomalyScope: TopNGroupScope;
Expand Down Expand Up @@ -942,7 +920,7 @@ export interface MetricEnrichedSeriesData {
isAnomaly?: boolean[];
lowerBounds?: number[];
periods?: number[];
series: DimensionKey;
seriesKey: DimensionKey;
timestamps?: Date[];
upperBounds?: number[];
values?: number[];
Expand Down Expand Up @@ -988,7 +966,7 @@ export type MetricPeriodFeedback = {
// @public
export class MetricsAdvisorAdministrationClient {
constructor(endpointUrl: string, credential: TokenCredential | MetricsAdvisorKeyCredential, options?: MetricsAdvisorAdministrationClientOptions);
createAlertConfig(config: Omit<AnomalyAlertConfiguration, "id">, options?: OperationOptions): Promise<GetAnomalyAlertConfigurationResponse>;
createAlertConfig(config: Omit<AnomalyAlertConfiguration, "id">, options?: OperationOptions): Promise<GetAlertConfigResponse>;
createDataFeed(feed: DataFeedDescriptor, operationOptions?: CreateDataFeedOptions): Promise<GetDataFeedResponse>;
createDataSourceCredential(dataSourceCredential: DataSourceCredentialEntityUnion, options?: OperationOptions): Promise<GetDataSourceCredentialEntityResponse>;
createDetectionConfig(config: Omit<AnomalyDetectionConfiguration, "id">, options?: OperationOptions): Promise<GetDetectionConfigResponse>;
Expand All @@ -999,20 +977,20 @@ export class MetricsAdvisorAdministrationClient {
deleteDetectionConfig(id: string, options?: OperationOptions): Promise<RestResponse>;
deleteHook(id: string, options?: OperationOptions): Promise<RestResponse>;
readonly endpointUrl: string;
getAlertConfig(id: string, options?: OperationOptions): Promise<GetAnomalyAlertConfigurationResponse>;
getAlertConfig(id: string, options?: OperationOptions): Promise<GetAlertConfigResponse>;
getDataFeed(id: string, options?: OperationOptions): Promise<GetDataFeedResponse>;
getDataFeedIngestionProgress(dataFeedId: string, options?: {}): Promise<GetIngestionProgressResponse>;
getDataSourceCredential(id: string, options?: OperationOptions): Promise<GetDataSourceCredentialEntityResponse>;
getDetectionConfig(id: string, options?: OperationOptions): Promise<GetDetectionConfigResponse>;
getHook(id: string, options?: OperationOptions): Promise<GetHookResponse>;
listAlertConfigs(detectionConfigId: string, options?: OperationOptions): PagedAsyncIterableIterator<AnomalyAlertConfiguration, AlertConfigurationsPageResponse, undefined>;
listDataFeedIngestionStatus(dataFeedId: string, startTime: Date | string, endTime: Date | string, options?: ListDataFeedIngestionStatusOptions): PagedAsyncIterableIterator<IngestionStatus, IngestionStatusPageResponse>;
listDataFeeds(options?: ListDataFeedsOptions): PagedAsyncIterableIterator<DataFeed, DataFeedsPageResponse>;
listDataFeeds(options?: ListDataFeedsOptions): PagedAsyncIterableIterator<MetricsAdvisorDataFeed, DataFeedsPageResponse>;
listDataSourceCredential(options?: ListDataSourceCredentialsOptions): PagedAsyncIterableIterator<DataSourceCredentialEntityUnion, CredentialsPageResponse>;
listDetectionConfigs(metricId: string, options?: OperationOptions): PagedAsyncIterableIterator<AnomalyDetectionConfiguration, DetectionConfigurationsPageResponse, undefined>;
listHooks(options?: ListHooksOptions): PagedAsyncIterableIterator<NotificationHookUnion, HooksPageResponse>;
refreshDataFeedIngestion(dataFeedId: string, startTime: Date | string, endTime: Date | string, options?: OperationOptions): Promise<RestResponse>;
updateAlertConfig(id: string, patch: Partial<Omit<AnomalyAlertConfiguration, "id">>, options?: OperationOptions): Promise<GetAnomalyAlertConfigurationResponse>;
updateAlertConfig(id: string, patch: Partial<Omit<AnomalyAlertConfiguration, "id">>, options?: OperationOptions): Promise<GetAlertConfigResponse>;
updateDataFeed(dataFeedId: string, patch: DataFeedPatch, options?: OperationOptions): Promise<GetDataFeedResponse>;
updateDataSourceCredential(id: string, patch: DataSourceCredentialPatch, options?: OperationOptions): Promise<GetDataSourceCredentialEntityResponse>;
updateDetectionConfig(id: string, patch: AnomalyDetectionConfigurationPatch, options?: OperationOptions): Promise<GetDetectionConfigResponse>;
Expand Down Expand Up @@ -1048,6 +1026,28 @@ export class MetricsAdvisorClient {
export interface MetricsAdvisorClientOptions extends PipelineOptions {
}

// @public
export type MetricsAdvisorDataFeed = {
id: string;
name: string;
createdOn: Date;
status: DataFeedStatus;
isAdmin: boolean;
creator: string;
source: DataFeedSource;
schema: DataFeedSchema;
metricIds: Record<string, string>;
granularity: DataFeedGranularity;
ingestionSettings: DataFeedIngestionSettings;
description?: string;
rollupSettings?: DataFeedRollupSettings;
missingDataPointFillSettings?: DataFeedMissingDataPointFillSettings;
accessMode?: DataFeedAccessMode;
adminEmails?: string[];
viewerEmails?: string[];
actionLinkTemplate?: string;
};

// @public
export class MetricsAdvisorKeyCredential {
constructor(subscriptionKey: string, apiKey: string);
Expand All @@ -1071,13 +1071,13 @@ export interface MetricSeriesData {

// @public
export interface MetricSeriesDefinition {
dimension: Record<string, string>;
metricId: string;
seriesKey: Record<string, string>;
}

// @public
export type MetricSeriesGroupDetectionCondition = DetectionConditionsCommon & {
group: DimensionKey;
groupKey: DimensionKey;
};

// @public
Expand All @@ -1091,7 +1091,7 @@ export interface MetricSeriesPageResponse extends Array<MetricSeriesDefinition>

// @public
export type MetricSingleSeriesDetectionCondition = DetectionConditionsCommon & {
series: DimensionKey;
seriesKey: DimensionKey;
};

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function createAlertConfig(
detectionConfigurationId: detectionConfigId,
alertScope: {
scopeType: "Dimension",
dimensionAnomalyScope: { city: "Manila", category: "Handmade" }
seriesGroupInScope: { city: "Manila", category: "Handmade" }
}
}
],
Expand Down Expand Up @@ -101,7 +101,7 @@ async function updateAlertConfig(
detectionConfigurationId: detectionConfigId,
alertScope: {
scopeType: "Dimension",
dimensionAnomalyScope: {
seriesGroupInScope: {
city: "Kolkata",
category: "Shoes Handbags & Sunglasses"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async function createDetectionConfig(
};
const seriesGroupDetectionConditions: MetricSeriesGroupDetectionCondition[] = [
{
group: { city: "Manila" },
groupKey: { city: "Manila" },
conditionOperator: "AND",
changeThresholdCondition: {
anomalyDetectorDirection: "Both",
Expand All @@ -105,7 +105,7 @@ async function createDetectionConfig(
];
const seriesDetectionConditions: MetricSingleSeriesDetectionCondition[] = [
{
series: { city: "Manila", category: "Handmade" },
seriesKey: { city: "Manila", category: "Handmade" },
conditionOperator: "AND",
hardThresholdCondition: {
anomalyDetectorDirection: "Up",
Expand Down Expand Up @@ -152,7 +152,7 @@ async function updateDetectionConfig(
},
seriesGroupDetectionConditions: [
{
group: { city: "Manila" },
groupKey: { city: "Manila" },
conditionOperator: "AND",
hardThresholdCondition: {
anomalyDetectorDirection: "Up",
Expand All @@ -163,7 +163,7 @@ async function updateDetectionConfig(
],
seriesDetectionConditions: [
{
series: { city: "Manila", category: "Handmade" },
seriesKey: { city: "Manila", category: "Handmade" },
conditionOperator: "OR",
changeThresholdCondition: {
anomalyDetectorDirection: "Both",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function listIncidentsForDetectionConfig(
new Date("10/22/2020"),
new Date("10/24/2020"),
{
dimensionFilter: [{ city: "Manila", category: "Shoes Handbags & Sunglasses" }]
seriesGroupKeys: [{ city: "Manila", category: "Shoes Handbags & Sunglasses" }]
}
);
for await (const incident of listIterator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function getEnrichedSeriesData(client: MetricsAdvisorClient, detectionConf

for (const enriched of result) {
console.log("enriched series:");
console.log(enriched.series);
console.log(enriched.seriesKey);
if (enriched.timestamps && enriched.timestamps.length > 0) {
for (let i = 0; i < enriched.timestamps.length; i++) {
console.log(" ----");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function createAlertConfig(adminClient, detectionConfigId) {
detectionConfigurationId: detectionConfigId,
alertScope: {
scopeType: "Dimension",
dimensionAnomalyScope: { city: "Manila", category: "Handmade" }
seriesGroupInScope: { city: "Manila", category: "Handmade" }
}
}
],
Expand Down Expand Up @@ -91,7 +91,7 @@ async function updateAlertConfig(adminClient, alertConfigId, detectionConfigId,
detectionConfigurationId: detectionConfigId,
alertScope: {
scopeType: "Dimension",
dimensionAnomalyScope: {
seriesGroupInScope: {
city: "Kolkata",
category: "Shoes Handbags & Sunglasses"
}
Expand Down
Loading