feat: expose workflow and step names in metadata functions#1285
Conversation
Add `workflowName` to `WorkflowMetadata` and `stepName` to `StepMetadata`, making them available via `getWorkflowMetadata()` and `getStepMetadata()`. This is useful for adding context to structured logs, collating logs during investigations, and bucketing errors by workflow/step name. Closes #1103
🦋 Changeset detectedLatest commit: 235466e The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (54 failed)mongodb (3 failed):
redis (2 failed):
turso (49 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
There was a problem hiding this comment.
Pull request overview
This PR extends the public metadata APIs so workflow and step functions can reliably include human-meaningful identifiers (workflowName, stepName) in structured logs and diagnostics, addressing #1103.
Changes:
- Add
workflowNametoWorkflowMetadataand plumb it into workflow VM context and step execution context. - Add
stepNametoStepMetadataand plumb it into step execution context. - Update e2e/examples and serialization tests to assert/propagate the new metadata fields.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| workbench/example/workflows/99_e2e.ts | Returns workflowName as part of the workflow metadata payload for the e2e workflow. |
| packages/core/src/workflow/get-workflow-metadata.ts | Extends WorkflowMetadata with workflowName. |
| packages/core/src/workflow.ts | Populates workflowName into the workflow VM global metadata context. |
| packages/core/src/step/get-step-metadata.ts | Extends StepMetadata with stepName. |
| packages/core/src/runtime/step-handler.ts | Populates stepName and workflowName into AsyncLocalStorage context for step execution. |
| packages/core/src/serialization.test.ts | Updates test context to include stepName/workflowName. |
| packages/core/e2e/e2e.test.ts | Adds e2e assertions for workflowName and stepName availability/absence in the right contexts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Signed-off-by: Nathan Rajlich <n@n8.io>
Summary
workflowNametoWorkflowMetadataandstepNametoStepMetadata, making them available viagetWorkflowMetadata()andgetStepMetadata()Closes #1103