了解用于 Azure Spring Cloud 的指标Understand metrics for Azure Spring Cloud

Azure 指标资源管理器是 Azure 门户的一个组件,通过它可以绘制图表、以直观的形式关联趋势,以及研究指标的上升和下降。Azure Metrics explorer is a component of the Azure portal that allows plotting charts, visually correlating trends, and investigating spikes and dips in metrics. 使用指标资源管理器调查资源的运行状况和利用率。Use the metrics explorer to investigate the health and utilization of your resources.

Azure Spring Cloud 中有两个指标视点。In Azure Spring Cloud, there are two viewpoints for metrics.

  • 每个应用程序概览页中的图表Charts in each application overview page
  • 常用指标页Common metrics page

指标图表

应用程序“概览”中的图表为每个应用程序提供快速的状态检查。Charts in the application Overview provide quick status checks for each application. 常用“指标”页包含可供参考的所有指标。The common Metrics page contains all metrics available for reference. 可以在常用指标页中构建你自己的图表,然后在“仪表板”中固定它们。You can build your own charts in the common metrics page and pin them in Dashboard.

应用程序概览页Application overview page

在“应用”中选择一个应用,以在概览页中查找图表。Select an app in Apps to find charts in the overview page.

应用程序指标管理

每个应用程序的“应用程序概览”页都会提供一个指标图表,用于对应用程序进行快速状态检查。Each application's Application Overview page presents a metrics chart that allows you to perform a quick status check of your application.

应用程序指标概览

Azure Spring Cloud 提供以下五个图表,其中的指标每分钟更新一次:Azure Spring Cloud provides these five charts with metrics that are updated every minute:

  • Http 服务器错误:向应用发出的 HTTP 请求的错误计数Http Server Errors: Error count for HTTP requests to your app
  • 数据输入:应用接收的字节数Data In: Bytes received by your app
  • 数据输出:应用发送的字节数Data Out: Bytes sent by your app
  • 请求:应用接收的请求数Requests: Requests received by your app
  • 平均响应时间:应用的平均响应时间Average Response Time: Average response time from your app

对于图表,你可以选择一小时到七天的时间范围。For the chart, you can select a time range from one hour to seven days.

常用指标页Common metrics page

左侧导航窗格中的“指标”链接到常用指标页。The Metrics in the left navigation pane links to the common metrics page.

首先,选择要查看的指标:First, select metrics to view:

选择指标视图

有关所有指标选项的详细信息,可参阅以下部分Details of all metrics options can be found in the section below.

接下来,为每个指标选择聚合类型:Next, select aggregation type for each metric:

指标聚合

聚合类型指示如何按时间对图表中的指标点进行聚合。The aggregation type indicates how to aggregate metric points in the chart by time. 每分钟有一个原始指标点,一分钟内的预聚合类型由指标类型预定义。There is one raw metric point every minute, and the pre-aggregation type within a minute is pre-defined by metrics type.

  • 总和:将所有值的和显示为目标输出。Sum: Sum all values as target output.
  • 平均值:将时段中的“平均”值用作目标输出。Average: Use the Average value in the period as target output.
  • 最大值/最小值:将时段中的“最大/最小”值用作目标输出。Max/Min: Use the Max/Min value in the period as target output.

还可以将时间范围从过去 30 分钟调整为过去 30 天或某个自定义时间范围。The time range can also be adjusted from last 30 minutes to last 30 days or a custom time range.

指标修改

默认视图包括某个 Azure Spring Cloud 服务的应用程序的所有指标。The default view includes all of an Azure Spring Cloud service's application's metrics together. 可以在显示中筛选一个应用或实例的指标。Metrics of one app or instance can be filtered in the display. 单击“添加筛选器”,将属性设置为“应用”,然后在“值”文本框中选择要监视的目标应用程序。 Click Add filter, set the property to App, and select the target application you want to monitor in the Values text box.

你可以使用两种类型的筛选器(属性):You can use two kinds of filters (properties):

  • 应用:按应用名称筛选App: filter by app name
  • 实例:按应用实例筛选Instance: filter by app instance

