Skip to content

Observability hooks (tracing, logging, metrics) #6

Description

@camcima

Summary

There is currently no event emitter or hook system for lifecycle events like "workflow transitioned", "command started", "command failed", etc. For production use, teams need to wire these into OpenTelemetry traces, structured logging, or metrics.

Proposal

Add an observer/hook pattern at the runtime level with events such as:

  • workflow.created
  • workflow.transitioned (with from/to state, event name)
  • command.started
  • command.succeeded
  • command.failed
  • workflow.completed
  • workflow.errored

The hook system should be lightweight and non-intrusive — observers should not affect workflow execution.

Benefits

  • Enables OpenTelemetry integration for distributed tracing
  • Structured logging of workflow lifecycle without polluting command handlers
  • Metrics collection (transition counts, command durations, error rates)
  • Essential for production readiness

Considerations

  • Sync vs async observers (async observers shouldn't block transitions)
  • Whether observers receive a read-only view of context/metadata
  • Integration patterns with popular observability stacks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions