bobbai00 commented on code in PR #9445:
URL: https://github.com/apache/texera/pull/9445#discussion_r4651737918


##########
common/observability/src/main/scala/org/apache/texera/observability/SpanAttrs.scala:
##########
@@ -35,4 +35,7 @@ object SpanAttrs {
 
   val WorkflowId: AttributeKey[java.lang.Long] = 
AttributeKey.longKey("texera.workflow.id")
   val ExecutionId: AttributeKey[java.lang.Long] = 
AttributeKey.longKey("texera.execution.id")
+  val ComputingUnitId: AttributeKey[java.lang.Long] =
+    AttributeKey.longKey("texera.computing_unit.id")

Review Comment:
   **Polish:**
   
   
[SpanAttrsSpec.scala:47-49](https://github.com/apache/texera/blob/a48464e5764654b1e0d676bf64e63b3307dea207/common/observability/src/test/scala/org/apache/texera/observability/SpanAttrsSpec.scala#L47-L49)
 pins each key's wire name, but not these two. The sync case asserts through 
the constants, so renaming either string passes every test. Two lines close it:
   ```scala
       SpanAttrs.ComputingUnitId.getKey shouldBe "texera.computing_unit.id"
       SpanAttrs.OperatorCount.getKey shouldBe "texera.operator.count"
   ```



##########
amber/src/main/scala/org/apache/texera/web/resource/SyncExecutionResource.scala:
##########
@@ -353,11 +362,24 @@ class SyncExecutionResource extends LazyLogging {
         compilationErrors = None,
         errors = if (fatalErrors.nonEmpty) Some(fatalErrors) else None
       )
+    }
 
-    } catch {
-      case e: Exception =>
-        logger.error(s"Sync execution error: ${e.getMessage}", e)
-        handleExecutionError(e)
+    try {
+      // A failed run (an early return or a caught exception) must mark the 
span ERROR, or
+      // Jaeger's error filter skips it; set it once from the single result.
+      val result =
+        try runExecution()
+        catch {
+          case e: Exception =>
+            logger.error(s"Sync execution error: ${e.getMessage}", e)
+            span.recordException(e)
+            handleExecutionError(e)
+        }
+      if (!result.success) span.setStatus(StatusCode.ERROR)
+      result
+    } finally {

Review Comment:
   **Advisory:**
   
   An `Error` such as an `OutOfMemoryError` inside `runExecution()` misses 
`case e: Exception` at L373. It never reaches L378 either, so the span ends 
UNSET with no exception event. The project's pattern catches `Throwable` here 
([TexeraTracer.scala:40](https://github.com/apache/texera/blob/a48464e5764654b1e0d676bf64e63b3307dea207/common/observability/src/main/scala/org/apache/texera/observability/TexeraTracer.scala#L40),
 
[WorkflowService.scala:389-393](https://github.com/apache/texera/blob/a48464e5764654b1e0d676bf64e63b3307dea207/amber/src/main/scala/org/apache/texera/web/service/WorkflowService.scala#L389-L393)).
 My round-1 trace missed this exit.
   ```suggestion
         result
       } catch {
         case t: Throwable =>
           span.recordException(t)
           span.setStatus(StatusCode.ERROR)
           throw t
       } finally {
   ```



##########
amber/src/test/scala/org/apache/texera/web/resource/SyncExecutionResourceSpec.scala:
##########
@@ -1217,4 +1254,37 @@ class SyncExecutionResourceSpec
     result.operators("scan-op").state shouldBe "Unknown"
     result.operators("scan-op").error shouldBe None
   }
+
+  it should "mark the execution span ERROR with correlation labels on a failed 
run" in {

Review Comment:
   **Polish:**
   
   The class Scaladoc at 
[L105](https://github.com/apache/texera/blob/a48464e5764654b1e0d676bf64e63b3307dea207/amber/src/test/scala/org/apache/texera/web/resource/SyncExecutionResourceSpec.scala#L105)
 still says `executeWorkflowSync` is driven by "one end-to-end case". This case 
makes it two, so that sentence needs updating.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to