指标筛选器

你还可以使用“应用拆分”选项,该选项将为一个应用绘制多个行:You can also use the Apply splitting option, which will draw multiple lines for one app:

指标拆分

提示

可以在指标页中构建你自己的图表,然后将其固定到“仪表板”。You can build your own charts on the metrics page and pin them to your Dashboard. 一开始,为图表命名。Start by naming your chart. 接下来,选择“固定到右上角的仪表板”。Next, select Pin to dashboard in the top right corner. 现在可以在门户“仪表板”中检查应用程序了。You can now check on your application at your Portal Dashboard.

用户指标选项User metrics options

下表显示了可用的指标和详细信息。The following tables show the available metrics and details.

错误Error

名称Name Spring Actuator 指标名称Spring Actuator Metric Name 计价单位Unit 详细信息Details
tomcat.global.errortomcat.global.error tomcat.global.errortomcat.global.error 计数Count 已处理的请求中发生的错误数Number of errors that occurred in processed requests

性能Performance

名称Name Spring Actuator 指标名称Spring Actuator Metric Name 计价单位Unit 详细信息Details
system.cpu.usagesystem.cpu.usage system.cpu.usagesystem.cpu.usage 百分比Percent 整个系统最近的 CPU 使用率。Recent CPU usage for the whole system. 此值为 [0.0,1.0] 区间中的一个双精度值。This value is a double in the [0.0,1.0] interval. 如果值为 0.0,则表示在所观察的最近一段时间内所有 CPU 都处于空闲状态,而如果值为 1.0,则表示在所观察的最近一段时间内所有 CPU 都一直在主动运行。A value of 0.0 means that all CPUs were idle during the recent period of time observed, while a value of 1.0 means that all CPUs were actively running 100% of the time during the recent period being observed.
process.cpu.usageprocess.cpu.usage 应用 CPU 使用率百分比App CPU Usage Percentage 百分比Percent Java 虚拟机进程最近的 CPU 使用率。Recent CPU usage for the Java Virtual Machine process. 此值为 [0.0,1.0] 区间中的一个双精度值。This value is a double in the [0.0,1.0] interval. 如果值为 0.0,则表示在所观察的最近一段时间内,任何 CPU 都未运行 JVM 进程中的线程,而如果值为 1.0,则表示在所观察的最近一段时间内,所有 CPU 都一直在主动运行 JVM 中的线程。A value of 0.0 means that none of the CPUs were running threads from the JVM process during the recent period of time observed, while a value of 1.0 means that all CPUs were actively running threads from the JVM 100% of the time during the recent period being observed. JVM 中的线程包括应用程序线程以及 JVM 内部线程。Threads from the JVM include the application threads as well as the JVM internal threads.
jvm.memory.committedjvm.memory.committed jvm.memory.committedjvm.memory.committed 字节Bytes 表示保证可供 JVM 使用的内存量。Represents the amount of memory that is guaranteed to be available for use by the JVM. JVM 可能会向系统释放内存,其提交的值可能小于初始值。The JVM may release memory to the system and committed could be less than init. 提交的值将始终大于或等于使用的值。committed will always be greater than or equal to used.
jvm.memory.usedjvm.memory.used jvm.memory.usedjvm.memory.used 字节Bytes 表示当前使用的内存量(字节)。Represents the amount of memory currently used in bytes.
jvm.memory.maxjvm.memory.max jvm.memory.maxjvm.memory.max 字节Bytes 表示可用于内存管理的最大内存量。Represents the maximum amount of memory that can be used for memory management. 使用的和提交的内存量将始终少于或等于最大内存量(如果已定义最大内存量)。The amount of used and committed memory will always be less than or equal to max if max is defined. 如果在进行内存分配时尝试提高使用的内存,使得使用的内存 > 提交的内存,则即使使用的内存 <= 最大内存(例如,当系统的虚拟内存较低时),内存分配也可能会失败。A memory allocation may fail if it attempts to increase the used memory such that used > committed even if used <= max would still be true (for example, when the system is low on virtual memory).
jvm.gc.max.data.sizejvm.gc.max.data.size jvm.gc.max.data.sizejvm.gc.max.data.size 字节Bytes 自 Java 虚拟机启动以来旧代内存池的峰值内存使用量。The peak memory usage of the old generation memory pool since the Java virtual machine was started.
jvm.gc.live.data.sizejvm.gc.live.data.size jvm.gc.live.data.sizejvm.gc.live.data.size 字节Bytes 完全 GC 后的旧代内存池大小。Size of old generation memory pool after a full GC.
jvm.gc.memory.promotedjvm.gc.memory.promoted jvm.gc.memory.promotedjvm.gc.memory.promoted 字节Bytes 从 GC 之前到 GC 之后这段时间,旧代内存池大小正增加的计数。Count of positive increases in the size of the old generation memory pool before GC to after GC.
jvm.gc.memory.allocatedjvm.gc.memory.allocated jvm.gc.memory.allocatedjvm.gc.memory.allocated 字节Bytes 运行一个 GC 之后,在运行下一个 GC 之前,新代内存池大小增加的递增量。Incremented for an increase in the size of the young generation memory pool after one GC to before the next.
jvm.gc.pause.total.countjvm.gc.pause.total.count jvm.gc.pause (total-count)jvm.gc.pause (total-count) 计数Count 此 JMV 启动后的总 GC 计数,包括新代和旧代 GC。Total GC count after this JMV started, including Young and Old GC.
jvm.gc.pause.total.timejvm.gc.pause.total.time jvm.gc.pause (total-time)jvm.gc.pause (total-time) 毫秒Milliseconds 此 JMV 启动后消耗的总 GC 时间,包括新代和旧代 GC。Total GC time consumed after this JMV started, including Young and Old GC.

