@tigorhutasuhut/telemetry-js - v0.7.3
    Preparing search index...

    Function instrumentWorkflow

    • TC39 class decorator that instruments a Cloudflare Workflow with OpenTelemetry tracing.

      Intercepts the run method to:

      1. Initialise the SDK (handles fresh isolates after hibernation)
      2. Auto-extract traceparent from event.payload for cross-workflow propagation
      3. Create a root workflow.run span wrapping the entire execution
      4. Wrap the step object with traced versions of do, sleep, and sleepUntil — nested step calls automatically become children of the outer step's span

      Parameters

      Returns <T extends new (...args: any[]) => any>(
          target: T,
          _context: ClassDecoratorContext<T>,
      ) => T

      A TC39 class decorator.

      import { instrumentWorkflow } from "@tigorhutasuhut/telemetry-js";

      @instrumentWorkflow({ serviceName: "my-workflow" })
      export class MyWorkflow extends WorkflowEntrypoint {
      async run(event: WorkflowEvent, step: WorkflowStep) {
      await step.do("fetch-data", async () => { ... });
      }
      }