From 0917fb473c14e5cb33b4938500a7c57da5da432c Mon Sep 17 00:00:00 2001 From: Valentin Genev Date: Sat, 19 Oct 2019 17:45:40 +0300 Subject: [PATCH] expanded exit points --- src/lib/masterSpan/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib/masterSpan/index.js b/src/lib/masterSpan/index.js index 6b15c55..545dac4 100644 --- a/src/lib/masterSpan/index.js +++ b/src/lib/masterSpan/index.js @@ -37,7 +37,7 @@ 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' && @@ -45,8 +45,17 @@ const cacheSpanContext = async (spanContext, state, content) => { (!!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')