性能 (.NET)Performance (.NET)

名称Name Spring Actuator 指标名称Spring Actuator Metric Name 计价单位Unit 详细信息Details
CPU 使用率CPU usage cpu-usagecpu-usage 毫秒Milliseconds 进程使用 CPU 的时间。Amount of time the process has utilized the CPU.
工作集Working set working-setworking-set 兆字节Megabytes 进程所使用的工作集数量。Amount of working set used by the process.
GC 堆大小GC heap size gc-heap-sizegc-heap-size 兆字节Megabytes 垃圾回收器报告的堆总大小。Total heap size reported by the garbage collector.
第 0 代 GC 计数Gen 0 GC count gen-0-gc-countgen-0-gc-count 计数Count 每秒第 0 代垃圾回收数。Number of Generation 0 garbage collections per second.
第 1 代 GC 计数Gen 1 GC count gen-1-gc-countgen-1-gc-count 计数Count 每秒第 1 代垃圾回收数。Number of Generation 1 garbage collections per second.
第 2 代 GC 计数Gen 2 GC count gen-2-gc-countgen-2-gc-count 计数Count 每秒第 2 代垃圾回收数。Number of Generation 2 garbage collections per second.
Gen 0 heap size(第 0 代堆大小)Gen 0 heap size gen-0-sizegen-0-size 字节Bytes 第 0 代堆大小。Generation 0 heap size.
Gen 1 heap size(第 1 代堆大小)Gen 1 heap size gen-1-sizegen-1-size 字节Bytes 第 1 代堆大小。Generation 1 heap size.
Gen 2 heap size(第 2 代堆大小)Gen 2 heap size gen-2-sizegen-2-size 字节Bytes 第 2 代堆大小。Generation 2 heap size.
LOH 堆大小LOH heap size loh-sizeloh-size 字节Bytes 大型对象堆堆大小。Large Object Heap heap size.
分配速率Allocation rate alloc-ratealloc-rate 字节Bytes 每秒分配的字节数。Number of bytes allocated per second.
程序集计数Assembly count assembly-countassembly-count 计数Count 已加载的程序集数。Number of assemblies loaded.
异常计数Exception count exception-countexception-count 计数Count 每秒异常数。Number of exceptions per second.
线程池线程计数Thread pool thread count threadpool-thread-countthreadpool-thread-count 计数Count 线程池线程数。Number of thread pool threads.
监视器锁争用计数Monitor lock contention count monitor-lock-contention-countmonitor-lock-contention-count 计数Count 尝试获取监视器锁时每秒发生争用的次数。The number of times per second there was contention when trying to take a monitor's lock.
线程池队列长度Thread pool queue length threadpool-queue-lengththreadpool-queue-length 计数Count 线程池工作项队列长度。Thread pool work items queue length.
线程池已完成项计数Thread pool completed items count threadpool-completed-items-countthreadpool-completed-items-count 计数Count 线程池已完成工作项计数。Thread pool completed work items count.
活动计时器计数Active timers count active-timer-countactive-timer-count 计数Count 当前处于活动状态的计时器数。The number of timers that are currently active. 活动计时器是注册为在将来某个时间点计时且尚未取消的计时器。An active timer is one that is registered to tick at some point in the future, and has not yet been canceled.

