samples-typescript icon indicating copy to clipboard operation
samples-typescript copied to clipboard

[Bug] instrumentation example incorrect

Open selbyk opened this issue 2 years ago • 0 comments

What are you really trying to do?

Trying to add logging with context to our workflows and activities

Describe the bug

https://github.com/temporalio/samples-typescript/tree/main/instrumentation README shows expected output:

2021-11-24T15:53:45.474Z [workflow] info: Greeted {
  workflowType: 'logSampleWorkflow',
  runId: 'a5be427c-cc4d-4f28-a407-33cda16d1ab7',
  workflowId: 'instrumentation-sample-0',
  namespace: 'default',
  taskQueue: 'instrumentation',
  isReplaying: false,
  greeting: 'Hello, Temporal!'
}
2021-11-24T15:53:45.474Z [workflow] debug: workflow completed {
  workflowType: 'logSampleWorkflow',
  runId: 'a5be427c-cc4d-4f28-a407-33cda16d1ab7',
  workflowId: 'instrumentation-sample-0',
  namespace: 'default',
  taskQueue: 'instrumentation',
  isReplaying: false,
  durationMs: 39
}

I cloned the repo and tried running the example. I am seeing this output:

2023-06-29T19:49:01.626Z [workflow] info: Greeted { greeting: 'Hello, Temporal!' }
2023-06-29T19:49:01.627Z [workflow] debug: workflow completed { durationMs: 43 }

(https://github.com/temporalio/samples-typescript/blob/main/instrumentation/src/worker.ts#L91 was commented out, without it the workflow interceptor isn't even used and there is a log with debug: Workflow completed instead of debug: workflow completed)

Minimal Reproduction

Minimal reproduction is the https://github.com/temporalio/samples-typescript/tree/main/instrumentation example

Environment/Versions

  • OS and processor: M2 Mac
  • Temporal Version:
    • samples-typescript - temporal cli 0.8.0 - temporal server 1.20.1 - temporal sdk 1.7.0
    • our app
      • temporal cloud
      • temporal sdk 1.8.0
  • Are you using Docker or Kubernetes or building Temporal from source? temporal cli/temporal cloud

Additional context

I was trying to reproduce this example in our app that bundles workflows for hours. Eventually I decided to clone https://github.com/temporalio/samples-typescript/tree/main/instrumentation and run the MVP to iterate from a working example, but I noticed the example does not produce the output shown in the README.md

selbyk avatar Jun 29 '23 20:06 selbyk