Skip to content

docs: add Temporal TypeScript tracing example#3273

Open
ofeliacode wants to merge 1 commit into
langfuse:mainfrom
ofeliacode:docs-temporal-js-example
Open

docs: add Temporal TypeScript tracing example#3273
ofeliacode wants to merge 1 commit into
langfuse:mainfrom
ofeliacode:docs-temporal-js-example

Conversation

@ofeliacode

@ofeliacode ofeliacode commented Jul 9, 2026

Copy link
Copy Markdown

What does this PR do?

Closes #3248

Adds a TypeScript/JavaScript example to the Temporal integration guide showing how to trace Temporal workflows and activities with:

  • Temporal worker and client plugin setup

The source notebook and generated MDX page are both updated.

Test plan

  • git diff --check
  • npm exec --yes prettier -- --check content/integrations/frameworks/temporal.mdx
  • node -e "JSON.parse(require('fs').readFileSync('cookbook/integration_temporal.ipynb','utf8')); console.log('notebook json ok')"
  • node scripts/check-h1-headings.js content/integrations/frameworks/temporal.mdx

Greptile Summary

This PR adds a TypeScript/JavaScript tracing example to the Temporal integration guide, showing how to configure OpenTelemetryPlugin from @temporalio/interceptors-opentelemetry-v2 alongside LangfuseSpanProcessor to capture Temporal workflow and activity spans.

  • Adds three code snippets (instrumentation.ts, worker.ts, client.ts) demonstrating plugin setup for both the Temporal worker and client; the package and API usage (OpenTelemetryPlugin, Worker.create({ plugins }), Client({ plugins })) are all valid and consistent with current Temporal SDK docs.
  • The new section is placed between numbered Python steps 7 and 8, which may disrupt the sequential tutorial flow for Python users — moving it after step 8 or adding an explicit "optional alternative" callout would improve readability.
  • The plugins API on Worker and Client is marked experimental in the Temporal TypeScript SDK; a brief note would set reader expectations.

Confidence Score: 4/5

Safe to merge; the TypeScript code is correct and the packages referenced are official and exist on npm.

The code samples are technically accurate — OpenTelemetryPlugin is a real export, both Worker.create and Client accept plugins, and the LangfuseSpanProcessor wiring is consistent with Langfuse's own getting-started docs. The only concerns are editorial: section placement interrupts the numbered Python tutorial, and the experimental status of plugins is not disclosed. No functional bugs were found.

The placement of the TypeScript section within temporal.mdx (between steps 7 and 8) is the main thing worth a second look before merging.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant C as client.ts (Temporal Client)
    participant T as Temporal Server
    participant W as worker.ts (Temporal Worker)
    participant OTel as NodeSDK + OpenTelemetryPlugin
    participant LF as Langfuse (via LangfuseSpanProcessor)

    C->>OTel: setupOtelSdk() – registers LangfuseSpanProcessor globally
    C->>C: "new Client({ plugins: [OpenTelemetryPlugin] })"
    C->>T: client.workflow.execute(ResearchWorkflow) + W3C trace context
    T->>W: dispatches workflow task (with propagated trace context)
    W->>OTel: setupOtelSdk() – registers LangfuseSpanProcessor (separate process)
    W->>W: "new Worker({ plugins: [OpenTelemetryPlugin] })"
    W->>W: executes workflow and activities
    W->>OTel: workflow/activity spans emitted
    OTel->>LF: exports spans via LangfuseSpanProcessor
    C->>OTel: client span exported on workflow completion
    OTel->>LF: exports client span
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant C as client.ts (Temporal Client)
    participant T as Temporal Server
    participant W as worker.ts (Temporal Worker)
    participant OTel as NodeSDK + OpenTelemetryPlugin
    participant LF as Langfuse (via LangfuseSpanProcessor)

    C->>OTel: setupOtelSdk() – registers LangfuseSpanProcessor globally
    C->>C: "new Client({ plugins: [OpenTelemetryPlugin] })"
    C->>T: client.workflow.execute(ResearchWorkflow) + W3C trace context
    T->>W: dispatches workflow task (with propagated trace context)
    W->>OTel: setupOtelSdk() – registers LangfuseSpanProcessor (separate process)
    W->>W: "new Worker({ plugins: [OpenTelemetryPlugin] })"
    W->>W: executes workflow and activities
    W->>OTel: workflow/activity spans emitted
    OTel->>LF: exports spans via LangfuseSpanProcessor
    C->>OTel: client span exported on workflow completion
    OTel->>LF: exports client span
Loading
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
content/integrations/frameworks/temporal.mdx:299
**TypeScript section breaks the numbered step flow**

The "TypeScript/JavaScript Example" section is inserted between "## 7. Run the Workflow" and "## 8. View Traces in Langfuse", interrupting a numbered Python tutorial. A Python user following steps 1–8 will unexpectedly hit several TypeScript screens mid-flow before reaching the final step. Consider moving this section after "## 8. View Traces in Langfuse" as an addendum, or making the section numbering/placement explicit (e.g., a note before it saying the section is an optional alternative for TS/JS users).

### Issue 2 of 3
content/integrations/frameworks/temporal.mdx:305-307
**`@temporalio/workflow` and `@temporalio/activity` installed but not shown being used**

The install command lists `@temporalio/workflow` and `@temporalio/activity`, but none of the three code snippets (`instrumentation.ts`, `worker.ts`, `client.ts`) import from these packages. They would be needed in the unshown `workflows.ts` and `activities.ts` files. It's fine to include them, but a brief note that they belong to the workflow/activity definition files (not shown here) would help users understand why they're in the install command.

### Issue 3 of 3
content/integrations/frameworks/temporal.mdx:336-363
**`plugins` option is experimental in the Temporal TypeScript SDK**

According to the Temporal TypeScript SDK documentation, the `plugins` option on both `Worker.create()` and `Client` is marked as **experimental** and its APIs may change without notice. The example looks correct today, but adding a brief callout (e.g., a note block) alerting users to this status would prevent confusion when the API evolves.

Reviews (1): Last reviewed commit: "docs: add Temporal TypeScript tracing ex..." | Re-trigger Greptile

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the langfuse Team on Vercel.

A member of the Team first needs to authorize it.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 9, 2026
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@CLAassistant

CLAassistant commented Jul 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Jul 9, 2026
@ofeliacode
ofeliacode force-pushed the docs-temporal-js-example branch from f5b955e to ca7940b Compare July 14, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feedback for "Trace Temporal Workflows with Langfuse"

2 participants