跳到主要内容

指标

本页只介绍使用 Temporal 和 Prometheus reporter 的 Dex Server。下面的目录是两个实际 scrape 的并集:一个来自集成测试流量运行后的独立 Dex Server,另一个来自 Temporal 指标集成测试。这里只列出实际出现的 metric family,不根据 SDK 常量推测其他名称, 因此也反映了本仓库固定使用的 Temporal SDK fork。

启用 Prometheus

interpreter.temporal.prometheus 下配置 reporter:

interpreter:
temporal:
hostPort: temporal:7233
namespace: default
prometheus:
listenAddress: 0.0.0.0:8890
timerType: histogram

Dex Server 启动后,从配置的地址抓取指标:

curl http://127.0.0.1:8890/metrics

表格使用 TYPE 行中的 metric family 名称。每个 histogram 还会导出 _bucket_sum_count series。Histogram 的单位是秒,Prometheus 会为 bucket 添加 le 标签。

某个操作发生前,对应 family 可能不存在。Dex 在启动时创建的 counter 可能以零值出现。

标签

表格有意忽略下列 Temporal 上下文标签:namespaceclient_nameworker_typeworkflow_typeactivity_typetask_queue。它们仍可能 出现在 scrape 中,但使用本页的 Dex 指标时不需要关注它们。

表格中列出的可用标签含义如下:

标签含义和值
flow_type应用 Flow type。不属于应用 Flow 的 system Step 使用 none
step_type应用 Step type。
sub_flow_typeSubFlow Step 启动的 child Flow type。
rpc_nameWorker RPC name。
operationTemporal service operation,例如 StartWorkflowExecutionPollActivityTaskQueue
status_code失败请求的有限 gRPC status code,例如 NOT_FOUNDINVALID_ARGUMENT
cause有限的资源耗尽原因。实际 scrape 中出现的值是 BusyWorkflow
poller_type实际 scrape 中出现了 workflow_taskworkflow_sticky_taskactivity_task
prefix配置的 Blob Store prefix。

Prometheus reporter 会把标签值中不支持的字符替换为下划线。例如,Flow type order-flow 会导出为 order_flow。Flow type、Step type、SubFlow type 和 RPC name 应使用有限集合。不要把 Flow ID、Run ID、request ID、payload 或 error message 放进 metric 标签。

Flow 生命周期

Metric family类型含义可用标签
dex_flow_completedCounter成功完成的应用 Flow run。flow_type
dex_flow_canceledCounter以 canceled 状态关闭的应用 Flow run。flow_type
dex_flow_failedCounter以 failed 状态关闭的应用 Flow run。flow_type
dex_flow_continue_as_newCountercontinue-as-new 为新 run 的应用 Flow run。flow_type
dex_flow_endtoend_latencyHistogram应用 Flow run 从启动到关闭的时间。flow_type
dex_sys_flow_completedCounter成功完成的内部 system Flow run。
dex_sys_flow_endtoend_latencyHistogram内部 system Flow run 从启动到关闭的时间。

Flow task 处理

Metric family类型含义可用标签
dex_flow_task_queue_poll_succeedCounter返回应用 Flow task 的 poll。flow_type
dex_flow_task_schedule_to_start_latencyHistogram应用 Flow task 从调度到 Worker 开始处理的时间。flow_type
dex_flow_task_replay_latencyHistogram应用 Flow task replay history 所花的时间。flow_type
dex_flow_task_execution_latencyHistogram处理应用 Flow task 所花的时间。flow_type
dex_sys_flow_task_queue_poll_emptyCounter未返回内部 system Flow task 的 poll。
dex_sys_flow_task_queue_poll_succeedCounter返回内部 system Flow task 的 poll。
dex_sys_flow_task_schedule_to_start_latencyHistogram内部 system Flow task 从调度到 Worker 开始处理的时间。
dex_sys_flow_task_replay_latencyHistogram内部 system Flow task replay history 所花的时间。
dex_sys_flow_task_execution_latencyHistogram处理内部 system Flow task 所花的时间。

同步 Step

Metric family类型含义可用标签
dex_sync_step_schedule_to_start_latencyHistogram同步 Step 工作从调度到 Worker 开始处理的时间。flow_typestep_type
dex_sync_step_execution_latencyHistogram执行同步 Step 工作所花的时间。flow_typestep_type
dex_sync_step_succeed_endtoend_latencyHistogram同步 Step 工作从调度到成功完成的时间。flow_typestep_type
dex_sync_step_execution_failedCounter执行失败的同步 Step。flow_typestep_type
dex_sync_sys_step_poll_no_taskCounter未返回同步 system-Step task 的 poll。flow_type
dex_sync_sys_step_schedule_to_start_latencyHistogram同步 system-Step 工作从调度到 Worker 开始处理的时间。flow_type
dex_sync_sys_step_execution_latencyHistogram执行同步 system-Step 工作所花的时间。flow_type
dex_sync_sys_step_succeed_endtoend_latencyHistogram同步 system-Step 工作从调度到成功完成的时间。flow_type

异步 Step

Metric family类型含义可用标签
dex_async_step_totalCounter已开始的异步 Step execution。flow_typestep_type
dex_async_step_canceledCounter异步 Step 报告的 cancellation outcome。flow_typestep_type
dex_async_step_execution_cancelledCounter最终被取消的异步 Step execution。flow_typestep_type
dex_async_step_failedCounter异步 Step 报告的 failure outcome。flow_typestep_type
dex_async_step_execution_failedCounter最终失败的异步 Step execution。flow_typestep_type
dex_async_step_execution_latencyHistogram执行异步 Step 工作所花的时间。flow_typestep_type
dex_async_step_succeed_endtoend_latencyHistogram异步 Step 工作从调度到成功完成的时间。flow_typestep_type

