Skip to content

feat: propagate job context on queue v0.2 - #40

Merged
cmilesio merged 7 commits into
release/v0.2from
feat/context-propagation-v0.2
Nov 11, 2026
Merged

cmilesio merged 7 commits into
release/v0.2from
feat/context-propagation-v0.2

Conversation

@cmilesio

@cmilesio cmilesio commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What

Add optional context propagation to queue v0.2 so a job can continue the trace that dispatched it.

  • A generic ContextPropagator contract, with no new OpenTelemetry SDK dependency.
  • Bounded metadata in an optional field of the existing version-one envelope.
  • Context restoration before worker decorators and process observers, including the Redis worker adapter.
  • Retry, chain, batch, and callback coverage with receiver-owned cancellation and deadlines.
  • Redis worker capability is checked before startup, preserving decoration on native process observations and cleaning up unsupported candidates.

Why

GoForj supports Go 1.26, while queue v0.3 requires Go 1.27. This maintenance backport keeps the current framework minimum and the existing message payload/schema.

The review also removed a duplicate metadata decode, saving five allocations per traced logical dispatch. Disabled and empty-carrier allocation counts stay unchanged.

Root and Redis race suites pass on Go 1.26; the root minimum-Go check passes on Go 1.24.4. Concurrent distinct carriers, failure/retry/archive contexts, both adapter layers, unsupported-worker cleanup, and concurrent startup are covered. The full standalone module script passes. Maintenance CI and mechanical driver/example test repairs are separate commits.

Publish the root module and Redis adapter together. When the new propagation option is enabled, Redis worker startup requires an adapter with early context preparation and returns a clear capability error for older adapters. Publisher-only queues remain usable, and queues without a propagator keep their existing worker behavior.

Driver-owned retry-publication diagnostics on NATS, RabbitMQ, and SQS still retain worker context. Receiving handlers and normal retry delivery retain propagated context.

@cmilesio
cmilesio marked this pull request as ready for review November 11, 2026 16:38
@cmilesio
cmilesio merged commit 5a6ba0f into release/v0.2 Nov 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant