Azure 指标资源管理器的高级功能Advanced features of Azure Metrics Explorer

Note

本文假定使用者熟悉指标资源管理器的基本功能。This article assumes that you are familiar with basic features of Metrics Explorer.

Azure 中的指标Metrics in Azure

Azure Monitor 中的指标是随着时间的推移收集和存储的一系列测量值和计数。Metrics in Azure Monitor are the series of measured values and counts that are collected and stored over time. 有标准(或“平台”)指标和自定义指标。There are standard (or “platform”) metrics, and custom metrics. 标准指标由 Azure 平台本身提供。The standard metrics are provided to you by the Azure platform itself. 标准指标反映 Azure 资源的运行状况和使用情况统计信息。Standard metrics reflect the health and usage statistics of your Azure resources. 而自定义指标是由应用程序通过用于自定义事件和指标的 Application Insights APIWindows Azure 诊断 (WAD) 扩展Azure Monitor REST API 发送给 Azure 的。Whereas custom metrics are sent to Azure by your applications using the Application Insights API for custom events and metrics, Windows Azure Diagnostics (WAD) extension, or by Azure Monitor REST API.

使用多个指标和图表创建视图Create views with multiple metrics and charts

可以创建一次绘制多个指标行或显示多个指标图表的图表。You can create charts that plot multiple metrics lines or show multiple metric charts at once. 此功能用于:This functionality allows you to:

  • 将同一图形中的相关指标关联到一起,看一个值如何与另一个值相关联。correlate related metrics on the same graph to see how one value is related to another
  • 显示很临近但具有不同度量单位的指标display metrics with different units of measure in close proximity
  • 以视觉方式聚合和比较来自多个源的指标visually aggregate and compare metrics from multiple resources

例如,你有 5 个存储帐户,想要知道在其中消耗了多少总空间,则可创建一个(堆积的)面积图表,以便显示特定时间点的各个值以及所有值的总计。For example, if you have 5 storage accounts and you want to know how much total space is consumed between them, you can create a (stacked) area chart which shows the individual and sum of all the values at particular points in time.

同一图表上的多个指标Multiple metrics on the same chart

首先,创建新图表First, create a new chart. 单击“添加指标”,然后通过同样的步骤在同一图表上添加另一指标。 Click Add Metric and repeat the steps to add another metric on the same chart.

Note

通常情况下,你不会想要在一个图表上拥有度量单位不同(即“毫秒”和“千字节”)或刻度差异显著的多个指标。You typically don’t want to have metrics with different units of measure (i.e. “milliseconds” and “kilobytes”) or with significantly different scale on one chart. 此时,可考虑使用多个图表。Instead, consider using multiple charts. 单击“添加图表”按钮,即可在指标资源管理器中创建多个图表。Click on the Add Chart button to create multiple charts in metrics explorer.

多个图表Multiple charts

单击“添加图表”,使用另一指标创建另一图表。 Click the Add chart and create another chart with a different metric.

将多个图表排序或将其删除Order or delete multiple charts

若要将多个图表排序或将其删除,请单击省略号 ( ... ),以便打开图表菜单并选择适当的菜单项:向上移动向下移动删除To order or delete multiple charts, click on the ellipses ( ... ) symbol to open the chart menu and choose the appropriate menu item of Move up, Move down, or Delete.

向图表应用筛选器Apply filters to charts

可以将筛选器应用到显示多维指标的图表。You can apply filters to the charts that show metrics with dimensions. 例如,如果指标“事务计数”具有指示事务的响应成功与否的维度“响应类型”,则在此维度上进行筛选将只绘制成功(或失败)事务的折线图。For example, if the metric “Transaction count” has a dimension, “Response type”, which indicates whether the response from transactions succeeded or failed then filtering on this dimension would plot a chart line for only successful (or only failed) transactions.

添加筛选器To add a filter

  1. 选择图表上方的“添加筛选器” Select Add filter above the chart

  2. 选择想要筛选的维度(属性)Select which dimension (property) you want to filter

    图表上的

  3. 选择想要在绘制图表时包含的维度值(此示例将显示筛选出了成功的存储事务):Select which dimension values you want to include when plotting the chart (this example shows filtering out the successful storage transactions):

    指标图

  4. 选择筛选值后,在“筛选选择器”之外单击将其关闭。After selecting the filter values, click away from the Filter Selector to close it. 现在图表将显示失败的存储事务数:Now the chart shows how many storage transactions have failed:

    图表上的

  5. 可以重复步骤 1-4 将多个筛选器应用到同一个图表。You can repeat steps 1-4 to apply multiple filters to the same charts.

对图表应用拆分Apply splitting to a chart

可以按维度拆分指标,以直观地显示指标不同部分之间的差异,并标识出某个维度的边远部分。You can split a metric by dimension to visualize how different segments of the metric compare against each other, and identify the outlying segments of a dimension.

应用拆分Apply splitting

  1. 单击图表上方的“应用拆分” 。Click on Apply splitting above the chart.

    Note

    不能对包含多个指标的图表使用拆分。Splitting cannot be used with charts that have multiple metrics. 另外,你可以有多个筛选器,但只能对任何单个图表应用一个拆分维度。Also, you can have multiple filters but only one splitting dimension applied to any single chart.

  2. 选择想要用于分割图表的维度:Choose a dimension on which you want to segment your chart:

    图表上的

    现在图表将显示多个折线图,每个维度部分均有一个:Now the chart now shows multiple lines, one for each segment of dimension:

    图表上的

  3. 在“分组选择器” 之外单击以将其关闭。Click away from the Grouping Selector to close it.

    Note

    在同一个维度上同时使用筛选和拆分,可以隐藏与你的方案无关的部分,使图表更易读取。Use both Filtering and Splitting on the same dimension to hide the segments that are irrelevant for your scenario and make charts easier to read.

