Skip to content

Commit 948b60f

Browse files
authored
Merge pull request #319 from DeterminateSystems/otel-execution-failure-on-the-span
Otel execution failure on the span
2 parents f3319de + 9701c1a commit 948b60f

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎dist/index.js‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171782,7 +171782,6 @@ function makeNixCommandArgs(nixOptions, flakeInputs, commitMessage) {
171782171782
// src/index.ts
171783171783

171784171784

171785-
var EVENT_EXECUTION_FAILURE = "detsys.execution_failure";
171786171785
var ATTR_EXIT_CODE = "detsys.exit_code";
171787171786
var UpdateFlakeLockAction = class extends DetSysAction {
171788171787
constructor() {
@@ -171828,10 +171827,9 @@ var UpdateFlakeLockAction = class extends DetSysAction {
171828171827
);
171829171828
span.setAttribute(ATTR_EXIT_CODE, exitCode);
171830171829
if (exitCode !== 0) {
171831-
this.addEvent(EVENT_EXECUTION_FAILURE, {
171832-
[ATTR_EXIT_CODE]: exitCode
171833-
});
171834-
log_exports.setFailed(`non-zero exit code of ${exitCode} detected`);
171830+
const failure = new Error(`non-zero exit code of ${exitCode} detected`);
171831+
recordSpanError(span, failure);
171832+
log_exports.setFailed(failure);
171835171833
} else {
171836171834
log_exports.info(`flake.lock file was successfully updated`);
171837171835
}

‎dist/index.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/index.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import {
44
DetSysAction,
55
inputs,
66
log,
7+
recordSpanError,
78
withSpan,
89
} from "@determinate-systems/detsys-ts";
910

10-
const EVENT_EXECUTION_FAILURE = "detsys.execution_failure";
11-
1211
const ATTR_EXIT_CODE = "detsys.exit_code";
1312

1413
class UpdateFlakeLockAction extends DetSysAction {
@@ -73,10 +72,11 @@ class UpdateFlakeLockAction extends DetSysAction {
7372
span.setAttribute(ATTR_EXIT_CODE, exitCode);
7473

7574
if (exitCode !== 0) {
76-
this.addEvent(EVENT_EXECUTION_FAILURE, {
77-
[ATTR_EXIT_CODE]: exitCode,
78-
});
79-
log.setFailed(`non-zero exit code of ${exitCode} detected`);
75+
// The program failed, thus the span failed. The exit code is already
76+
// on the span, which is all that the event carried.
77+
const failure = new Error(`non-zero exit code of ${exitCode} detected`);
78+
recordSpanError(span, failure);
79+
log.setFailed(failure);
8080
} else {
8181
log.info(`flake.lock file was successfully updated`);
8282
}

0 commit comments

Comments
 (0)