UNPKG

workflow

Version:

Workflow DevKit - Build durable, resilient, and observable workflows

50 lines (37 loc) 1.14 kB
--- title: getWorkflowMetadata description: Access run IDs and timing information within workflow functions. type: reference summary: Call getWorkflowMetadata inside a workflow to access the run ID and timing information. prerequisites: - /docs/foundations/workflows-and-steps --- Returns additional metadata available in the current workflow function. You may want to use this function when you need to: * Log workflow run IDs * Access timing information of a workflow <Callout> If you need to access step context, take a look at [`getStepMetadata`](/docs/api-reference/workflow/get-step-metadata). </Callout> ```typescript lineNumbers import { getWorkflowMetadata } from "workflow" async function testWorkflow() { "use workflow" const ctx = getWorkflowMetadata() // [!code highlight] console.log(ctx.workflowRunId) } ``` ## API Signature ### Parameters <TSDoc definition={` import { getWorkflowMetadata } from "workflow"; export default getWorkflowMetadata;`} showSections={['parameters']} /> ### Returns <TSDoc definition={` import type { WorkflowMetadata } from "workflow"; export default WorkflowMetadata;`} />