wideevents

package
v1.32.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplTaskSyncWorkflowState         = "sync_workflow_state"
	ReplTaskSyncVersionedTransition   = "sync_versioned_transition"
	ReplTaskVerifyVersionedTransition = "verify_versioned_transition"
)
View Source
const NamespaceLifecycleEventName = "namespace_lifecycle"

NamespaceLifecycleEventName is the stable event name for the generic, phase-discriminated wide event describing namespace-level activity (replication, failover, configuration, admission, handover, etc.). This package owns only the stable envelope: the set of phase values and the contents of Details are supplied by the emitter.

View Source
const ReplicationLifecycleEventName = "replication_lifecycle"

ReplicationLifecycleEventName is the stable event name for the ReplicationLifecycle wide event, which traces a replication task sent -> executing -> applied.

Variables

This section is empty.

Functions

func Emit

func Emit(logger log.Logger, p Payload)

Emit writes p as a single OTEL log record via logger. A nil logger is a safe no-op so call sites never need to guard. Batching, export, and serialization are handled by the LoggerProvider that produced logger.

func NewLogger

func NewLogger(lp log.LoggerProvider, serviceName string) log.Logger

NewLogger returns the OTEL logger used to emit events for serviceName. serviceName is attached as an instrumentation-scope attribute (OTEL semconv service.name) so every emitted event carries it, replacing per-event common-tag plumbing.

func NoopLogger

func NoopLogger() log.Logger

NoopLogger returns a logger that discards all events. Safe default for tests and for deployments that have not opted in to a real LoggerProvider.

Types

type NamespaceLifecyclePayload

type NamespaceLifecyclePayload struct {
	Phase       string
	Namespace   string
	NamespaceID string
	Details     map[string]any
}

NamespaceLifecyclePayload is the NamespaceLifecycle payload. The identity fields are stable; all phase-specific data goes in Details and is emitted as a single nested "details" object.

func (NamespaceLifecyclePayload) Attributes

func (p NamespaceLifecyclePayload) Attributes() []log.KeyValue

func (NamespaceLifecyclePayload) EventName

func (p NamespaceLifecyclePayload) EventName() string

type Payload

type Payload interface {
	// EventName is the stable name of the event type. It becomes the log record's event name so
	// events are easy to trace/grep by type.
	EventName() string
	// Attributes returns the event's fields as OTEL log key-values.
	Attributes() []log.KeyValue
}

Payload is the data of one wide event. Each event type implements it by supplying its stable event name and contributing its fields as OTEL log attributes.

type ReplicationLifecyclePayload

type ReplicationLifecyclePayload struct {
	Phase    ReplicationPhase
	TaskType string
	Shard    int32
	// task identity + cross-phase join key: (namespace_id, workflow_id, run_id, transition_count, task_type)
	Namespace       string
	NamespaceID     string
	WorkflowID      string
	RunID           string
	FailoverVersion int64
	TransitionCount int64
	// parent info: populated at every phase where mutable state is in hand (sent + applied) when
	// this workflow is itself a child. Only the child->parent direction is emitted (a child points
	// at its parent); the parent->children direction is intentionally not recorded here.
	ParentWorkflowID  string
	ParentRunID       string
	ParentInitiatedID int64
	Details           map[string]any
	// sent-only
	NewRunID string
	// SourceTaskID is the sender's replication-queue task id for this event, recorded so a "sent"
	// event can be correlated with the source cluster's replication queue.
	SourceTaskID int64
	IsFirstSync  bool
	FirstEventID int64
	NextEventID  int64
	// received-only
	Attempt int32
	// event_version_history is the (event_id, version) branch. It is emitted on executing (from the
	// task) and applied (from the resulting mutable state); the version disambiguates which history
	// branch the events are on.
	EventVersionHistory []VersionHistoryEntry
	// applied-only: post-apply mutable-state SUMMARY (no blob)
	State               string
	Status              string
	AppliedNextEventID  int64
	TransitionHistory   []VersionedTransitionEntry
	LastEventID         int64
	LastEventVersion    int64
	Outcome             string
	Error               string
	NewExecutionRunID   string
	ResetRunID          string
	SignalCount         int64
	ActivityCount       int64
	UserTimerCount      int64
	ChildExecutionCount int64
	UpdateCount         int64
}

func (ReplicationLifecyclePayload) Attributes

func (p ReplicationLifecyclePayload) Attributes() []log.KeyValue

func (ReplicationLifecyclePayload) EventName

func (p ReplicationLifecyclePayload) EventName() string

func (*ReplicationLifecyclePayload) PopulateParentInfo

PopulateParentInfo records the parent workflow identity when info describes a child workflow. A nil info or a workflow with no parent is a no-op, so call sites never need to guard.

type ReplicationPhase

type ReplicationPhase string
const (
	ReplicationSent      ReplicationPhase = "sent"
	ReplicationExecuting ReplicationPhase = "executing"
	ReplicationApplied   ReplicationPhase = "applied"
)

type VersionHistoryEntry

type VersionHistoryEntry struct {
	EventID int64 `json:"event_id"`
	Version int64 `json:"version"`
}

VersionHistoryEntry is one (event_id, version) point of an event version history branch.

type VersionedTransitionEntry

type VersionedTransitionEntry struct {
	FailoverVersion int64 `json:"failover_version"`
	TransitionCount int64 `json:"transition_count"`
}

VersionedTransitionEntry is one entry of a workflow's transition history.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL