Documentation
¶
Index ¶
- func EmitNodeComplete(ctx context.Context, workflowID, nodeID, nodeType string, latencyMs int64)
- func EmitNodeError(ctx context.Context, workflowID, nodeID, nodeType string, latencyMs int64, ...)
- func EmitNodeStart(ctx context.Context, workflowID, nodeID, nodeType string)
- func WithNodeEventEmitter(ctx context.Context, emitter NodeEventEmitter) context.Context
- type NodeEvent
- type NodeEventEmitter
- type NodeEventType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitNodeComplete ¶
EmitNodeComplete 发射 node_complete 事件。
func EmitNodeError ¶
func EmitNodeError(ctx context.Context, workflowID, nodeID, nodeType string, latencyMs int64, err error)
EmitNodeError 发射 node_error 事件。
func EmitNodeStart ¶
EmitNodeStart 发射 node_start 事件。
func WithNodeEventEmitter ¶
func WithNodeEventEmitter(ctx context.Context, emitter NodeEventEmitter) context.Context
WithNodeEventEmitter 将 NodeEventEmitter 注入 context。
Types ¶
type NodeEvent ¶
type NodeEvent struct {
Type NodeEventType `json:"type"`
TraceID string `json:"trace_id,omitempty"`
RunID string `json:"run_id,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
NodeID string `json:"node_id"`
NodeType string `json:"node_type,omitempty"`
LatencyMs int64 `json:"latency_ms,omitempty"`
Error string `json:"error,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
NodeEvent 节点级观测事件,统一跨层字段。
type NodeEventEmitter ¶
type NodeEventEmitter func(NodeEvent)
NodeEventEmitter 节点事件发射回调。
func NodeEventEmitterFromContext ¶
func NodeEventEmitterFromContext(ctx context.Context) (NodeEventEmitter, bool)
NodeEventEmitterFromContext 从 context 提取 NodeEventEmitter。
type NodeEventType ¶
type NodeEventType = types.WorkflowNodeEventType
NodeEventType 节点事件类型。
const ( NodeStart NodeEventType = types.WorkflowNodeEventStart NodeComplete NodeEventType = types.WorkflowNodeEventComplete NodeError NodeEventType = types.WorkflowNodeEventError )
Click to show internal directories.
Click to hide internal directories.