快速入门:使用 Web 门户监视你的首个指标Quickstart: Monitor your first metric using the web portal

预配指标顾问实例时,可以使用 API 和基于 Web 的工作区来处理服务。When you provision a Metrics Advisor instance, you can use the APIs and web-based workspace to work with the service. 可以使用基于 Web 的工作区充当快速开始使用该服务的简单方法。The web-based workspace can be used as a straightforward way to quickly get started with the service. 它还提供了一种用于配置设置、自定义模型和执行根本原因分析的可视方式。It also provides a visual way to configure settings, customize your model, and perform root cause analysis.

  • 载入指标数据Onboard your metric data
  • 查看指标和可视化效果View your metrics and visualizations
  • 微调检测配置Fine-tune detection configurations
  • 浏览诊断见解Explore diagnostic insights
  • 创建并订阅异常警报Create and subscribe to anomaly alerts

先决条件Prerequisites

提示

  • 部署指标顾问资源可能需要 10 到 30 分钟。It may 10 to 30 minutes for your Metrics Advisor resource to deploy. 部署成功后,单击“转到资源”。Click Go to resource once it successfully deploys.
  • 如果想要使用 REST API 与服务进行交互,需要从创建的资源获取密钥和终结点。If you'd like to use the REST API to interact with the service, you will need the key and endpoint from the resource you create. 可以在创建的资源的“密钥和终结点”选项卡中找到它们。You can find them in the Keys and endpoints tab in the created resource.

本文档使用 SQL 数据库作为创建首个监视器的示例。This document uses a SQL Database as an example for creating your first monitor.

登录到工作区Sign in to your workspace

创建资源后,登录到指标顾问门户After your resource is created, sign in to Metrics Advisor portal. 选择工作区以开始监视指标。Select your workspace to start monitoring your metrics.

目前可以在每个可用区域创建一个指标顾问资源。Currently you can create one Metrics Advisor resource at each available region. 你可以随时在指标顾问门户中切换工作区。You can switch workspaces in Metrics Advisor portal at any time.

载入时序数据Onboard time series data

指标顾问为不同的数据源(例如 SQL 数据库、Azure 数据资源管理器和 Azure 表存储)提供了连接器。Metrics Advisor provides connectors for different data sources, such as SQL Database, Azure Data Explorer, and Azure Table Storage. 对于不同的连接器,连接数据的步骤是相似的,尽管某些配置参数可能会有所不同。The steps for connecting data are similar for different connectors, although some configuration parameters may vary. 有关特定数据源的必需参数,请参阅连接来自不同源的数据See connect your data from different sources for the required parameters for specific data sources.

本快速入门使用 SQL 数据库作为示例。This quickstart uses a SQL Database as an example. 你还可以按相同的步骤引入自己的数据。You can also ingest your own data follow the same steps.

首先使用 Active Directory 帐户登录到指标顾问工作区。To get started, sign into your Metrics Advisor workspace, with your Active Directory account. 在登录页上,选择刚创建的“目录”、“订阅”和“工作区”,然后单击“开始使用” 。From the landing page, select your Directory , Subscription and Workspace that just created, then click Get started . 加载工作负载的主页后,从左侧菜单中选择“添加数据馈送”。After the main page of the workload loads, select Add data feed from the left menu.

数据架构要求和配置Data schema requirements and configuration

指标监视器是一种用于时序异常检测、诊断和分析的服务。Metrics Monitor is a service for time series anomaly detection, diagnostics and analysis. 作为由 AI 提供支持的服务,它使用你的数据来训练所使用的模型。As an AI powered service, it uses your data to train the model used. 服务接受具有以下各列的聚合数据表:The service accepts tables of aggregated data with the following columns:

  • 度量值 (必需):一个或多个包含数值的列。Measure (required): one or more columns containing numeric values.
  • 时间戳 (可选):零个或一个类型为 DateTimeString 的列。Timestamp (optional): zero or one column with type of DateTime or String. 如果未设置此列,则时间戳将设置为每个引入周期的开始时间。When this column is not set, the timestamp is set as the start time of each ingestion period. 将时间戳格式设置为:yyyy-MM-ddTHH:mm:ssZFormat the timestamp into: yyyy-MM-ddTHH:mm:ssZ.
    • 时间戳应与指标的粒度匹配。例如,每日指标应确保时间戳上的小时、分钟和秒标记为 00:00:00Your timestamp should match the granularity of the metric. For example, a daily metric should ensure the hour, minute and second on the timestamp labeled as 00:00:00 .
  • 维度 (可选):列可以是任意数据类型。Dimension (optional): Columns can be of any data type. 处理大量的列和值时要格外小心,应避免处理过多的维度。Be cautious when working with large volumes of columns and values, to prevent excessive numbers of dimensions from being processed.

备注

对于每个指标,每个度量值只能有一个时间戳,对应于一个维度组合。For each metric, there should only be one timestamp per measure, corresponding to one dimension combination. 在载入之前对数据进行聚合,或者使用查询来指定要引入的数据。Aggregate your data ahead of onboarding or use the query to specify the data to be ingested.

配置连接设置Configure connection settings

提示

