Skip to content

Commit 2c0f895

Browse files
scottcaometa-codesync[bot]
authored andcommitted
Add error field to AnalysisEnd event
Summary: Adds an `error` field to the `AnalysisEnd` buck2_data event so downstream consumers can tell whether a target's analysis succeeded or failed. This mirrors the existing `error` field on `LoadBuildFileEnd`: it is `Some(message)` on failure and `None` on success. landed-with-radar-review Reviewed By: IanChilds Differential Revision: D109932996 fbshipit-source-id: b2a7dc9a041ba119219f4f943d495eaae741339a
1 parent f2951b9 commit 2c0f895

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

app/buck2_action_impl/src/dynamic/deferred.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ async fn execute_lambda(
338338
Ok((token, finalized))
339339
});
340340

341+
let error = output.as_ref().err().map(|e| format!("{e:#}"));
342+
341343
(
342344
output,
343345
buck2_data::AnalysisEnd {
@@ -348,6 +350,7 @@ async fn execute_lambda(
348350
profile: None,
349351
declared_actions,
350352
declared_artifacts,
353+
error,
351354
},
352355
)
353356
})

app/buck2_analysis/src/analysis/calculation.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ async fn get_analysis_result_inner(
336336
MaybeCompatible::Compatible(result)
337337
};
338338

339+
let error = result.as_ref().err().map(|e| format!("{e:#}"));
340+
339341
(
340342
(result, split_instants),
341343
buck2_data::AnalysisEnd {
@@ -344,6 +346,7 @@ async fn get_analysis_result_inner(
344346
profile,
345347
declared_actions,
346348
declared_artifacts,
349+
error,
347350
},
348351
)
349352
})

app/buck2_anon_target/src/anon_targets.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ impl AnonTargetKey {
483483
profile: None, // Not implemented for anon targets
484484
declared_actions: res.as_ref().ok().map(|(v, _)| v.num_declared_actions),
485485
declared_artifacts: res.as_ref().ok().map(|(v, _)| v.num_declared_artifacts),
486+
error: res.as_ref().err().map(|e| format!("{e:#}")),
486487
};
487488
(res, end)
488489
},

app/buck2_data/data.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,6 +2093,7 @@ message AnalysisEnd {
20932093
AnalysisProfile profile = 2;
20942094
optional uint64 declared_actions = 6;
20952095
optional uint64 declared_artifacts = 7;
2096+
optional string error = 8;
20962097
}
20972098

20982099
message AnalysisStageStart {

0 commit comments

Comments
 (0)