腾讯云可观测平台 APM 指标协议标准

这篇将阐述应用性能监控 APM 固有指标的协议标准,用户可以通过如下两种方式获取应用性能监控 APM 的固有指标。

相关产品
腾讯云可观测平台 产品页,含版本规格、价格与购买入口。

·通过云 API 查询指标,请参见 DescribeGeneralMetricData 接口文档。

·将指标同步到腾讯云 Prometheus 监控服务,请参见 Prometheus 数据集成以及 Dashboard 关联展示。

二、指标名称

每种指标都有唯一云 API 指标名称和唯一的 Prometheus 指标名称,分别用于云 API 查询以及同步至 Prometheus 这两种获取 APM 固有指标的方式。

三、指标视图

APM 的固有指标包含5个类别,通过5个指标视图进行标识。在云 API 查询场景,需要在 ViewName 字段中指定视图名称。

视图名称 描述
service_metric 基础性能指标:统计应用的通用性能表现,例如请求数量、响应时间等。
runtime_metric 运行时指标:统计运行时指标,例如 GC 次数、CPU 利用率等。
sql_metric 数据库调用指标:统计应用访问数据库的性能表现,例如 SQL 执行次数、响应时间等。
error_metric 错误调用指标:统计链路中的错误调用情况,例如错误类型、错误码。
mq_metric MQ 调用指标:统计应用访问消息队列的性能表现,例如消息生产的次数、响应时间等。

四、指标维度

每种指标都支持多个维度:在云 API 查询场景,维度用于数据过滤;在 Prometheus 集成场景,维度信息将以 Prometheus 标签(Label)的形式输出到 Prometheus 指标中。

五、通用维度

所有5类指标都包含如下通用维度,在应用接入 APM 的时候,大多数通用维度都可以基于实例属性进行自定义,详情请参见 自定义应用实例属性。

云 API 维度名称 Prometheus 标签名称 描述
tapm.app.id tapm_app_id 云 AppID
tapm.instance.key apm_instance 业务系统 ID
service.name apm_service_name 应用名
service.instance service_instance 应用实例
agent.version agent_version 探针版本号
service.version service_version 应用版本

除了通用维度之外,每个视图还支持一系列的特有维度。例如 service_metric 视图下的指标支持 span.kind,代表 Span 类型。详情请参见下文。

七、指标

云 API 指标名称 Prometheus 指标名称 类型 描述 单位 桶分布
request_count service_request_count Gauge 请求数量 – –
error_request_count service_error_request_count Gauge 错误请求数量 – –
duration_avg service_duration_avg Gauge 平均耗时 ms –
duration_max service_duration_max Gauge 最大耗时 ms –
duration_min service_duration_min Gauge 最小耗时 ms –
duration_total service_duration_total Gauge 累计耗时 ms –
slow_request_count service_slow_request_count Gauge 慢调用数量,慢调用耗时 T 需满足:2000 ms < T – –
tolerate_request_count service_tolerate_request_count Gauge 容忍调用数量,容忍调用耗时 T 需满足:500 ms < T ≤ 2000 ms – –
range_count_duration service_range_count_duration_bucketservice_range_count_duration_countservice_range_count_duration_sum Histogram(Delta 语义) 耗时分布(桶边界的单位为 ms) – 1, 5, 10, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1500, 2000, 3000, 4000, 5000, 7000, 10000, 15000, +Inf

八、特有维度

云 API 维度名称 Prometheus 标签名称 描述
span.kind span_kind Span 类型
service.component service_component 组件类型
peer.service peer_service 对端应用名
peer.operation – 对端接口名
peer.filled peer_filled APM 处理后的对端应用名
operation operation 接口名
peer.instance – 对端实例
status.message – 请求状态信息
status.code status_code 请求状态码
status_code_xx status_code_xx APM 处理后的状态码
error.object – 错误类型
namespace – 命名空间
service.view – 组件视图(枚举值:"sql"、"mq",如果没有则为空)
k8s.deployment.name – Kubernetes 负载名
k8s.pod.name – Kubernetes Pod 名
k8s.namespace.name – Kubernetes 命名空间
k8s.cluster.id – TKE 集群 ID
k8s.region – TKE 集群地域
k8s.pod.ip – Kubernetes Pod IP
k8s.node.ip – Kubernetes 节点 IP
cvm.region – CVM 地域
cvm.instance.id – CVM 实例 ID
custom_key_1 – 自定义维度1
custom_key_2 – 自定义维度2
custom_key_3 custom_key_3 自定义维度3

九、runtime_metric 视图(运行时性能指标)

注意:说明:

十、指标