有关可用参数的详细信息,请参阅如何添加数据馈送See how to add data feeds for details on the available parameters.

通过连接到时序数据源来添加数据馈送。Add the data feed by connecting to your time-series data source. 首先选择以下参数:Start by selecting the following parameters:

  • 源类型 :用于存储时序数据的数据源的类型。Source Type : The type of data source where your time series data is stored.
  • 粒度 :时序数据中连续数据点之间的间隔,例如每年、每月、每天。Granularity : The interval between consecutive data points in your time series data, for example Yearly, Monthly, Daily. 自定义支持的最小间隔为 60 秒。The lowest interval customization supports is 60 seconds.
  • 引入数据的时间 (UTC) :要引入的第一个时间戳的开始时间。Ingest data since (UTC) : The start time for the first timestamp to be ingested.

接下来,使用数据源的凭据指定字符串,并使用自定义查询 。Next, specify the Connection string with the credentials for your data source, and a custom Query . 此查询用于指定要引入并转换为所需架构的数据。The query is used to specify the data to be ingested, and converted into the required schema.

在查询中,使用 @StartTime 参数获取单一时间戳的指标数据。Within the query use the @StartTime parameter to get metric data for a single timestamp. 指标顾问将在运行查询时将参数替换为 yyyy-MM-ddTHH:mm:ss 格式字符串。Metrics Advisor will replace the parameter with a yyyy-MM-ddTHH:mm:ss format string when it runs the query.

重要

对于每个维度组合,查询应在每个时间戳处最多返回一条记录。The query should return at most one record for each dimension combination, at each timestamp. 查询返回的所有记录必须具有相同的时间戳。And all records returned by the query must have the same timestamps. 指标顾问将针对每个时间戳运行此查询以引入数据。Metrics Advisor will run this query for each timestamp to ingest your data. 有关详细信息和示例,请参阅查询常见问题解答部分See the FAQ section on queries for more information, and examples.

连接设置

验证连接并加载数据架构Verify the connection and load the data schema

创建连接字符串和查询字符串后,选择“验证并获取架构”验证连接并运行查询以从数据源获取数据架构。After the connection string and query string are created, select Verify and get schema to verify the connection and run the query to get your data schema from the data source. 通常,这会花费几秒钟的时间,具体取决于你的数据源连接。Normally it takes a few seconds depending on your data source connection. 如果此步骤中出现错误,请确认:If there's an error at this step, confirm that:

  1. 你的连接字符串和查询是正确的。Your connection string and query are correct.
  2. 如果有防火墙设置,指标顾问实例能够连接到数据源。Your Metrics Advisor instance is able to connect to the data source if there are firewall settings.

架构配置Schema configuration

加载数据架构并按如下显示后,选择适当的字段。Once the data schema is loaded and shown like below, select the appropriate fields.

选择Selection 说明Description 说明Notes
TimestampTimestamp 数据点的时间戳。The timestamp of a data point. 如果省略,则指标顾问将在数据点引入时使用时间戳。If omitted, Metrics Advisor will use the timestamp when the data point is ingested instead. 对于每个数据馈送,最多可将一列指定为时间戳。For each data feed, you could specify at most one column as timestamp. 可选。Optional. 最多只能指定一列。Should be specified with at most one column.
度量 Measure 数据馈送中的数值。The numeric values in the data feed. 对于每个数据馈送,可以指定多个度量值,但至少应选择一列作为度量值。For each data feed, you could specify multiple measures but at least one column should be selected as measure. 应至少指定一列。Should be specified with at least one column.
维度Dimension 分类值。Categorical values. 不同值的组合标识特定的一维时序,例如:国家/地区、语言、租户。A combination of different values identifies a particular single-dimension time series, for example: country, language, tenant. 可以不选择列或选择任意数量的列作为维度。You could select none or arbitrary number of columns as dimensions. 注意:如果要选择非字符串列作为维度,请小心以避免维度爆炸。Note: if you're selecting a non-string column as dimension, be cautious with dimension explosion. 可选。Optional.
忽略Ignore 忽略所选列。Ignore the selected column.

架构配置

自动汇总设置Automatic roll up settings

重要

如果想要启用根本原因分析和其他诊断功能,则需要配置“自动汇总设置”。If you'd like to enable root cause analysis and other diagnostic capabilities, 'automatic roll up setting' needs to be configured. 启用后,将无法更改自动汇总设置。Once enabled, the automatic roll up settings cannot be changed.

指标顾问可以在引入过程中自动对每个维度执行聚合(SUM/MAX/MIN…),然后生成一个用于根本原因分析和其他诊断功能的层次结构。Metrics Advisor can automatically perform aggregation(SUM/MAX/MIN...) on each dimension during ingestion, then builds a hierarchy which will be used in root case analysis and other diagnostic features. 有关更多详细信息,请参阅自动汇总设置See Automatic roll up settings for more details.

为数据馈送提供自定义名称,该名称将显示在工作区中。Give a custom name for the data feed, which will be displayed in your workspace. 单击“提交”。Click on Submit .

优化检测配置Tune detection configuration

