Skip to content

Commit

Permalink
expanded exit points
Browse files Browse the repository at this point in the history
  • Loading branch information
vgenev committed Oct 19, 2019
1 parent 691c3bc commit 0917fb4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lib/masterSpan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,25 @@ const cacheSpanContext = async (spanContext, state, content) => {
return (service === 'ml_notification_event' && tags.transactionType === 'transfer' && tags.transactionAction === 'fulfil')
}

const isPrepareError = () => {
const isNotificationError = () => {
return (
service === 'ml_notification_event' &&
tags.transactionType === 'transfer' &&
tags.transactionAction === 'prepare' &&
(!!tags.errorCode || (!!trace && !!trace[trace.length - 1].spanContext.tags.errorCode)))
}

const isLastSpan = () => {
return (isPrepareError() || isFulfil() || service === 'final service')
const isPrepareError = () => {
return (
service === 'ml_transfer_prepare' &&
tags.transactionType === 'transfer' &&
tags.transactionAction === 'prepare' &&
!!tags.errorCode
)
}

const isLastSpan = () => { // TODO EXPAND THOSE TO FULLY COVER ALL EXIT POINTS
return (isPrepareError() || isNotificationError() || isFulfil() || service === 'final service')
}

const newSpanId = crypto.randomBytes(8).toString('hex')
Expand Down

0 comments on commit 0917fb4

Please sign in to comment.