Skip to content

Add step metadata how-to guide#1511

Open
Benanna2019 wants to merge 4 commits intomainfrom
ben/step-metadata-how-to
Open

Add step metadata how-to guide#1511
Benanna2019 wants to merge 4 commits intomainfrom
ben/step-metadata-how-to

Conversation

@Benanna2019
Copy link
Copy Markdown
Contributor

Summary

Adds a practical how-to page for step metadata following the Diataxis framework. Each section is a discrete task with code and just enough context inline:

  • Attach metadata to a step (both step.metadata and inngest.metadata inside step.run)
  • Use custom kinds to group metadata
  • Batch multiple updates in one step
  • Scope metadata to a specific target
  • Update metadata on a different run
  • Update metadata from outside a function
  • View metadata in the dashboard

Explanation content (batched vs API path, durability) is folded inline as context rather than a standalone section.

Companion to the reference page PR. Relates to DEV-276.

Requested reviewers

@AndyInternet @djfarrelly

Adds a practical how-to page for step metadata following Diataxis.
Covers attaching metadata to steps, custom kinds, batching, explicit
scoping, cross-run updates, external updates, and dashboard viewing.
Explanation content folded inline as context rather than standalone.

DEV-276
@Benanna2019 Benanna2019 requested a review from djfarrelly as a code owner March 31, 2026 19:50
@linear
Copy link
Copy Markdown

linear bot commented Mar 31, 2026

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Apr 1, 2026 5:52pm

Request Review

Copy link
Copy Markdown
Member

@djfarrelly djfarrelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Benanna2019 - I like a lot of parts about this and I actually think this could be the default guide in the main "Learn" side of the docs and the other guide should be in the "Reference" tab.

With that in mind, I'd love for the intro to kind of frame the problem a little bit more. I think with just a little bit of "what this is for" / "what problem am do I need solved" - this guide would hit home really hard for folks. There's lots to like here, but I think we could get it to "click" for readers a lot faster then the examples in this flow get them there really fast which is great for a how-to.


export const description = "Practical guides for attaching metadata to steps and runs, using custom kinds, batching updates, and working with cross-run metadata.";

# Step metadata how-to <VersionBadge version="TypeScript only" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: just an open question before this is added to the public docs if we call this "run metadata" "metadata" or "step metadata" - "step metadata" is our internal name and this feature more attaches metadata to runs, not steps.


This page walks through common tasks with step metadata. For the full API surface, see the [step metadata reference](/docs/features/inngest-functions/steps-workflows/metadata).

## Attach metadata to a step
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: I don't think this attaches metadata "to a step" itself, but rather attaches metadata to a run itself, it just gets tracked within it's own step. When I read "to a step" it makes me think that it'd be attaching metadata to an existing step like "process-payment"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: I think the key thing that is missing for me from this intro section is "why" would I use this? is it worth explaining why you'd do this? e.g. Attaching useful metadata about the run to help you debug or add extra context when looking at individual traces. Then sharing there are 2 key ways to add metadata, from within a step (inngest.metadata) and from anywhere with the function handler (step.metadata).

One meta thought on this is what's the goal of the guide, I know you mentioned diataxis the other day, and when thinking about this how-to guide and was wondering what the problem is that they're solving - even a little context above this could frame the user to saying "I'm adding metadata to my run for debugging - this is how you want to do it" (run level, add it this way, within a step, add it this way...)

);
```

In the dashboard, these show up as separate sections: "User Metadata (billing)" and "User Metadata (analytics)". This keeps things readable when a step has several categories of metadata.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

- Rename from "Step metadata" to "Metadata" per team consensus
- Add intro explaining why you'd use metadata (debugging, business
  context, annotating traces)
- Reframe "Attach metadata to a step" as "Add metadata to a run"
  since step.metadata attaches to the run, tracked in its own step
- Clarify both approaches: step.metadata for standalone updates,
  inngest.metadata for updates within an existing step

DEV-276
Lead with metadata as a step method alongside step.run, step.sleep,
step.waitForEvent. Rework intro and first section so the mental model
is clear: step.metadata creates a step that attaches metadata to the
run, the memoization ID works like any other step ID.

DEV-276
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.

2 participants