Class NoOpFlowMetrics
java.lang.Object
cloud.opencode.base.flow.observability.NoOpFlowMetrics
- All Implemented Interfaces:
FlowMetrics
Zero-cost default
FlowMetrics — every method is an empty body.
Used when opencode-base-observability is not on the runtime
classpath (or when a host explicitly disables metrics).
零开销 FlowMetrics 默认实现 —— 所有方法为空。
当类路径无 opencode-base-observability(或宿主显式禁用指标)时使用。
The singleton INSTANCE is safe to share across threads.
INSTANCE 单例可跨线程共享。
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidrecordInstanceCompleted(String flowKey, InstanceStatus finalStatus) Records that a flow instance has reached a terminal state.voidrecordInstanceStarted(String flowKey) Records that a new flow instance has started.voidrecordOperationDuration(String type, Duration elapsed) Records the wall-clock elapsed time of a single operation.voidrecordTaskCompleted(String flowKey, String stepId, TaskOutcome outcome) Records that a task has been completed (approved / rejected / canceled).voidrecordTaskCreated(String flowKey, String stepId) Records that a PENDING task has been created.voidupdateTodoSize(int size) Updates the gauge for the current todo-queue size of an observed user (or aggregate, depending on the host application).
-
Field Details
-
INSTANCE
Shared singleton instance. 共享单例。- Since:
- JDK 25, opencode-base-flow V1.0.5
-
-
Constructor Details
-
NoOpFlowMetrics
-
-
Method Details
-
recordInstanceStarted
Description copied from interface:FlowMetricsRecords that a new flow instance has started. 记录一次流程实例启动。- Specified by:
recordInstanceStartedin interfaceFlowMetrics- Parameters:
flowKey- business flow key — 业务 key
-
recordInstanceCompleted
Description copied from interface:FlowMetricsRecords that a flow instance has reached a terminal state. 记录一次流程实例达到终态。- Specified by:
recordInstanceCompletedin interfaceFlowMetrics- Parameters:
flowKey- business flow key — 业务 keyfinalStatus- the terminal status — 终态状态
-
recordTaskCreated
Description copied from interface:FlowMetricsRecords that a PENDING task has been created. 记录一次 PENDING 任务创建。- Specified by:
recordTaskCreatedin interfaceFlowMetrics- Parameters:
flowKey- business flow key — 业务 keystepId- step id — 节点 ID
-
recordTaskCompleted
Description copied from interface:FlowMetricsRecords that a task has been completed (approved / rejected / canceled). 记录一次任务完成(同意 / 驳回 / 取消)。- Specified by:
recordTaskCompletedin interfaceFlowMetrics- Parameters:
flowKey- business flow key — 业务 keystepId- step id — 节点 IDoutcome- final outcome (nullable when canceled) — 最终结果(取消时为 null)
-
recordOperationDuration
Description copied from interface:FlowMetricsRecords the wall-clock elapsed time of a single operation. 记录一次操作的墙钟耗时。- Specified by:
recordOperationDurationin interfaceFlowMetrics- Parameters:
type- operation type (start / approve / reject / vote / addSign / withdraw / transfer / circulate / terminate) — 操作类型elapsed- elapsed duration — 耗时
-
updateTodoSize
public void updateTodoSize(int size) Description copied from interface:FlowMetricsUpdates the gauge for the current todo-queue size of an observed user (or aggregate, depending on the host application). A negative value is a sentinel meaning "clear / reset to zero". 更新某用户(或聚合)的当前待办队列大小 gauge。传 -1 表示"清零"。- Specified by:
updateTodoSizein interfaceFlowMetrics- Parameters:
size- current size (or-1to clear) — 当前大小(-1表示清零)
-