@blaxel/core 0.2.4-dev.69 → 0.2.4-dev.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jobs/start.js
CHANGED
|
@@ -61,15 +61,16 @@ class BlJobWrapper {
|
|
|
61
61
|
catch (error) {
|
|
62
62
|
span.recordException(error);
|
|
63
63
|
span.setStatus('error', 'Job execution failed');
|
|
64
|
-
console.error('Job execution failed:', error);
|
|
65
64
|
span.end();
|
|
66
|
-
|
|
65
|
+
throw error;
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
const blStartJob = (func) => {
|
|
71
70
|
const job = new BlJobWrapper();
|
|
72
|
-
job.start(func).
|
|
71
|
+
job.start(func).then(async () => {
|
|
72
|
+
await (0, telemetry_js_1.flush)();
|
|
73
|
+
}).catch((error) => {
|
|
73
74
|
console.error('Job execution failed:', error);
|
|
74
75
|
process.exit(1);
|
|
75
76
|
});
|
|
@@ -32,6 +32,8 @@ export interface BlaxelSpan {
|
|
|
32
32
|
export interface BlaxelTelemetryProvider {
|
|
33
33
|
/** Create a new span */
|
|
34
34
|
startSpan(name: string, options?: BlaxelSpanOptions): BlaxelSpan;
|
|
35
|
+
/** Flush the telemetry provider */
|
|
36
|
+
flush(): Promise<void>;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Registry for managing the global telemetry provider
|
|
@@ -56,4 +58,5 @@ export declare const telemetryRegistry: TelemetryRegistry;
|
|
|
56
58
|
*/
|
|
57
59
|
export declare function startSpan(name: string, options?: BlaxelSpanOptions): BlaxelSpan;
|
|
58
60
|
export declare function withSpan<T>(name: string, fn: () => T, options?: BlaxelSpanOptions): T;
|
|
61
|
+
export declare function flush(): Promise<void>;
|
|
59
62
|
export {};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.telemetryRegistry = void 0;
|
|
5
5
|
exports.startSpan = startSpan;
|
|
6
6
|
exports.withSpan = withSpan;
|
|
7
|
+
exports.flush = flush;
|
|
7
8
|
/**
|
|
8
9
|
* No-operation implementation of Span
|
|
9
10
|
*/
|
|
@@ -22,6 +23,9 @@ class NoopTelemetryProvider {
|
|
|
22
23
|
startSpan() {
|
|
23
24
|
return new NoopSpan();
|
|
24
25
|
}
|
|
26
|
+
flush() {
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Registry for managing the global telemetry provider
|
|
@@ -71,3 +75,6 @@ function withSpan(name, fn, options) {
|
|
|
71
75
|
throw error;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
78
|
+
async function flush() {
|
|
79
|
+
await exports.telemetryRegistry.getProvider().flush();
|
|
80
|
+
}
|