Documentation
¶
Index ¶
- func EmitWorkerEvent(evt WorkerEvent)
- func RecordAskMetrics(callerKind, calleeKind, command string, duration time.Duration, err error)
- func RecordCommandMetrics(kind, command string, duration time.Duration, err error)
- func RecordQueryMetrics(callerKind, calleeKind, query string, duration time.Duration, err error)
- func SetListener(l Listener)
- func SetMeter(m Meter)
- func SetTracer(t Tracer)
- type AskEvent
- type Attribute
- type CommandEvent
- type Listener
- type ListenerAdapter
- func (ListenerAdapter) AskFinish(context.Context, AskEvent, error, time.Duration)
- func (ListenerAdapter) AskStart(context.Context, AskEvent)
- func (ListenerAdapter) CommandFinish(context.Context, CommandEvent, error, time.Duration)
- func (ListenerAdapter) CommandStart(context.Context, CommandEvent)
- func (ListenerAdapter) QueryFinish(context.Context, QueryEvent, error, time.Duration)
- func (ListenerAdapter) QueryStart(context.Context, QueryEvent)
- func (ListenerAdapter) WorkerEvent(context.Context, WorkerEvent)
- type Meter
- type QueryEvent
- type Span
- type Tracer
- type WorkerEvent
- type WorkerEventType
- type WorkerLifecycleListener
- type WorkerRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitWorkerEvent ¶
func EmitWorkerEvent(evt WorkerEvent)
EmitWorkerEvent notifies the active listener of worker lifecycle events.
func RecordAskMetrics ¶
RecordAskMetrics emits metrics for ask-style cross-actor commands.
func RecordCommandMetrics ¶
RecordCommandMetrics emits histogram/counter data for a command execution.
func RecordQueryMetrics ¶
RecordQueryMetrics emits metrics for cross-actor queries.
func SetListener ¶
func SetListener(l Listener)
SetListener configures the lifecycle listener used by the runtime.
Types ¶
type AskEvent ¶
type AskEvent struct {
CallerKind string
CallerID string
CallerWorkflow string
CallerRunID string
CallerTaskQueue string
TargetKind string
TargetID string
Command string
CorrelationID string
Attributes []Attribute
}
AskEvent describes cross-actor ask executions.
type Attribute ¶
Attribute describes a key/value pair passed to tracers or meters.
type CommandEvent ¶
type CommandEvent struct {
ActorKind string
Command string
WorkflowID string
RunID string
TaskQueue string
MessageID string
CorrelationID string
CallerKind string
CallerID string
Attributes []Attribute
}
CommandEvent describes command execution attempts.
type Listener ¶
type Listener interface {
CommandStart(ctx context.Context, evt CommandEvent)
CommandFinish(ctx context.Context, evt CommandEvent, err error, duration time.Duration)
AskStart(ctx context.Context, evt AskEvent)
AskFinish(ctx context.Context, evt AskEvent, err error, duration time.Duration)
QueryStart(ctx context.Context, evt QueryEvent)
QueryFinish(ctx context.Context, evt QueryEvent, err error, duration time.Duration)
}
Listener receives deterministic lifecycle hooks emitted by the runtime.
func ActiveListener ¶
func ActiveListener() Listener
ActiveListener returns the currently configured lifecycle listener.
type ListenerAdapter ¶
type ListenerAdapter struct{}
ListenerAdapter provides no-op implementations so callers can embed it.
func (ListenerAdapter) CommandFinish ¶
func (ListenerAdapter) CommandFinish(context.Context, CommandEvent, error, time.Duration)
func (ListenerAdapter) CommandStart ¶
func (ListenerAdapter) CommandStart(context.Context, CommandEvent)
func (ListenerAdapter) QueryFinish ¶
func (ListenerAdapter) QueryFinish(context.Context, QueryEvent, error, time.Duration)
func (ListenerAdapter) QueryStart ¶
func (ListenerAdapter) QueryStart(context.Context, QueryEvent)
func (ListenerAdapter) WorkerEvent ¶
func (ListenerAdapter) WorkerEvent(context.Context, WorkerEvent)
type Meter ¶
type Meter interface {
RecordHistogram(ctx context.Context, name string, value time.Duration, attrs ...Attribute)
AddCounter(ctx context.Context, name string, value int64, attrs ...Attribute)
}
Meter emits metrics such as counters or histograms.
type QueryEvent ¶
type QueryEvent struct {
CallerKind string
CallerID string
CallerWorkflow string
CallerRunID string
CallerTaskQueue string
TargetKind string
TargetID string
Query string
CorrelationID string
Attributes []Attribute
}
QueryEvent describes cross-actor queries.
type Tracer ¶
type Tracer interface {
Start(ctx context.Context, name string, attrs ...Attribute) (context.Context, Span)
}
Tracer creates spans for commands and other actor events.
func ActiveTracer ¶
func ActiveTracer() Tracer
ActiveTracer returns the currently configured tracer.
type WorkerEvent ¶
type WorkerEvent struct {
Queue string
Role WorkerRole
Type WorkerEventType
Error error
Reason string
ActorKinds []string
}
WorkerEvent describes lifecycle changes for workflow or activity workers.
type WorkerEventType ¶
type WorkerEventType string
WorkerEventType categorizes worker lifecycle events.
const ( WorkerEventStart WorkerEventType = "start" WorkerEventStop WorkerEventType = "stop" WorkerEventError WorkerEventType = "error" WorkerEventDisabled WorkerEventType = "disabled" )
type WorkerLifecycleListener ¶
type WorkerLifecycleListener interface {
WorkerEvent(ctx context.Context, evt WorkerEvent)
}
WorkerLifecycleListener observes worker start/stop/failure events. Listener implementations can optionally satisfy this interface to receive worker events.
type WorkerRole ¶
type WorkerRole string
WorkerRole identifies the worker category emitting events.
const ( WorkerRoleWorkflow WorkerRole = "workflow" WorkerRoleActivity WorkerRole = "activity" )