Documentation ¶
Overview ¶
Package interceptor contains interceptors for client and worker calls.
Index ¶
- func Header(ctx context.Context) map[string]*commonpb.Payload
- func WorkflowHeader(ctx workflow.Context) map[string]*commonpb.Payload
- type ActivityInboundInterceptor
- type ActivityInboundInterceptorBase
- type ActivityOutboundInterceptor
- type ActivityOutboundInterceptorBase
- type BaseTracer
- type ClientCancelWorkflowInput
- type ClientExecuteWorkflowInput
- type ClientInterceptor
- type ClientInterceptorBase
- type ClientOutboundInterceptor
- type ClientOutboundInterceptorBase
- type ClientQueryWorkflowInput
- type ClientSignalWithStartWorkflowInput
- type ClientSignalWorkflowInput
- type ClientTerminateWorkflowInput
- type ClientUpdateWithStartWorkflowInput
- type ClientUpdateWorkflowInput
- type ExecuteActivityInput
- type ExecuteNexusOperationInput
- type ExecuteWorkflowInput
- type HandleQueryInput
- type HandleSignalInput
- type Interceptor
- type InterceptorBase
- type RequestCancelNexusOperationInput
- type ScheduleClientCreateInput
- type Tracer
- type TracerFinishSpanOptions
- type TracerOptions
- type TracerSpan
- type TracerSpanRef
- type TracerStartSpanOptions
- type UpdateInput
- type WorkerInterceptor
- type WorkerInterceptorBase
- type WorkflowInboundInterceptor
- type WorkflowInboundInterceptorBase
- type WorkflowOutboundInterceptor
- type WorkflowOutboundInterceptorBase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Header ¶
Header provides Temporal header information from the context for reading or writing during specific interceptor calls.
This returns a non-nil map only for contexts inside ActivityInboundInterceptor.ExecuteActivity, ClientOutboundInterceptor.ExecuteWorkflow, and ClientOutboundInterceptor.SignalWithStartWorkflow.
func WorkflowHeader ¶
WorkflowHeader provides Temporal header information from the workflow context for reading or writing during specific interceptor calls.
This returns a non-nil map only for contexts inside WorkflowInboundInterceptor.ExecuteWorkflow, WorkflowOutboundInterceptor.ExecuteActivity, WorkflowOutboundInterceptor.ExecuteLocalActivity, WorkflowOutboundInterceptor.ExecuteChildWorkflow, and WorkflowOutboundInterceptor.NewContinueAsNewError.
Types ¶
type ActivityInboundInterceptor ¶
type ActivityInboundInterceptor = internal.ActivityInboundInterceptor
ActivityInboundInterceptor is an interface for all activity calls originating from the server. Implementers wanting to intercept outbound (i.e. from SDK) activity calls, can change the outbound interceptor in Init before the next call in the chain.
All implementations must embed ActivityInboundInterceptorBase to safely handle future changes.
type ActivityInboundInterceptorBase ¶
type ActivityInboundInterceptorBase = internal.ActivityInboundInterceptorBase
ActivityInboundInterceptorBase is a default implementation of ActivityInboundInterceptor that forwards calls to the next inbound interceptor and uses an ActivityOutboundInterceptorBase on Init.
This must be embedded into all ActivityInboundInterceptor implementations to safely handle future changes.
type ActivityOutboundInterceptor ¶
type ActivityOutboundInterceptor = internal.ActivityOutboundInterceptor
ActivityOutboundInterceptor is an interface for all activity calls originating from the SDK.
All implementations must embed ActivityOutboundInterceptorBase to safely handle future changes.
type ActivityOutboundInterceptorBase ¶
type ActivityOutboundInterceptorBase = internal.ActivityOutboundInterceptorBase
ActivityOutboundInterceptorBase is a default implementation of ActivityOutboundInterceptor that forwards calls to the next outbound interceptor.
This must be embedded into all ActivityOutboundInterceptor implementations to safely handle future changes.
type BaseTracer ¶
type BaseTracer struct{}
BaseTracer is a default implementation of Tracer meant for embedding.
func (BaseTracer) GetLogger ¶
func (BaseTracer) GetLogger(logger log.Logger, ref TracerSpanRef) log.Logger
func (BaseTracer) SpanName ¶ added in v1.20.0
func (BaseTracer) SpanName(options *TracerStartSpanOptions) string
type ClientCancelWorkflowInput ¶
type ClientCancelWorkflowInput = internal.ClientCancelWorkflowInput
ClientCancelWorkflowInput is input for ClientOutboundInterceptor.CancelWorkflow.
type ClientExecuteWorkflowInput ¶
type ClientExecuteWorkflowInput = internal.ClientExecuteWorkflowInput
ClientExecuteWorkflowInput is input for ClientOutboundInterceptor.ExecuteWorkflow.
type ClientInterceptor ¶
type ClientInterceptor = internal.ClientInterceptor
ClientInterceptor for providing a ClientOutboundInterceptor to intercept certain workflow-specific client calls from the SDK. If an implementation of this is provided via client or worker options, certain client calls will be intercepted by it.
All implementations must embed ClientInterceptorBase to safely handle future changes.
type ClientInterceptorBase ¶
type ClientInterceptorBase = internal.ClientInterceptorBase
ClientInterceptorBase is a default implementation of ClientInterceptor that simply instantiates ClientOutboundInterceptorBase when called to intercept the client.
This must be embedded into all ClientInterceptor implementations to safely handle future changes.
type ClientOutboundInterceptor ¶
type ClientOutboundInterceptor = internal.ClientOutboundInterceptor
ClientOutboundInterceptor is an interface for certain workflow-specific calls originating from the SDK.
All implementations must embed ClientOutboundInterceptorBase to safely handle future changes.
type ClientOutboundInterceptorBase ¶
type ClientOutboundInterceptorBase = internal.ClientOutboundInterceptorBase
ClientOutboundInterceptorBase is a default implementation of ClientOutboundInterceptor that forwards calls to the next outbound interceptor.
This must be embedded into all ClientOutboundInterceptor implementations to safely handle future changes.
type ClientQueryWorkflowInput ¶
type ClientQueryWorkflowInput = internal.ClientQueryWorkflowInput
ClientQueryWorkflowInput is input for ClientOutboundInterceptor.QueryWorkflow.
type ClientSignalWithStartWorkflowInput ¶
type ClientSignalWithStartWorkflowInput = internal.ClientSignalWithStartWorkflowInput
ClientSignalWithStartWorkflowInput is input for ClientOutboundInterceptor.SignalWithStartWorkflow.
type ClientSignalWorkflowInput ¶
type ClientSignalWorkflowInput = internal.ClientSignalWorkflowInput
ClientSignalWorkflowInput is input for ClientOutboundInterceptor.SignalWorkflow.
type ClientTerminateWorkflowInput ¶
type ClientTerminateWorkflowInput = internal.ClientTerminateWorkflowInput
ClientTerminateWorkflowInput is input for ClientOutboundInterceptor.TerminateWorkflow.
type ClientUpdateWithStartWorkflowInput ¶ added in v1.31.0
type ClientUpdateWithStartWorkflowInput = internal.ClientUpdateWithStartWorkflowInput
ClientUpdateWithStartWorkflowInput is input for ClientOutboundInterceptor.UpdateWithStartWorkflow.
type ClientUpdateWorkflowInput ¶ added in v1.20.0
type ClientUpdateWorkflowInput = internal.ClientUpdateWorkflowInput
ClientUpdateWorkflowInput is input for ClientOutoundInterceptor.UpdateWorkflow.
type ExecuteActivityInput ¶
type ExecuteActivityInput = internal.ExecuteActivityInput
ExecuteActivityInput is input for ActivityInboundInterceptor.ExecuteActivity.
type ExecuteNexusOperationInput ¶ added in v1.29.0
type ExecuteNexusOperationInput = internal.ExecuteNexusOperationInput
ExecuteNexusOperationInput is the input to WorkflowOutboundInterceptor.ExecuteNexusOperation.
NOTE: Experimental
type ExecuteWorkflowInput ¶
type ExecuteWorkflowInput = internal.ExecuteWorkflowInput
ExecuteWorkflowInput is input for WorkflowInboundInterceptor.ExecuteWorkflow.
type HandleQueryInput ¶
type HandleQueryInput = internal.HandleQueryInput
HandleQueryInput is input for WorkflowInboundInterceptor.HandleQuery.
type HandleSignalInput ¶
type HandleSignalInput = internal.HandleSignalInput
HandleSignalInput is input for WorkflowInboundInterceptor.HandleSignal.
type Interceptor ¶
type Interceptor = internal.Interceptor
Interceptor is a common interface for all interceptors. It combines ClientInterceptor and WorkerInterceptor. If an implementation of this interceptor is provided via client options, some client calls and all worker calls will be intercepted by it. If an implementation of this interceptor is provided via worker options, all worker calls will be intercepted by it.
All implementations of this should embed InterceptorBase but are not required to.
func NewTracingInterceptor ¶
func NewTracingInterceptor(tracer Tracer) Interceptor
NewTracingInterceptor creates a new interceptor using the given tracer. Most callers do not use this directly, but rather use the opentracing or opentelemetry packages. This panics if options are not set as expected.
type InterceptorBase ¶
type InterceptorBase = internal.InterceptorBase
InterceptorBase is a default implementation of Interceptor meant for embedding. It simply embeds ClientInterceptorBase and WorkerInterceptorBase.
type RequestCancelNexusOperationInput ¶ added in v1.28.0
type RequestCancelNexusOperationInput = internal.RequestCancelNexusOperationInput
RequestCancelNexusOperationInput is the input to WorkflowOutboundInterceptor.RequestCancelNexusOperation.
NOTE: Experimental
type ScheduleClientCreateInput ¶ added in v1.18.0
type ScheduleClientCreateInput = internal.ScheduleClientCreateInput
ScheduleClientCreateInput is input for ScheduleClientInterceptor.CreateSchedule.
type Tracer ¶
type Tracer interface { // Options returns the options for the tracer. This is only called once on // initialization. Options() TracerOptions // UnmarshalSpan unmarshals the given map into a span reference. UnmarshalSpan(map[string]string) (TracerSpanRef, error) // MarshalSpan marshals the given span into a map. If the map is empty with no // error, the span is simply not set. MarshalSpan(TracerSpan) (map[string]string, error) // SpanFromContext returns the span from the general Go context or nil if not // present. SpanFromContext(context.Context) TracerSpan // ContextWithSpan creates a general Go context with the given span set. ContextWithSpan(context.Context, TracerSpan) context.Context // StartSpan starts and returns a span with the given options. StartSpan(*TracerStartSpanOptions) (TracerSpan, error) // GetLogger returns a log.Logger which may include additional fields in its // output in order to support correlation of tracing and log data. GetLogger(log.Logger, TracerSpanRef) log.Logger // SpanName can be used to give a custom name to a Span according to the input TracerStartSpanOptions, // or the decision can be deferred to the BaseTracer implementation. SpanName(options *TracerStartSpanOptions) string // contains filtered or unexported methods }
Tracer is an interface for tracing implementations as used by NewTracingInterceptor. Most callers do not use this directly, but rather use the opentracing or opentelemetry packages.
All implementations must embed BaseTracer to safely handle future changes.
type TracerFinishSpanOptions ¶
type TracerFinishSpanOptions struct { // Error is present if there was an error in the code traced by this specific // span. Error error }
TracerFinishSpanOptions are options for TracerSpan.Finish.
type TracerOptions ¶
type TracerOptions struct { // SpanContextKey provides a key to put a span on a context unrelated to how a // span might otherwise be put on a context by ContextWithSpan. This should // never be nil. // // This is used internally to set the span on contexts not natively supported // by tracing systems such as [workflow.Context]. SpanContextKey interface{} // HeaderKey is the key name on the Temporal header to serialize the span to. // This should never be empty. HeaderKey string // DisableSignalTracing can be set to disable signal tracing. DisableSignalTracing bool // DisableQueryTracing can be set to disable query tracing. DisableQueryTracing bool // DisableUpdateTracing can be set to disable update tracing. DisableUpdateTracing bool // AllowInvalidParentSpans will swallow errors interpreting parent // spans from headers. Useful when migrating from one tracing library // to another, while workflows/activities may be in progress. AllowInvalidParentSpans bool }
TracerOptions are options returned from Tracer.Options.
type TracerSpan ¶
type TracerSpan interface { TracerSpanRef // Finish is called when the span is complete. Finish(*TracerFinishSpanOptions) }
TracerSpan represents a span.
type TracerSpanRef ¶
type TracerSpanRef interface { }
TracerSpanRef represents a span reference such as a parent.
type TracerStartSpanOptions ¶
type TracerStartSpanOptions struct { // Parent is the optional parent reference of the span. Parent TracerSpanRef // Operation is the general operation name without the specific name. Operation string // Name is the specific activity, workflow, etc for the operation. Name string // Time indicates the start time of the span. // // For RunWorkflow and RunActivity operation types, this will match workflow.Info.WorkflowStartTime and // activity.Info.StartedTime respectively. All other operations use time.Now(). Time time.Time // DependedOn is true if the parent depends on this span or false if it just // is related to the parent. In OpenTracing terms, this is true for "ChildOf" // reference types and false for "FollowsFrom" reference types. DependedOn bool // Tags are a set of span tags. Tags map[string]string // FromHeader is used internally, not by tracer implementations, to determine // whether the parent span can be retrieved from the Temporal header. FromHeader bool // ToHeader is used internally, not by tracer implementations, to determine // whether the span should be placed on the Temporal header. ToHeader bool // IdempotencyKey may optionally be used by tracing implementations to generate // deterministic span IDs. // // This is useful in workflow contexts where spans may need to be "resumed" before // ultimately being reported. Generating a deterministic span ID ensures that any // child spans created before the parent span is resumed do not become orphaned. // // IdempotencyKey is not guaranteed to be set for all operations; Tracer // implementations MUST therefore ignore zero values for this field. // // IdempotencyKey should be treated as opaque data by Tracer implementations. // Do not attempt to parse it, as the format is subject to change. IdempotencyKey string }
TracerStartSpanOptions are options for Tracer.StartSpan.
type UpdateInput ¶ added in v1.24.0
type UpdateInput = internal.UpdateInput
UpdateInput is input for WorkflowInboundInterceptor.ExecuteUpdate and WorkflowInboundInterceptor.ValidateUpdate.
NOTE: Experimental
type WorkerInterceptor ¶
type WorkerInterceptor = internal.WorkerInterceptor
WorkerInterceptor is an interface for all calls that can be intercepted during worker operation. This includes inbound (from server) and outbound (from SDK) workflow and activity calls. If an implementation of this is provided via client or worker options, all worker calls will be intercepted by it.
All implementations must embed WorkerInterceptorBase to safely handle future changes.
type WorkerInterceptorBase ¶
type WorkerInterceptorBase = internal.WorkerInterceptorBase
WorkerInterceptorBase is a default implementation of WorkerInterceptor that simply instantiates ActivityInboundInterceptorBase or WorkflowInboundInterceptorBase when called to intercept activities or workflows respectively.
This must be embedded into all WorkerInterceptor implementations to safely handle future changes.
type WorkflowInboundInterceptor ¶
type WorkflowInboundInterceptor = internal.WorkflowInboundInterceptor
WorkflowInboundInterceptor is an interface for all workflow calls originating from the server. Implementers wanting to intercept outbound (i.e. from SDK) workflow calls, can change the outbound interceptor in Init before the next call in the chain.
All implementations must embed WorkflowInboundInterceptorBase to safely handle future changes.
type WorkflowInboundInterceptorBase ¶
type WorkflowInboundInterceptorBase = internal.WorkflowInboundInterceptorBase
WorkflowInboundInterceptorBase is a default implementation of WorkflowInboundInterceptor that forwards calls to the next inbound interceptor and uses an WorkflowOutboundInterceptorBase on Init.
This must be embedded into all WorkflowInboundInterceptor implementations to safely handle future changes.
type WorkflowOutboundInterceptor ¶
type WorkflowOutboundInterceptor = internal.WorkflowOutboundInterceptor
WorkflowOutboundInterceptor is an interface for all workflow calls originating from the SDK.
All implementations must embed WorkflowOutboundInterceptorBase to safely handle future changes.
type WorkflowOutboundInterceptorBase ¶
type WorkflowOutboundInterceptorBase = internal.WorkflowOutboundInterceptorBase
WorkflowOutboundInterceptorBase is a default implementation of WorkflowOutboundInterceptor that forwards calls to the next outbound interceptor.
This must be embedded into all WorkflowOutboundInterceptor implementations to safely handle future changes.