Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0e7fded
Parallelize async operations in step handler for performance
pranaygp Feb 4, 2026
4817ae8
Fix race condition: await step_started before hydration
pranaygp Feb 4, 2026
af44568
Skip initial world.steps.get() in step handler for performance
pranaygp Feb 4, 2026
cc840ff
Add retryAfter validation to local and postgres worlds
pranaygp Feb 4, 2026
60db90f
Fix step terminal state HTTP status code to 409 (Conflict)
pranaygp Feb 5, 2026
16e8a3e
Fix world-vercel telemetry to use parent application's tracer
pranaygp Feb 5, 2026
2573fc4
Merge remote-tracking branch 'origin/main' into pranaygp/step-handler…
pranaygp Feb 5, 2026
23821f1
Update /demo command to include OTEL tracing with Jaeger
pranaygp Feb 5, 2026
f5ee654
Add OTEL instrumentation to world-local and improve trace consistency
pranaygp Feb 5, 2026
1d063ad
Use uppercase WORKFLOW and STEP span names for consistency with HTTP …
pranaygp Feb 5, 2026
8147d02
Add W3C trace context headers to step queue messages
pranaygp Feb 5, 2026
07204fe
Improve OTEL tracing with service attribution and enhanced instrument…
pranaygp Feb 5, 2026
f0a8a5d
Update changesets to reflect all PR changes
pranaygp Feb 5, 2026
9c9ce88
Use span name for rpc.method to show event type in Datadog resource
pranaygp Feb 5, 2026
db5bf68
Use lazy ref resolution for events where client discards response data
pranaygp Feb 6, 2026
15e4d4a
Merge remote-tracking branch 'origin/main' into pranaygp/step-handler…
pranaygp Feb 6, 2026
e4cfaf8
Update changeset to include lazy ref resolution optimization
pranaygp Feb 6, 2026
0058bb4
Address PR review comments: module scope const, comment cleanup, stat…
pranaygp Feb 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/otel-tracing-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@workflow/core": patch
"@workflow/world-local": patch
---

Improve OpenTelemetry tracing instrumentation

- Add W3C trace context headers to step queue messages for cross-service trace linking
- Add `peer.service` and RPC semantic conventions for external service attribution
- Add `step.hydrate` and `step.dehydrate` spans for argument serialization visibility
- Add `workflow.replay` span for workflow event replay tracking
- Rename `queueMessage` span to `queue.publish` following OTEL messaging conventions
- Add OTEL baggage propagation for workflow context (`workflow.run_id`, `workflow.name`)
- Add span events for milestones: `retry.scheduled`, `step.skipped`, `step.delayed`
- Enhance error telemetry with `recordException()` and error categorization (fatal/retryable/transient)
- Use uppercase span names (WORKFLOW, STEP) for consistency with HTTP spans
- Add world-local OTEL instrumentation matching world-vercel
12 changes: 12 additions & 0 deletions .changeset/step-handler-parallelization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@workflow/core": patch
"@workflow/world-local": patch
"@workflow/world-postgres": patch
---

Optimize step handler performance and improve server-side validation

- Skip initial `world.steps.get()` call in step handler (saves one HTTP round-trip)
- Add server-side `retryAfter` validation to local and postgres worlds (HTTP 425 when not reached)
- Fix HTTP status code for step terminal state: return 409 (Conflict) instead of 410
- Fix race condition: await `step_started` event before hydration to ensure correct attempt count
10 changes: 10 additions & 0 deletions .changeset/world-vercel-telemetry-tracer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@workflow/world-vercel": patch
---

Improve world-vercel telemetry and event creation performance

- Use parent application's 'workflow' tracer instead of separate service name
- Add `peer.service` and RPC semantic conventions for Datadog service maps
- Include event type in `world.events.create` span names (e.g., `world.events.create step_started`)
- Use lazy ref resolution for fire-and-forget events to skip S3 ref resolution (~200-460ms savings)
48 changes: 45 additions & 3 deletions .claude/commands/demo.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,51 @@
---
description: Run the 7_full demo workflow
allowed-tools: Bash(curl:*), Bash(npx workflow:*), Bash(pnpm dev)
allowed-tools: Bash(curl:*), Bash(npx workflow:*), Bash(pnpm dev), Bash(docker *), Bash(open *)
---

Run the demo workflow with OpenTelemetry tracing enabled.

Start the $ARUGMENTS workbench (default to the nextjs turboback workbench available in the workbenches directory). Run it in dev mode, and also start the workflow web UI (run `npx workflow web` inside the appropriate workbench directory).
## Steps

Then trigger the 7_full.ts workflow example. you can see how to trigger a specific example by looking at the trigger API route for the workbench - it is probably just a POST request using bash (maybe curl) to this endpoint: <http://localhost:3000/api/trigger\?workflowFile\=workflows/7_full.ts\&workflowFn\=handleUserSignup>>
1. **Start Jaeger** for OTEL trace visualization (if not already running):
```bash
docker run -d --name jaeger-otel \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
jaegertracing/jaeger:2.4.0 2>&1 || docker start jaeger-otel
```

2. **Open the Jaeger UI** in the browser:
```bash
open http://localhost:16686
```

3. **Start the workbench** (default: nextjs-turbopack) with OTEL tracing enabled:
```bash
cd workbench/nextjs-turbopack
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318" \
OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf" \
pnpm dev
```

Also start the workflow web UI in a separate terminal:
```bash
npx workflow web
```

4. **Trigger the 7_full.ts workflow**:
```bash
curl -X POST "http://localhost:3000/api/trigger?workflowFile=workflows/7_full.ts&workflowFn=handleUserSignup"
```

5. **View traces** in Jaeger UI at http://localhost:16686 - select service `example-nextjs-workflow`

## Tracing Details

The traces include:
- Step execution spans with `workflow.queue.overhead_ms`, `step.attempt`, `step.status`
- Workflow orchestration spans with `workflow.run.status`, `workflow.events.count`
- Queue message spans with messaging attributes

$ARGUMENTS can specify a different workbench (e.g., "example" or "nextjs-webpack").
Loading
Loading