云 API 指标名称 Prometheus 指标名称 类型 描述 单位
cpu_usage_percent runtime_cpu_usage_percent Gauge CPU 利用率 %
jvm_heap_usage_percent runtime_jvm_heap_usage_percent Gauge 内存利用率 %
jvm_gc_count runtime_jvm_gc_count Gauge GC 次数 个
jvm_gc_time runtime_jvm_gc_time Gauge GC 耗时 ms
jvm_memory_commit runtime_jvm_memory_commit Gauge JVM 内存已提交大小 MB
jvm_memory_max runtime_jvm_memory_max Gauge JVM 内存最大大小 MB
jvm_memory_used runtime_jvm_memory_used Gauge JVM 内存使用大小 MB
thread_new_count runtime_thread_new_count Gauge 新建线程数 个
thread_runnable_count runtime_thread_runnable_count Gauge 可运行线程数 个
thread_blocked_count runtime_thread_blocked_count Gauge 阻塞线程数 个
thread_waiting_count runtime_thread_waiting_count Gauge 等待线程数 个
thread_time_waiting_count runtime_thread_time_waiting_count Gauge 定时等待线程数 个
thread_terminated_count runtime_thread_terminated_count Gauge 终止线程数 个
thread_daemon_count runtime_thread_daemon_count Gauge 守护线程数 个
thread_live_count runtime_thread_live_count Gauge 活跃线程数 个
thread_peak_count runtime_thread_peak_count Gauge 峰值活跃线程数 个
connection_pool_active_size runtime_connection_pool_active_size Gauge 活跃连接数 个
connection_pool_current_size runtime_connection_pool_current_size Gauge 当前连接数 个
connection_pool_idle_size runtime_connection_pool_idle_size Gauge 空闲连接数 个
connection_pool_max_size runtime_connection_pool_max_size Gauge 最大连接数 个
connection_pool_wait_size runtime_connection_pool_wait_size Gauge 等待连接数 个
connection_pool_usage_rate runtime_connection_pool_usage_rate Gauge 连接池使用率 %
thread_pool_active_count runtime_thread_pool_active_count Gauge 活跃线程数 个
thread_pool_core_pool_size runtime_thread_pool_core_pool_size Gauge 核心线程数 个
thread_pool_max_pool_size runtime_thread_pool_max_pool_size Gauge 最大线程数 个
thread_pool_size runtime_thread_pool_size Gauge 线程池大小 个
thread_pool_task_count runtime_thread_pool_task_count Gauge 线程池任务数 个
thread_pool_usage_rate runtime_thread_pool_usage_rate Gauge 线程池使用率 %

十一、特有维度

云 API 维度名称 Prometheus 标签名称 描述
pool.tag pool.tag 线程池/连接池种类
pool.type pool.type 线程池/连接池组件类型
pool.name pool.name 线程池/连接池名称
gc.type gc.type GC 类型
collector.name collector.name 回收器名称
memory.category memory.category 内存种类
memory.area memory.area 内存区域
k8s.deployment.name k8s_deployment_name Kubernetes 负载名
k8s.pod.name k8s_pod_name Kubernetes Pod 名
k8s.namespace.name k8s_namespace_name Kubernetes 命名空间
k8s.cluster.id k8s_cluster_id TKE 集群 ID
k8s.region k8s_region TKE 集群地域
k8s.pod.ip k8s_pod_ip Kubernetes Pod IP
k8s.node.ip k8s_node_ip Kubernetes 节点 IP
cvm.region cvm_region CVM 地域
cvm.instance.id cvm_instance_id CVM 实例 ID
custom_key_1 custom_key_1 自定义维度1
custom_key_2 custom_key_2 自定义维度2
custom_key_3 custom_key_3 自定义维度3

十三、指标

云 API 指标名称 Prometheus 指标名称 类型 描述 单位
duration_avg sql_duration_avg Gauge 平均耗时 ms
duration_total sql_duration_total Gauge 累计耗时 ms
last_error_occur_time sql_last_error_occur_time Gauge 最后错误发生时间戳 ms
error_request_count sql_error_request_count Gauge 错误请求数量 –
request_count sql_request_count Gauge 请求数量 –
slow_sql_count sql_slow_sql_count Gauge 慢 SQL 数量(>2000ms) –

十四、特有维度

云 API 维度名称 Prometheus 标签名称 描述
service.component service_component 组件类型
span.kind span_kind Span 类型
db.statement db_statement 执行语句
db.instance db_instance 数据库的实例地址
db.ip db_ip IP 地址
db.operation db_operation 操作类型
error.object error_object 错误类型
db.system db_system 数据库类型
attack.subtype attack_subtype 注入类型
attack.symbol attack_symbol 注入标记:0无注入,1疑似注入
attack.level attack_level 注入等级:Critical、Important、Moderate、Low、Info
custom_key_1 custom_key_1 自定义维度1
custom_key_2 custom_key_2 自定义维度2
custom_key_3 custom_key_3 自定义维度3

十六、指标

云 API 指标名称 Prometheus 指标名称 类型 描述 单位
error_request_count error_error_request_count Gauge 错误请求数 –
last_error_occur_time error_last_error_occur_time Gauge 最后错误发生时间戳 ms

十七、特有维度

云 API 维度名称 Prometheus 标签名称 描述
service.component service_component 组件类型
span.kind span_kind Span 类型
operation operation 接口名
error.object error_object 错误类型
peer.service peer_service 对端应用名
custom_key_1 custom_key_1 自定义维度1
custom_key_2 custom_key_2 自定义维度2
custom_key_3 custom_key_3 自定义维度3

十九、指标

云 API 指标名称 Prometheus 指标名称 类型 描述 单位 桶分布
duration_avg mq_duration_avg Gauge 平均耗时 ms –
duration_total mq_duration_total Gauge 累计耗时 ms –
error_request_count mq_error_request_count Gauge 错误数量 – –
request_count mq_request_count Gauge 请求数 – –
range_count_duration mq_range_count_duration_bucketmq_range_count_duration_countmq_range_count_duration_sum Histogram(Delta 语义) 耗时分布(桶边界的单位为 ms) – 1, 5, 10, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1500, 2000, 3000, 4000, 5000, 7000, 10000, 15000, +Inf

20、特有维度

云 API 维度名称 Prometheus 标签名称 描述
component component 组件类型
span.kind span_kind Span 类型
peer.service peer_service 对端应用名
mq.topic mq_topic 消息队列 Topic 名称
mq.broker mq_broker 消息队列的 Broker 地址
operation operation 接口名
status.code status_code 请求状态
status_code_xx status_code_xx APM 处理后的状态码
error.object error_object 错误类型
赞 (0)
上一篇 4天前
下一篇 4天前