Worker RPC 和 SubFlow 工作

Metric family类型含义可用标签
dex_async_invoke_rpc_totalCounter已开始的异步 Worker RPC execution。flow_typerpc_name
dex_async_invoke_rpc_failedCounter异步 Worker RPC 报告的 failure outcome。flow_typerpc_name
dex_async_invoke_rpc_execution_failedCounter最终失败的异步 Worker RPC execution。flow_typerpc_name
dex_async_invoke_rpc_execution_latencyHistogram执行异步 Worker RPC 工作所花的时间。flow_typerpc_name
dex_async_invoke_rpc_succeed_endtoend_latencyHistogram异步 Worker RPC 从调度到成功完成的时间。flow_typerpc_name
dex_async_start_sub_flow_totalCounter已开始的异步 SubFlow-start execution。flow_typesub_flow_type
dex_async_start_sub_flow_execution_latencyHistogram执行异步 SubFlow-start 工作所花的时间。flow_typesub_flow_type
dex_async_start_sub_flow_succeed_endtoend_latencyHistogram异步 SubFlow start 从调度到成功完成的时间。flow_typesub_flow_type

异步 system Step

Metric family类型含义可用标签
dex_async_sys_step_totalCounter已开始的异步内部 system-Step execution。flow_type
dex_async_sys_step_execution_latencyHistogram执行异步内部 system-Step 工作所花的时间。flow_type
dex_async_sys_step_succeed_endtoend_latencyHistogram异步内部 system-Step 工作从调度到成功完成的时间。flow_type

Temporal 请求

_attempt 结尾的指标会统计每一次 transport attempt,包括 retry。不带 _attempt 的对应名称统计逻辑 request。Long-request 指标包括 long poll 和 Workflow Update 等长时间运行的操作。

Metric family类型含义可用标签
dex_requestCounter已开始的非 long Temporal 逻辑请求。operation
dex_request_attemptCounter非 long Temporal 请求的 transport attempt。operation
dex_request_failureCounter失败的非 long Temporal 逻辑请求。operationstatus_code
dex_request_failure_attemptCounter失败的非 long Temporal request attempt。operationstatus_code
dex_request_latencyHistogram非 long Temporal 逻辑请求的端到端延迟。operation
dex_request_latency_attemptHistogram单次非 long Temporal request attempt 的延迟。operation
dex_long_requestCounter已开始的 long Temporal 逻辑请求。operation
dex_long_request_attemptCounterlong Temporal 请求的 transport attempt。operation
dex_long_request_failureCounter失败的 long Temporal 逻辑请求。operationstatus_code
dex_long_request_failure_attemptCounter失败的 long Temporal request attempt。operationstatus_code
dex_long_request_latencyHistogramlong Temporal 逻辑请求的端到端延迟。operation
dex_long_request_latency_attemptHistogram单次 long Temporal request attempt 的延迟。operation
dex_long_request_resource_exhaustedCounter因 runtime 资源耗尽而被拒绝的 long 逻辑请求。operationstatus_codecause

Worker 和 cache 状态

Metric family类型含义可用标签
dex_poller_startCounterDex Server Worker 启动的 poller。
dex_num_pollersGauge按 task 类型统计的已配置或活动 poller。poller_type
dex_worker_startCounter已启动的 Dex Server Worker component。
dex_worker_task_slots_availableGauge当前可用的 Worker task slot。
dex_worker_task_slots_usedGauge当前正在使用的 Worker task slot。
dex_sticky_cache_hitCounter找到缓存 Flow execution 的 sticky-cache lookup。
dex_sticky_cache_sizeGauge当前 sticky-cache entry 数量。
dex_sticky_cache_total_forced_evictionCounter从 sticky cache 强制移除的 entry。

Blob Store

这些 family 来自 Temporal-backed Dex Server 使用的 Dex Blob Store。配置 Blob cache 后会出现 cache counter。

Metric family类型含义可用标签
write_object_errorCounter失败的 Blob Store object write。prefix
write_object_successHistogram成功 Blob Store object write 的延迟。prefix
read_object_errorCounter失败的 Blob Store object read。prefix
read_object_successHistogram成功 Blob Store object read 的延迟。prefix
blob_cache_hitCounter找到 entry 的 Blob-cache lookup。prefix
blob_cache_missCounter未找到 entry 的 Blob-cache lookup。prefix
blob_cache_write_throughCounter写入 Blob cache 的 object。prefix
blob_cache_read_fillCounter读取 backing store 后填充的 Blob-cache entry。prefix
blob_cache_bypassCounter有意绕过 cache 的 Blob operation。prefix
blob_cache_errorCounter失败的 Blob-cache operation。prefix

查询和告警

按 Flow type 统计失败的应用 Flow:

sum(rate(dex_flow_failed[5m])) by (flow_type)

按 Flow type 和 Step type 统计失败的同步 Step:

sum(rate(dex_sync_step_execution_failed[5m])) by (flow_type, step_type)

失败的异步 Worker RPC:

sum(rate(dex_async_invoke_rpc_execution_failed[5m])) by (flow_type, rpc_name)

按 operation 和 status 统计 Temporal 请求失败:

sum(rate(dex_request_failure[5m])) by (operation, status_code)

按 prefix 统计 Blob Store error:

sum(rate(read_object_error[5m])) by (prefix)
+ sum(rate(write_object_error[5m])) by (prefix)

对 Flow、Step、Worker RPC、request 或 Blob Store failure counter 的持续增长设置告警。 使用表格中的有界标签定位受影响的操作。只有在 histogram bucket 与服务级别目标匹配后, 才使用 histogram quantile 构建延迟 dashboard。