@unlaxer/tramli-plugins 3.4.0 → 3.5.1
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.
|
@@ -21,5 +21,7 @@ export declare class ObservabilityEnginePlugin implements EnginePlugin {
|
|
|
21
21
|
constructor(sink: TelemetrySink);
|
|
22
22
|
descriptor(): PluginDescriptor;
|
|
23
23
|
kind(): "ENGINE";
|
|
24
|
-
install(engine: FlowEngine
|
|
24
|
+
install(engine: FlowEngine, options?: {
|
|
25
|
+
append?: boolean;
|
|
26
|
+
}): void;
|
|
25
27
|
}
|
|
@@ -16,8 +16,13 @@ class ObservabilityEnginePlugin {
|
|
|
16
16
|
return { id: 'observability', displayName: 'Observability', description: 'Telemetry via engine logger hooks' };
|
|
17
17
|
}
|
|
18
18
|
kind() { return 'ENGINE'; }
|
|
19
|
-
install(engine) {
|
|
19
|
+
install(engine, options) {
|
|
20
|
+
const append = options?.append ?? false;
|
|
21
|
+
const prevTransition = append ? engine.getTransitionLogger() : undefined;
|
|
22
|
+
const prevError = append ? engine.getErrorLogger() : undefined;
|
|
23
|
+
const prevGuard = append ? engine.getGuardLogger() : undefined;
|
|
20
24
|
engine.setTransitionLogger(entry => {
|
|
25
|
+
prevTransition?.(entry);
|
|
21
26
|
this.sink.emit({
|
|
22
27
|
type: 'transition', flowId: entry.flowId, flowName: entry.flowName,
|
|
23
28
|
data: { from: entry.from, to: entry.to, trigger: entry.trigger, durationMicros: entry.durationMicros },
|
|
@@ -25,6 +30,7 @@ class ObservabilityEnginePlugin {
|
|
|
25
30
|
});
|
|
26
31
|
});
|
|
27
32
|
engine.setErrorLogger(entry => {
|
|
33
|
+
prevError?.(entry);
|
|
28
34
|
this.sink.emit({
|
|
29
35
|
type: 'error', flowId: entry.flowId, flowName: entry.flowName,
|
|
30
36
|
data: { from: entry.from, to: entry.to, trigger: entry.trigger, cause: entry.cause?.message, durationMicros: entry.durationMicros },
|
|
@@ -32,6 +38,7 @@ class ObservabilityEnginePlugin {
|
|
|
32
38
|
});
|
|
33
39
|
});
|
|
34
40
|
engine.setGuardLogger((entry) => {
|
|
41
|
+
prevGuard?.(entry);
|
|
35
42
|
this.sink.emit({
|
|
36
43
|
type: 'guard', flowId: entry.flowId, flowName: entry.flowName,
|
|
37
44
|
data: { state: entry.state, guardName: entry.guardName, result: entry.result, reason: entry.reason, durationMicros: entry.durationMicros },
|
|
@@ -21,5 +21,7 @@ export declare class ObservabilityEnginePlugin implements EnginePlugin {
|
|
|
21
21
|
constructor(sink: TelemetrySink);
|
|
22
22
|
descriptor(): PluginDescriptor;
|
|
23
23
|
kind(): "ENGINE";
|
|
24
|
-
install(engine: FlowEngine
|
|
24
|
+
install(engine: FlowEngine, options?: {
|
|
25
|
+
append?: boolean;
|
|
26
|
+
}): void;
|
|
25
27
|
}
|
|
@@ -12,8 +12,13 @@ export class ObservabilityEnginePlugin {
|
|
|
12
12
|
return { id: 'observability', displayName: 'Observability', description: 'Telemetry via engine logger hooks' };
|
|
13
13
|
}
|
|
14
14
|
kind() { return 'ENGINE'; }
|
|
15
|
-
install(engine) {
|
|
15
|
+
install(engine, options) {
|
|
16
|
+
const append = options?.append ?? false;
|
|
17
|
+
const prevTransition = append ? engine.getTransitionLogger() : undefined;
|
|
18
|
+
const prevError = append ? engine.getErrorLogger() : undefined;
|
|
19
|
+
const prevGuard = append ? engine.getGuardLogger() : undefined;
|
|
16
20
|
engine.setTransitionLogger(entry => {
|
|
21
|
+
prevTransition?.(entry);
|
|
17
22
|
this.sink.emit({
|
|
18
23
|
type: 'transition', flowId: entry.flowId, flowName: entry.flowName,
|
|
19
24
|
data: { from: entry.from, to: entry.to, trigger: entry.trigger, durationMicros: entry.durationMicros },
|
|
@@ -21,6 +26,7 @@ export class ObservabilityEnginePlugin {
|
|
|
21
26
|
});
|
|
22
27
|
});
|
|
23
28
|
engine.setErrorLogger(entry => {
|
|
29
|
+
prevError?.(entry);
|
|
24
30
|
this.sink.emit({
|
|
25
31
|
type: 'error', flowId: entry.flowId, flowName: entry.flowName,
|
|
26
32
|
data: { from: entry.from, to: entry.to, trigger: entry.trigger, cause: entry.cause?.message, durationMicros: entry.durationMicros },
|
|
@@ -28,6 +34,7 @@ export class ObservabilityEnginePlugin {
|
|
|
28
34
|
});
|
|
29
35
|
});
|
|
30
36
|
engine.setGuardLogger((entry) => {
|
|
37
|
+
prevGuard?.(entry);
|
|
31
38
|
this.sink.emit({
|
|
32
39
|
type: 'guard', flowId: entry.flowId, flowName: entry.flowName,
|
|
33
40
|
data: { state: entry.state, guardName: entry.guardName, result: entry.result, reason: entry.reason, durationMicros: entry.durationMicros },
|
package/package.json
CHANGED