添加数据馈送后,指标顾问将尝试从指定的开始日期引入指标数据。After the data feed is added, Metrics Advisor will attempt to ingest metric data from the specified start date. 完全引入数据需要一段时间,可以通过单击数据馈送页顶部的“引入进度”来查看引入状态。It will take some time for data to be fully ingested, and you can view the ingestion status by clicking Ingestion progress at the top of the data feed page. 如果数据已引入,指标顾问将应用检测,并继续监视源以获取新数据。If data is ingested, Metrics Advisor will apply detection, and continue to monitor the source for new data.

应用检测时,单击数据馈送中列出的其中一项指标,找到“指标详细信息”页并执行以下操作:When detection is applied, click one of the metrics listed in data feed to find the Metric detail page to:

  • 查看此指标下所有时序切片的可视化效果View visualizations of all time series slices under this metric
  • 更新检测配置以满足预期的结果Update detecting configuration to meet expected results
  • 为检测到的异常设置通知Set up notification for detected anomalies

指标详细信息

查看诊断见解View the diagnostic insights

优化检测配置后,发现的异常应反映数据中的实际异常。After tuning the detection configuration, anomalies that are found should reflect actual anomalies in your data. 指标顾问针对多维指标执行分析,如异常群集、事件关联和根本原因分析。Metrics Advisor performs analysis on multi-dimensional metrics, like anomaly clustering, incident correlation and root cause analysis. 使用这些功能分析和诊断数据中的事件。Use these features to analyze and diagnose incidents in your data.

要查看诊断见解,请单击时序可视化效果上的红点,这些红点代表检测到的异常。To view the diagnostic insights, click on the red dots on time series visualizations, which represent detected anomalies. 将显示一个窗口,其中包含“事件分析”页的链接。A window will appear with a link to incident analysis page.

事件链接

单击此链接后,将切换到事件分析页,该页面将分析相应的异常,并提供一系列诊断见解。After clicking the link, you will be pivoted to the incident analysis page which analyzes on corresponding anomaly, with a bunch of diagnostics insights. 顶部将显示有关事件的统计信息,如“严重性”、“涉及的异常”以及“开始时间”和“结束时间” 。At the top, there will be statistics about the incident, such as Severity , Anomalies involved , and impacted Start time and End time .

接下来,你将看到事件的上级异常,以及自动生成的根本原因建议。Next you'll see the ancestor anomaly of the incident, and automated root-cause advice. 此自动根本原因建议是通过分析所有相关异常的事件树生成的,包括:偏差、分布和对父异常的贡献。This automated root cause advice is generated by analyzing the incident tree of all related anomalies, including: deviation, distribution and contribution to the parent anomalies.

事件诊断

基于这些信息,你已经可以对正在发生的事情和事件的影响以及最潜在的根本原因有一个直观的看法。Based on these, you can already get a straightforward view of what is happening and the impact of the incident as well as the most potential root cause. 这样便能够立即采取行动尽快解决事件。So that immediate action could be taken to resolve incident as soon as possible.

但你还可以获取和利用更多诊断见解,方法是利用其他诊断功能按维度向下钻取异常、查看相似异常并跨指标进行比较。But you can also pivot across more diagnostics insights leveraging additional features to drill down anomalies by dimension, view similar anomalies and do comparison across metrics. 有关详细信息,请参阅如何:诊断事件Please find more at How to: diagnose an incident.

发现新的异常时获取通知Get notified when new anomalies are found

如果想要在数据中检测到异常时收到警报,可以为一个或多个指标创建订阅。If you'd like to get alerted when an anomaly is detected in your data, you can create a subscription for one or more of your metrics. 指标顾问使用挂钩发送警报。Metrics Advisor uses hooks to send alerts. 支持三种类型的挂钩:电子邮件挂钩、Webhook 和 Azure DevOps。Three types of hooks are supported: email hook, web hook and Azure DevOps. 我们以 Webhook 为例。We'll use web hook as an example.

创建 WebhookCreate a web hook

Webhook 是通过编程方式从指标顾问服务获取异常通知的入口点,该服务会在触发警报时调用用户提供的 API。有关如何创建挂钩的详细信息,请参阅操作说明:使用挂钩配置警报并获取通知的“创建挂钩”部分。A web hook is the entry point to get anomaly noticed by a programmatic way from the Metrics Advisor service, which calls a user-provided API when an alert is triggered.For details on how to create a hook, please refer to the Create a hook section in How-to: Configure alerts and get notifications using a hook.

配置警报设置Configure alert settings

创建挂钩后,警报设置将确定应发送的警报通知和发送方式。After creating a hook, an alert setting determines how and which alert notifications should be sent. 可以为每个指标设置多个警报设置。You can set multiple alert settings for each metric. 有两个重要的设置:警报对象,用于指定要包含的异常;筛选异常选项,用于定义要包含在警报中的异常 。two important settings are Alert for which specifies the anomalies to be included, and Filter anomaly options which defines which anomalies to include in the alert. 有关更多详细信息,请参阅:使用挂钩配置警报并获取通知中的“添加或编辑警报设置”部分。See the Add or Edit alert settings section in How-to: Configure alerts and get notifications using a hook for more details.

后续步骤Next steps