@output.ai/core 0.5.3 → 0.5.4
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/package.json
CHANGED
package/src/consts.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Context } from '@temporalio/activity';
|
|
|
2
2
|
import { Storage } from '#async_storage';
|
|
3
3
|
import { addEventStart, addEventEnd, addEventError } from '#tracing';
|
|
4
4
|
import { headersToObject } from '../sandboxed_utils.js';
|
|
5
|
-
import {
|
|
5
|
+
import { LifecycleEvent, METADATA_ACCESS_SYMBOL } from '#consts';
|
|
6
6
|
import { activityHeartbeatEnabled, activityHeartbeatIntervalMs } from '../configs.js';
|
|
7
7
|
import { createChildLogger } from '#logger';
|
|
8
8
|
|
|
@@ -37,7 +37,7 @@ export class ActivityExecutionInterceptor {
|
|
|
37
37
|
const logContext = { workflowName, workflowId, stepId: activityId, stepName: activityType };
|
|
38
38
|
const traceArguments = { kind, id: activityId, parentId: workflowId, name: activityType, executionContext };
|
|
39
39
|
|
|
40
|
-
log.info(
|
|
40
|
+
log.info( `Started ${activityType} ${kind}`, { event: LifecycleEvent.START, kind, ...logContext } );
|
|
41
41
|
addEventStart( { details: input.args[0], ...traceArguments } );
|
|
42
42
|
|
|
43
43
|
const intervals = { heartbeat: null };
|
|
@@ -47,12 +47,14 @@ export class ActivityExecutionInterceptor {
|
|
|
47
47
|
|
|
48
48
|
const output = await Storage.runWithContext( async _ => next( input ), { parentId: activityId, executionContext } );
|
|
49
49
|
|
|
50
|
-
log.info(
|
|
50
|
+
log.info( `Ended ${activityType} ${kind}`, { event: LifecycleEvent.END, kind, ...logContext, durationMs: Date.now() - startDate } );
|
|
51
51
|
addEventEnd( { details: output, ...traceArguments } );
|
|
52
52
|
return output;
|
|
53
53
|
|
|
54
54
|
} catch ( error ) {
|
|
55
|
-
log.error(
|
|
55
|
+
log.error( `Error ${activityType} ${kind}: ${error.message}`, {
|
|
56
|
+
event: LifecycleEvent.ERROR, kind, ...logContext, durationMs: Date.now() - startDate, error: error.message
|
|
57
|
+
} );
|
|
56
58
|
addEventError( { details: error, ...traceArguments } );
|
|
57
59
|
throw error;
|
|
58
60
|
|
package/src/worker/sinks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LifecycleEvent,
|
|
1
|
+
import { LifecycleEvent, WORKFLOW_CATALOG } from '#consts';
|
|
2
2
|
import { addEventStart, addEventEnd, addEventError } from '#tracing';
|
|
3
3
|
import { createChildLogger } from '#logger';
|
|
4
4
|
|
|
@@ -34,11 +34,12 @@ const logWorkflowEvent = ( event, workflowInfo, error ) => {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if ( event === LifecycleEvent.START ) {
|
|
37
|
-
log.info(
|
|
37
|
+
log.info( `Started ${workflowName} workflow`, { event, workflowName, workflowId } );
|
|
38
38
|
} else if ( event === LifecycleEvent.END ) {
|
|
39
|
-
log.info(
|
|
39
|
+
log.info( `Ended ${workflowName} workflow`, { event, workflowName, workflowId, durationMs: Date.now() - startTime.getTime() } );
|
|
40
40
|
} else if ( event === LifecycleEvent.ERROR ) {
|
|
41
|
-
log.
|
|
41
|
+
log.error( `Error ${workflowName} workflow: ${error.message}`, {
|
|
42
|
+
event,
|
|
42
43
|
workflowName,
|
|
43
44
|
workflowId,
|
|
44
45
|
durationMs: Date.now() - startTime.getTime(),
|