Skip to content

Commit 823fd1b

Browse files
committed
More important commenting-out
1 parent d84e980 commit 823fd1b

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

services/meminator-nodejs/src/shellOut.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,46 @@ import { spawn } from 'child_process';
55

66
export
77
function spawnProcess(commandName: string, args: string[]): Promise<void> {
8-
return trace.getTracer('meminator').startActiveSpan(commandName, {
9-
attributes: {
10-
"app.command.name": commandName,
11-
"app.command.args": args.join(' ')
12-
}
13-
}, (span) => {
14-
return new Promise<void>((resolve, reject) => {
15-
const process = spawn(commandName, args);
16-
let stderrOutput = '';
17-
process.stderr.on('data', (data) => {
18-
stderrOutput += data;
19-
});
8+
// return trace.getTracer('meminator').startActiveSpan(commandName, {
9+
// attributes: {
10+
// "app.command.name": commandName,
11+
// "app.command.args": args.join(' ')
12+
// }
13+
// }, (span) => { #INSTRUMENTATION: wrap important unit of work in a span
14+
return new Promise<void>((resolve, reject) => {
15+
const process = spawn(commandName, args);
16+
let stderrOutput = '';
17+
process.stderr.on('data', (data) => {
18+
stderrOutput += data;
19+
});
2020

21-
let stdout = '';
22-
process.stdout.on('data', (data) => {
23-
stdout += data;
24-
});
21+
let stdout = '';
22+
process.stdout.on('data', (data) => {
23+
stdout += data;
24+
});
2525

26-
process.on('error', (error) => {
27-
span.recordException(error);
28-
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
29-
span.end();
30-
reject(error);
31-
});
26+
process.on('error', (error) => {
27+
// span.recordException(error);
28+
// span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
29+
// span.end();
30+
reject(error);
31+
});
3232

33-
process.on('close', (code) => {
34-
span.setAttributes({
35-
'app.command.exitCode': code || 0,
36-
'app.command.stderr': stderrOutput,
37-
'app.command.stdout': stdout
38-
});
39-
if (code !== 0) {
40-
span.setStatus({ code: SpanStatusCode.ERROR, message: "Process exited with " + code });
41-
span.end();
42-
reject(new Error(`Process exited with non-zero code: ${code}`));
43-
} else {
44-
span.end();
45-
resolve();
46-
}
47-
});
33+
process.on('close', (code) => {
34+
// span.setAttributes({
35+
// 'app.command.exitCode': code || 0,
36+
// 'app.command.stderr': stderrOutput,
37+
// 'app.command.stdout': stdout
38+
// });
39+
if (code !== 0) {
40+
// span.setStatus({ code: SpanStatusCode.ERROR, message: "Process exited with " + code });
41+
// span.end();
42+
reject(new Error(`Process exited with non-zero code: ${code}`));
43+
} else {
44+
// span.end();
45+
resolve();
46+
}
4847
});
4948
});
49+
// });
5050
}

0 commit comments

Comments
 (0)