Skip to content

Commit

Permalink
Update processOrders.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Jan 26, 2025
1 parent e0d6e44 commit 3cb01c5
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/processOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,16 @@ export const processOrders = async (
}

for (const { settle, pair, orderPairObject } of results) {
// instantiate a span for this pair
const span = tracer.startSpan(`order_${pair}`, undefined, ctx);
span.setAttribute("details.owner", orderPairObject.takeOrders[0].takeOrder.order.owner);
try {
// settle the process results
// this will return the report of the operation and in case
// there was a revert tx, it will try to simulate it and find
// the root cause as well
const result = await settle();

// instantiate a span for this pair
const span = tracer.startSpan(`order_${pair}`, undefined, ctx);
span.setAttribute("details.owner", orderPairObject.takeOrders[0].takeOrder.order.owner);

// keep track of avg gas cost
if (result.gasCost) {
txGasCosts.push(result.gasCost);
Expand All @@ -266,12 +265,7 @@ export const processOrders = async (
span.setAttribute("severity", ErrorSeverity.HIGH);
span.setStatus({ code: SpanStatusCode.ERROR, message: "unexpected error" });
}
span.end();
} catch (e: any) {
// instantiate a span for this pair
const span = tracer.startSpan(`order_${pair}`, undefined, ctx);
span.setAttribute("details.owner", orderPairObject.takeOrders[0].takeOrder.order.owner);

// set the span attributes with the values gathered at processPair()
span.setAttributes(e.spanAttributes);

Expand Down Expand Up @@ -394,8 +388,8 @@ export const processOrders = async (
span.setAttribute("severity", ErrorSeverity.HIGH);
span.setStatus({ code: SpanStatusCode.ERROR, message });
}
span.end();
}
span.end();
}
return {
reports,
Expand Down

0 comments on commit 3cb01c5

Please sign in to comment.