Skip to content

Commit

Permalink
fix: make traceparent source spans sync (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan authored Sep 17, 2023
1 parent c1f3a8d commit ec484ee
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/frontend/src/components/steps/Step2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,15 @@ const Step2 = ({ onFinish }: StepProps) => {
if (proof && trie) {
const sendExecutorServiceSpan = apmTransaction?.startSpan(
'send-request-to-executor-service',
'app'
'app',
{ sync: true }
)

const traceparent = `00-${
(sendExecutorServiceSpan as any).traceId
}-${(sendExecutorServiceSpan as any).id}-01`
const traceparent = sendExecutorServiceSpan
? `00-${(sendExecutorServiceSpan as any).traceId}-${
(sendExecutorServiceSpan as any).id
}-01`
: ''

const iface = new ethers.utils.Interface(ERC20MessagingJSON.abi)
let tokenSentLogIndex: number | undefined = undefined
Expand Down Expand Up @@ -185,12 +188,15 @@ const Step2 = ({ onFinish }: StepProps) => {
sendExecutorServiceSpan?.end()
const observeExecutorJobSpan = apmTransaction?.startSpan(
'wait-for-executor-service-job-execution',
'app'
'app',
{ sync: true }
)

const traceparent = `00-${
(observeExecutorJobSpan as any).traceId
}-${(observeExecutorJobSpan as any).id}-01`
const traceparent = observeExecutorJobSpan
? `00-${(observeExecutorJobSpan as any).traceId}-${
(observeExecutorJobSpan as any).id
}-01`
: ''

observeExecutorServiceJob(job.id, { traceparent }).subscribe({
next: (progress: number) => {
Expand Down

0 comments on commit ec484ee

Please sign in to comment.