锁定图表 y 轴的边界Lock boundaries of chart y-axis

当图表显示较大值的较小波动时,锁定 y 轴的范围变得很重要。Locking the range of the y-axis becomes important when the chart shows smaller fluctuations of larger values.

例如,如果成功请求的数量从 99.99% 下降到 99.5%,这可能表示服务质量显著降低。For example, when the volume of successful requests drops down from 99.99% to 99.5%, it may represent a significant reduction in the quality of service. 不过,使用默认的图表设置时,观察小的数值波动很困难,甚至不可能实现。However, noticing a small numeric value fluctuation would be difficult or even impossible from the default chart settings. 在这种情况下,你可以将图表的最低边界锁定到 99%,这将使此较小的降低更加明显。In this case you could lock the lowest boundary of the chart to 99%, which would make this small drop more apparent.

另一个示例是可用内存的波动,其中的值在技术上永远不会达到 0。Another example is a fluctuation in the available memory, where the value will technically never reach 0. 将范围固定到一个较高的值可以使可用内存的降低更容易被发现。Fixing the range to a higher value may make the drops in available memory easier to spot.

若要控制 y 轴范围,请使用 “…”To control the y-axis range, use the “…” 图表菜单,并选择“编辑图表” 以访问高级图表设置。chart menu, and select Edit chart to access advanced chart settings. 修改“Y 轴范围”部分中的值,或者使用“自动” 按钮恢复为默认值。Modify the values in the Y-Axis Range section, or use Auto button to revert to defaults.

图表上的

Warning

如果图表用于跟踪一段时间内的各种计数或合计(并因此使用计数、求和、最小值或最大值聚合),要锁定这类图表的 y 轴边界,通常需要指定一个固定的时间粒度,而不是依赖于自动默认值。Locking the boundaries of y-axis for the charts that track various counts or sums over a period of time (and thus use count, sum, minimum, or maximum aggregations) usually requires specifying a fixed time granularity rather than relying on the automatic defaults. 这是必要的,因为当用户通过调整浏览器窗口大小或者通过更改屏幕分辨率来自动修改时间粒度时,图表上的值也会发生更改。This is necessary is because the values on charts change when the time granularity is automatically modified by the user resizing browser window or going from one screen resolution to another. 时间粒度发生的更改会影响图表的外观,导致当前选择的 y 轴范围失效。The resulting change in time granularity effects the look of the chart, invalidating current selection of y-axis range.

将图表固定到仪表板Pin charts to dashboards

配置图表后,可能需要将其添加到仪表板,以便可以再次查看它(可能是在其他监视遥测的上下文中)或与团队共享。After configuring the charts, you may want to add it to the dashboards so that you can view it again, possibly in context of other monitoring telemetry, or share with your team.

将配置的图表固定到仪表板:To pin a configured chart to a dashboard:

配置图表后,单击图表右上角的“图表操作” 菜单,然后单击“固定到仪表板” 。After configuring your chart, click on the Chart Actions menu in the right top corner of the chart, and click Pin to dashboard.

图表上的

创建警报规则Create alert rules

可以使用设置的条件将指标可视化为基于指标的警报规则的基础。You can use the criteria you have set to visualize your metrics as the basis of a metric based alert rule. 新的警报规则将包括图表的目标资源、指标、拆分和筛选器维度。The new alerting rule will include your target resource, metric, splitting, and filter dimensions from your chart. 稍后将能够在警报规则创建窗格上修改这些设置。You will be able to modify these settings later on the alert rule creation pane.

单击“新建警报规则”,创建新的警报规则 To create a new alert rule, click New Alert rule

以红色突出显示的“新建警报规则”按钮

则会转到警报规则创建窗格,其中预先填充了来自你的图表的底层指标维度,以便更轻松地生成自定义警报规则。You will be taken to the alert rule creation pane with the underlying metric dimensions from your chart pre-populated to make it easier to generate custom alert rules.

创建警报规则

若要详细了解如何设置指标警报,请查看此文章Check out this article to learn more about setting up metric alerts.

故障排除Troubleshooting

图表中未显示任何数据。I don't see any data on my chart.

  • 筛选器将应用到窗格中的所有图表。Filters apply to all the charts on the pane. 将焦点放在某个图表上时,请确保未在其他图表上设置会排除所有数据的筛选器。Make sure that, while you're focusing on one chart, you didn't set a filter that excludes all the data on another.

  • 如果想要在不同的图表上设置不同的筛选器,请在不同的边栏选项卡中创建图表,将它们保存为独立的收藏项。If you want to set different filters on different charts, create them in different blades, save them as separate favorites. 如果需要,可将这些图表固定到仪表板,以便并排查看这些图表。If you want, you can pin them to the dashboard so that you can see them alongside each other.

  • 如果根据指标上未定义的属性对图表进行分段,则图表中不会显示任何数据。If you segment a chart by a property that is not defined on the metric, then there will be nothing on the chart. 请尝试清除分段(拆分),或选择其他属性。Try clearing the segmentation (splitting), or choose a different property.

后续步骤Next steps

请参阅创建自定义 KPI 仪表板,了解使用指标创建可操作仪表板的最佳实践。Read Creating custom KPI dashboards to learn about the best practices for creating actionable dashboards with metrics.