有关详细信息,请参阅 dotnet 计数器For more information, see dotnet counters.

请求Request

名称Name Spring Actuator 指标名称Spring Actuator Metric Name 计价单位Unit 详细信息Details
tomcat.global.senttomcat.global.sent tomcat.global.senttomcat.global.sent 字节Bytes Tomcat Web 服务器发送的数据量Amount of data Tomcat web server sent
tomcat.global.receivedtomcat.global.received tomcat.global.receivedtomcat.global.received 字节Bytes Tomcat Web 服务器接收的数据量Amount of data Tomcat web server received
tomcat.global.request.total.counttomcat.global.request.total.count tomcat.global.request (total-count)tomcat.global.request (total-count) 计数Count Tomcat Web 服务器处理的请求总数Total count of Tomcat web server processed requests
tomcat.global.request.maxtomcat.global.request.max tomcat.global.request.maxtomcat.global.request.max 毫秒Milliseconds Tomcat Web 服务器用于处理请求的最长时间Maximum time of Tomcat web server to process a request

请求 (.NET)Request (.NET)

名称Name Spring Actuator 指标名称Spring Actuator Metric Name 计价单位Unit 详细信息Details
每秒请求数Requests per second requests-per-secondrequests-per-second 计数Count 请求速率。Request rate.
请求总数Total requests total-requeststotal-requests 计数Count 总请求数。Total number of requests.
当前请求数Current requests current-requestscurrent-requests 计数Count 当前请求的数目。Number of current requests.
失败的请求Failed requests failed-requestsfailed-requests 计数Count 失败的请求数。Number of failed requests.

有关详细信息,请参阅 dotnet 计数器For more information, see dotnet counters.

会话Session

名称Name Spring Actuator 指标名称Spring Actuator Metric Name 计价单位Unit 详细信息Details
tomcat.sessions.active.maxtomcat.sessions.active.max tomcat.sessions.active.maxtomcat.sessions.active.max 计数Count 同时处于活动状态的会话的最大数量Maximum number of sessions that have been active at the same time
tomcat.sessions.alive.maxtomcat.sessions.alive.max tomcat.sessions.alive.maxtomcat.sessions.alive.max 毫秒Milliseconds 过期会话处于活动状态的最长时间(秒)Longest time (in seconds) that an expired session was alive
tomcat.sessions.createdtomcat.sessions.created tomcat.sessions.createdtomcat.sessions.created 计数Count 已创建的会话数Number of sessions that have been created
tomcat.sessions.expiredtomcat.sessions.expired tomcat.sessions.expiredtomcat.sessions.expired 计数Count 已过期的会话数Number of sessions that have expired
tomcat.sessions.rejectedtomcat.sessions.rejected tomcat.sessions.rejectedtomcat.sessions.rejected 计数Count 由于达到了最大活动会话数而未创建的会话数。Number of sessions that were not created because the maximum number of active sessions reached.
tomcat.sessions.active.currenttomcat.sessions.active.current tomcat.sessions.active.currenttomcat.sessions.active.current 计数Count Tomcat 会话活动计数Tomcat Session Active Count

请参阅See also

后续步骤Next steps