@temporalio/interceptors-opentelemetry 1.13.1 → 1.14.0
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/{LICENSE.md → LICENSE} +6 -8
- package/lib/client/index.d.ts +9 -1
- package/lib/client/index.js +122 -3
- package/lib/client/index.js.map +1 -1
- package/lib/instrumentation.d.ts +21 -3
- package/lib/instrumentation.js +52 -12
- package/lib/instrumentation.js.map +1 -1
- package/lib/worker/index.d.ts +8 -7
- package/lib/worker/index.js +29 -4
- package/lib/worker/index.js.map +1 -1
- package/lib/workflow/context-manager.d.ts +2 -1
- package/lib/workflow/context-manager.js +8 -2
- package/lib/workflow/context-manager.js.map +1 -1
- package/lib/workflow/definitions.d.ts +45 -1
- package/lib/workflow/definitions.js +44 -0
- package/lib/workflow/definitions.js.map +1 -1
- package/lib/workflow/index.d.ts +12 -1
- package/lib/workflow/index.js +112 -12
- package/lib/workflow/index.js.map +1 -1
- package/lib/workflow/runtime.js +3 -2
- package/lib/workflow/runtime.js.map +1 -1
- package/lib/workflow/span-exporter.d.ts +1 -0
- package/lib/workflow/span-exporter.js +5 -25
- package/lib/workflow/span-exporter.js.map +1 -1
- package/lib/workflow/workflow-module-loader.d.ts +28 -0
- package/lib/workflow/workflow-module-loader.js +56 -0
- package/lib/workflow/workflow-module-loader.js.map +1 -0
- package/package.json +18 -16
- package/src/client/index.ts +178 -5
- package/src/instrumentation.ts +62 -11
- package/src/worker/index.ts +48 -13
- package/src/workflow/context-manager.ts +13 -5
- package/src/workflow/definitions.ts +54 -0
- package/src/workflow/index.ts +146 -12
- package/src/workflow/runtime.ts +4 -2
- package/src/workflow/span-exporter.ts +7 -3
- package/src/workflow/workflow-module-loader.ts +64 -0
package/{LICENSE.md → LICENSE}
RENAMED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
The MIT License
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2021 Temporal Technologies Inc. All Rights Reserved
|
|
3
|
+
Copyright (c) 2021-2025 Temporal Technologies Inc. All rights reserved.
|
|
6
4
|
|
|
7
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -11,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
11
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
12
10
|
furnished to do so, subject to the following conditions:
|
|
13
11
|
|
|
14
|
-
The above copyright notice and this permission notice shall be included in
|
|
15
|
-
copies or substantial portions of the Software.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
16
14
|
|
|
17
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
-
SOFTWARE.
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as otel from '@opentelemetry/api';
|
|
2
|
-
import { Next,
|
|
2
|
+
import type { Next, WorkflowSignalInput, WorkflowSignalWithStartInput, WorkflowStartInput, WorkflowStartOutput, WorkflowStartUpdateInput, WorkflowStartUpdateOutput, WorkflowStartUpdateWithStartInput, WorkflowStartUpdateWithStartOutput, WorkflowQueryInput, WorkflowTerminateInput, WorkflowCancelInput, WorkflowDescribeInput, WorkflowClientInterceptor, TerminateWorkflowExecutionResponse, RequestCancelWorkflowExecutionResponse, DescribeWorkflowExecutionResponse } from '@temporalio/client';
|
|
3
3
|
export interface InterceptorOptions {
|
|
4
4
|
readonly tracer?: otel.Tracer;
|
|
5
5
|
}
|
|
@@ -13,4 +13,12 @@ export declare class OpenTelemetryWorkflowClientInterceptor implements WorkflowC
|
|
|
13
13
|
constructor(options?: InterceptorOptions);
|
|
14
14
|
start(input: WorkflowStartInput, next: Next<WorkflowClientInterceptor, 'start'>): Promise<string>;
|
|
15
15
|
signal(input: WorkflowSignalInput, next: Next<WorkflowClientInterceptor, 'signal'>): Promise<void>;
|
|
16
|
+
startWithDetails(input: WorkflowStartInput, next: Next<WorkflowClientInterceptor, 'startWithDetails'>): Promise<WorkflowStartOutput>;
|
|
17
|
+
startUpdate(input: WorkflowStartUpdateInput, next: Next<WorkflowClientInterceptor, 'startUpdate'>): Promise<WorkflowStartUpdateOutput>;
|
|
18
|
+
startUpdateWithStart(input: WorkflowStartUpdateWithStartInput, next: Next<WorkflowClientInterceptor, 'startUpdateWithStart'>): Promise<WorkflowStartUpdateWithStartOutput>;
|
|
19
|
+
signalWithStart(input: WorkflowSignalWithStartInput, next: Next<WorkflowClientInterceptor, 'signalWithStart'>): Promise<string>;
|
|
20
|
+
query(input: WorkflowQueryInput, next: Next<WorkflowClientInterceptor, 'query'>): Promise<unknown>;
|
|
21
|
+
terminate(input: WorkflowTerminateInput, next: Next<WorkflowClientInterceptor, 'terminate'>): Promise<TerminateWorkflowExecutionResponse>;
|
|
22
|
+
cancel(input: WorkflowCancelInput, next: Next<WorkflowClientInterceptor, 'cancel'>): Promise<RequestCancelWorkflowExecutionResponse>;
|
|
23
|
+
describe(input: WorkflowDescribeInput, next: Next<WorkflowClientInterceptor, 'describe'>): Promise<DescribeWorkflowExecutionResponse>;
|
|
16
24
|
}
|
package/lib/client/index.js
CHANGED
|
@@ -42,7 +42,8 @@ class OpenTelemetryWorkflowClientInterceptor {
|
|
|
42
42
|
tracer: this.tracer,
|
|
43
43
|
spanName: `${workflow_1.SpanName.WORKFLOW_START}${workflow_1.SPAN_DELIMITER}${input.workflowType}`,
|
|
44
44
|
fn: async (span) => {
|
|
45
|
-
const headers =
|
|
45
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
46
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.options.workflowId);
|
|
46
47
|
const runId = await next({ ...input, headers });
|
|
47
48
|
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, runId);
|
|
48
49
|
return runId;
|
|
@@ -53,12 +54,130 @@ class OpenTelemetryWorkflowClientInterceptor {
|
|
|
53
54
|
return await (0, instrumentation_1.instrument)({
|
|
54
55
|
tracer: this.tracer,
|
|
55
56
|
spanName: `${workflow_1.SpanName.WORKFLOW_SIGNAL}${workflow_1.SPAN_DELIMITER}${input.signalName}`,
|
|
56
|
-
fn: async () => {
|
|
57
|
-
|
|
57
|
+
fn: async (span) => {
|
|
58
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowExecution.workflowId);
|
|
59
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
58
60
|
await next({ ...input, headers });
|
|
59
61
|
},
|
|
60
62
|
});
|
|
61
63
|
}
|
|
64
|
+
async startWithDetails(input, next) {
|
|
65
|
+
return await (0, instrumentation_1.instrument)({
|
|
66
|
+
tracer: this.tracer,
|
|
67
|
+
spanName: `${workflow_1.SpanName.WORKFLOW_START}${workflow_1.SPAN_DELIMITER}${input.workflowType}`,
|
|
68
|
+
fn: async (span) => {
|
|
69
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
70
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.options.workflowId);
|
|
71
|
+
const output = await next({ ...input, headers });
|
|
72
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, output.runId);
|
|
73
|
+
return output;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async startUpdate(input, next) {
|
|
78
|
+
return await (0, instrumentation_1.instrument)({
|
|
79
|
+
tracer: this.tracer,
|
|
80
|
+
spanName: `${workflow_1.SpanName.WORKFLOW_START_UPDATE}${workflow_1.SPAN_DELIMITER}${input.updateName}`,
|
|
81
|
+
fn: async (span) => {
|
|
82
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowExecution.workflowId);
|
|
83
|
+
if (input.options.updateId) {
|
|
84
|
+
span.setAttribute(instrumentation_1.UPDATE_ID_ATTR_KEY, input.options.updateId);
|
|
85
|
+
}
|
|
86
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
87
|
+
const output = await next({ ...input, headers });
|
|
88
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, output.workflowRunId);
|
|
89
|
+
return output;
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async startUpdateWithStart(input, next) {
|
|
94
|
+
return await (0, instrumentation_1.instrument)({
|
|
95
|
+
tracer: this.tracer,
|
|
96
|
+
spanName: `${workflow_1.SpanName.WORKFLOW_UPDATE_WITH_START}${workflow_1.SPAN_DELIMITER}${input.updateName}`,
|
|
97
|
+
fn: async (span) => {
|
|
98
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowStartOptions.workflowId);
|
|
99
|
+
if (input.updateOptions.updateId) {
|
|
100
|
+
span.setAttribute(instrumentation_1.UPDATE_ID_ATTR_KEY, input.updateOptions.updateId);
|
|
101
|
+
}
|
|
102
|
+
const workflowStartHeaders = (0, instrumentation_1.headersWithContext)(input.workflowStartHeaders);
|
|
103
|
+
const updateHeaders = (0, instrumentation_1.headersWithContext)(input.updateHeaders);
|
|
104
|
+
const output = await next({ ...input, workflowStartHeaders, updateHeaders });
|
|
105
|
+
if (output.workflowExecution.runId) {
|
|
106
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, output.workflowExecution.runId);
|
|
107
|
+
}
|
|
108
|
+
return output;
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async signalWithStart(input, next) {
|
|
113
|
+
return await (0, instrumentation_1.instrument)({
|
|
114
|
+
tracer: this.tracer,
|
|
115
|
+
spanName: `${workflow_1.SpanName.WORKFLOW_SIGNAL_WITH_START}${workflow_1.SPAN_DELIMITER}${input.workflowType}`,
|
|
116
|
+
fn: async (span) => {
|
|
117
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.options.workflowId);
|
|
118
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
119
|
+
const runId = await next({ ...input, headers });
|
|
120
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, runId);
|
|
121
|
+
return runId;
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
async query(input, next) {
|
|
126
|
+
return await (0, instrumentation_1.instrument)({
|
|
127
|
+
tracer: this.tracer,
|
|
128
|
+
spanName: `${workflow_1.SpanName.WORKFLOW_QUERY}${workflow_1.SPAN_DELIMITER}${input.queryType}`,
|
|
129
|
+
fn: async (span) => {
|
|
130
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
131
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowExecution.workflowId);
|
|
132
|
+
if (input.workflowExecution.runId) {
|
|
133
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, input.workflowExecution.runId);
|
|
134
|
+
}
|
|
135
|
+
return await next({ ...input, headers });
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async terminate(input, next) {
|
|
140
|
+
return await (0, instrumentation_1.instrument)({
|
|
141
|
+
tracer: this.tracer,
|
|
142
|
+
spanName: workflow_1.SpanName.WORKFLOW_TERMINATE,
|
|
143
|
+
fn: async (span) => {
|
|
144
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowExecution.workflowId);
|
|
145
|
+
if (input.workflowExecution.runId) {
|
|
146
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, input.workflowExecution.runId);
|
|
147
|
+
}
|
|
148
|
+
if (input.reason) {
|
|
149
|
+
span.setAttribute(instrumentation_1.TERMINATE_REASON_ATTR_KEY, input.reason);
|
|
150
|
+
}
|
|
151
|
+
return await next(input);
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async cancel(input, next) {
|
|
156
|
+
return await (0, instrumentation_1.instrument)({
|
|
157
|
+
tracer: this.tracer,
|
|
158
|
+
spanName: workflow_1.SpanName.WORKFLOW_CANCEL,
|
|
159
|
+
fn: async (span) => {
|
|
160
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowExecution.workflowId);
|
|
161
|
+
if (input.workflowExecution.runId) {
|
|
162
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, input.workflowExecution.runId);
|
|
163
|
+
}
|
|
164
|
+
return await next(input);
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async describe(input, next) {
|
|
169
|
+
return await (0, instrumentation_1.instrument)({
|
|
170
|
+
tracer: this.tracer,
|
|
171
|
+
spanName: workflow_1.SpanName.WORKFLOW_DESCRIBE,
|
|
172
|
+
fn: async (span) => {
|
|
173
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, input.workflowExecution.workflowId);
|
|
174
|
+
if (input.workflowExecution.runId) {
|
|
175
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, input.workflowExecution.runId);
|
|
176
|
+
}
|
|
177
|
+
return await next(input);
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
62
181
|
}
|
|
63
182
|
exports.OpenTelemetryWorkflowClientInterceptor = OpenTelemetryWorkflowClientInterceptor;
|
|
64
183
|
//# sourceMappingURL=index.js.map
|
package/lib/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAoB3C,wDAO4B;AAC5B,0CAAuD;AAMvD;;;;GAIG;AACH,MAAa,sCAAsC;IAC9B,MAAM,CAAc;IAEvC,YAAY,OAA4B;QACtC,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;IAC1F,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAyB,EAAE,IAA8C;QACnF,OAAO,MAAM,IAAA,4BAAU,EAAC;YACtB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,GAAG,mBAAQ,CAAC,cAAc,GAAG,yBAAc,GAAG,KAAK,CAAC,YAAY,EAAE;YAC5E,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACjB,MAAM,OAAO,GAAG,IAAA,oCAAkB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAClD,IAAI,CAAC,YAAY,CAAC,sCAAoB,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBAClE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,iCAAe,EAAE,KAAK,CAAC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,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAlLD,wFAkLC"}
|
package/lib/instrumentation.d.ts
CHANGED
|
@@ -3,19 +3,33 @@
|
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
5
|
import * as otel from '@opentelemetry/api';
|
|
6
|
-
import { Headers } from '@temporalio/common';
|
|
6
|
+
import { type Headers } from '@temporalio/common';
|
|
7
7
|
/** Default trace header for opentelemetry interceptors */
|
|
8
8
|
export declare const TRACE_HEADER = "_tracer-data";
|
|
9
9
|
/** As in workflow run id */
|
|
10
10
|
export declare const RUN_ID_ATTR_KEY = "run_id";
|
|
11
|
+
/** As in workflow id */
|
|
12
|
+
export declare const WORKFLOW_ID_ATTR_KEY = "temporalWorkflowId";
|
|
13
|
+
/** As in activity id */
|
|
14
|
+
export declare const ACTIVITY_ID_ATTR_KEY = "temporalActivityId";
|
|
15
|
+
/** As in update id */
|
|
16
|
+
export declare const UPDATE_ID_ATTR_KEY = "temporalUpdateId";
|
|
17
|
+
/** As in termination reason */
|
|
18
|
+
export declare const TERMINATE_REASON_ATTR_KEY = "temporalTerminateReason";
|
|
19
|
+
/** As in Nexus service */
|
|
20
|
+
export declare const NEXUS_SERVICE_ATTR_KEY = "temporalNexusService";
|
|
21
|
+
/** As in Nexus operation */
|
|
22
|
+
export declare const NEXUS_OPERATION_ATTR_KEY = "temporalNexusOperation";
|
|
23
|
+
/** As in Nexus endpoint */
|
|
24
|
+
export declare const NEXUS_ENDPOINT_ATTR_KEY = "temporalNexusEndpoint";
|
|
11
25
|
/**
|
|
12
26
|
* If found, return an otel Context deserialized from the provided headers
|
|
13
27
|
*/
|
|
14
|
-
export declare function extractContextFromHeaders(headers: Headers):
|
|
28
|
+
export declare function extractContextFromHeaders(headers: Headers): otel.Context | undefined;
|
|
15
29
|
/**
|
|
16
30
|
* Given headers, return new headers with the current otel context inserted
|
|
17
31
|
*/
|
|
18
|
-
export declare function headersWithContext(headers: Headers):
|
|
32
|
+
export declare function headersWithContext(headers: Headers): Headers;
|
|
19
33
|
export interface InstrumentOptions<T> {
|
|
20
34
|
tracer: otel.Tracer;
|
|
21
35
|
spanName: string;
|
|
@@ -23,7 +37,11 @@ export interface InstrumentOptions<T> {
|
|
|
23
37
|
context?: otel.Context;
|
|
24
38
|
acceptableErrors?: (err: unknown) => boolean;
|
|
25
39
|
}
|
|
40
|
+
export type InstrumentOptionsSync<T> = Omit<InstrumentOptions<T>, 'fn'> & {
|
|
41
|
+
fn: (span: otel.Span) => T;
|
|
42
|
+
};
|
|
26
43
|
/**
|
|
27
44
|
* Wraps `fn` in a span which ends when function returns or throws
|
|
28
45
|
*/
|
|
29
46
|
export declare function instrument<T>({ tracer, spanName, fn, context, acceptableErrors, }: InstrumentOptions<T>): Promise<T>;
|
|
47
|
+
export declare function instrumentSync<T>({ tracer, spanName, fn, context, acceptableErrors }: InstrumentOptionsSync<T>): T;
|
package/lib/instrumentation.js
CHANGED
|
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.RUN_ID_ATTR_KEY = exports.TRACE_HEADER = void 0;
|
|
26
|
+
exports.NEXUS_ENDPOINT_ATTR_KEY = exports.NEXUS_OPERATION_ATTR_KEY = exports.NEXUS_SERVICE_ATTR_KEY = exports.TERMINATE_REASON_ATTR_KEY = exports.UPDATE_ID_ATTR_KEY = exports.ACTIVITY_ID_ATTR_KEY = exports.WORKFLOW_ID_ATTR_KEY = exports.RUN_ID_ATTR_KEY = exports.TRACE_HEADER = void 0;
|
|
27
27
|
exports.extractContextFromHeaders = extractContextFromHeaders;
|
|
28
28
|
exports.headersWithContext = headersWithContext;
|
|
29
29
|
exports.instrument = instrument;
|
|
30
|
+
exports.instrumentSync = instrumentSync;
|
|
30
31
|
/**
|
|
31
32
|
* opentelemetry instrumentation helper functions
|
|
32
33
|
* @module
|
|
@@ -37,11 +38,25 @@ const common_1 = require("@temporalio/common");
|
|
|
37
38
|
exports.TRACE_HEADER = '_tracer-data';
|
|
38
39
|
/** As in workflow run id */
|
|
39
40
|
exports.RUN_ID_ATTR_KEY = 'run_id';
|
|
41
|
+
/** As in workflow id */
|
|
42
|
+
exports.WORKFLOW_ID_ATTR_KEY = 'temporalWorkflowId';
|
|
43
|
+
/** As in activity id */
|
|
44
|
+
exports.ACTIVITY_ID_ATTR_KEY = 'temporalActivityId';
|
|
45
|
+
/** As in update id */
|
|
46
|
+
exports.UPDATE_ID_ATTR_KEY = 'temporalUpdateId';
|
|
47
|
+
/** As in termination reason */
|
|
48
|
+
exports.TERMINATE_REASON_ATTR_KEY = 'temporalTerminateReason';
|
|
49
|
+
/** As in Nexus service */
|
|
50
|
+
exports.NEXUS_SERVICE_ATTR_KEY = 'temporalNexusService';
|
|
51
|
+
/** As in Nexus operation */
|
|
52
|
+
exports.NEXUS_OPERATION_ATTR_KEY = 'temporalNexusOperation';
|
|
53
|
+
/** As in Nexus endpoint */
|
|
54
|
+
exports.NEXUS_ENDPOINT_ATTR_KEY = 'temporalNexusEndpoint';
|
|
40
55
|
const payloadConverter = common_1.defaultPayloadConverter;
|
|
41
56
|
/**
|
|
42
57
|
* If found, return an otel Context deserialized from the provided headers
|
|
43
58
|
*/
|
|
44
|
-
|
|
59
|
+
function extractContextFromHeaders(headers) {
|
|
45
60
|
const encodedSpanContext = headers[exports.TRACE_HEADER];
|
|
46
61
|
if (encodedSpanContext === undefined) {
|
|
47
62
|
return undefined;
|
|
@@ -52,7 +67,7 @@ async function extractContextFromHeaders(headers) {
|
|
|
52
67
|
/**
|
|
53
68
|
* Given headers, return new headers with the current otel context inserted
|
|
54
69
|
*/
|
|
55
|
-
|
|
70
|
+
function headersWithContext(headers) {
|
|
56
71
|
const carrier = {};
|
|
57
72
|
otel.propagation.inject(otel.context.active(), carrier, otel.defaultTextMapSetter);
|
|
58
73
|
return { ...headers, [exports.TRACE_HEADER]: payloadConverter.toPayload(carrier) };
|
|
@@ -64,21 +79,38 @@ async function wrapWithSpan(span, fn, acceptableErrors) {
|
|
|
64
79
|
return ret;
|
|
65
80
|
}
|
|
66
81
|
catch (err) {
|
|
67
|
-
|
|
68
|
-
if (acceptableErrors === undefined || !acceptableErrors(err)) {
|
|
69
|
-
const statusCode = isBenignErr ? otel.SpanStatusCode.UNSET : otel.SpanStatusCode.ERROR;
|
|
70
|
-
span.setStatus({ code: statusCode, message: err.message ?? String(err) });
|
|
71
|
-
span.recordException(err);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
span.setStatus({ code: otel.SpanStatusCode.OK });
|
|
75
|
-
}
|
|
82
|
+
maybeAddErrorToSpan(err, span, acceptableErrors);
|
|
76
83
|
throw err;
|
|
77
84
|
}
|
|
78
85
|
finally {
|
|
79
86
|
span.end();
|
|
80
87
|
}
|
|
81
88
|
}
|
|
89
|
+
function wrapWithSpanSync(span, fn, acceptableErrors) {
|
|
90
|
+
try {
|
|
91
|
+
const ret = fn(span);
|
|
92
|
+
span.setStatus({ code: otel.SpanStatusCode.OK });
|
|
93
|
+
return ret;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
maybeAddErrorToSpan(err, span, acceptableErrors);
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
span.end();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function maybeAddErrorToSpan(err, span, acceptableErrors) {
|
|
104
|
+
const isBenignErr = err instanceof common_1.ApplicationFailure && err.category === common_1.ApplicationFailureCategory.BENIGN;
|
|
105
|
+
if (acceptableErrors === undefined || !acceptableErrors(err)) {
|
|
106
|
+
const statusCode = isBenignErr ? otel.SpanStatusCode.UNSET : otel.SpanStatusCode.ERROR;
|
|
107
|
+
span.setStatus({ code: statusCode, message: err.message ?? String(err) });
|
|
108
|
+
span.recordException(err);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
span.setStatus({ code: otel.SpanStatusCode.OK });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
82
114
|
/**
|
|
83
115
|
* Wraps `fn` in a span which ends when function returns or throws
|
|
84
116
|
*/
|
|
@@ -90,4 +122,12 @@ async function instrument({ tracer, spanName, fn, context, acceptableErrors, })
|
|
|
90
122
|
}
|
|
91
123
|
return await tracer.startActiveSpan(spanName, async (span) => await wrapWithSpan(span, fn, acceptableErrors));
|
|
92
124
|
}
|
|
125
|
+
function instrumentSync({ tracer, spanName, fn, context, acceptableErrors }) {
|
|
126
|
+
if (context) {
|
|
127
|
+
return otel.context.with(context, () => {
|
|
128
|
+
return tracer.startActiveSpan(spanName, (span) => wrapWithSpanSync(span, fn, acceptableErrors));
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return tracer.startActiveSpan(spanName, (span) => wrapWithSpanSync(span, fn, acceptableErrors));
|
|
132
|
+
}
|
|
93
133
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,8DAOC;AAKD,gDAIC;AA4DD,gCAaC;AAED,wCAOC;AAtID;;;GAGG;AACH,yDAA2C;AAC3C,+CAK4B;AAE5B,0DAA0D;AAC7C,QAAA,YAAY,GAAG,cAAc,CAAC;AAC3C,4BAA4B;AACf,QAAA,eAAe,GAAG,QAAQ,CAAC;AACxC,wBAAwB;AACX,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,wBAAwB;AACX,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,sBAAsB;AACT,QAAA,kBAAkB,GAAG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E,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAClG,CAAC"}
|
package/lib/worker/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as otel from '@opentelemetry/api';
|
|
2
|
-
import { Resource } from '@opentelemetry/resources';
|
|
3
|
-
import { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
4
|
-
import { Context as ActivityContext } from '@temporalio/activity';
|
|
5
|
-
import {
|
|
6
|
-
import { OpenTelemetryWorkflowExporter } from '../workflow';
|
|
2
|
+
import type { Resource } from '@opentelemetry/resources';
|
|
3
|
+
import type { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
4
|
+
import type { Context as ActivityContext } from '@temporalio/activity';
|
|
5
|
+
import type { Next, ActivityInboundCallsInterceptor, ActivityOutboundCallsInterceptor, InjectedSink, GetLogAttributesInput, GetMetricTagsInput, ActivityExecuteInput } from '@temporalio/worker';
|
|
6
|
+
import { type OpenTelemetryWorkflowExporter } from '../workflow';
|
|
7
7
|
export interface InterceptorOptions {
|
|
8
8
|
readonly tracer?: otel.Tracer;
|
|
9
9
|
}
|
|
@@ -20,14 +20,15 @@ export declare class OpenTelemetryActivityInboundInterceptor implements Activity
|
|
|
20
20
|
execute(input: ActivityExecuteInput, next: Next<ActivityInboundCallsInterceptor, 'execute'>): Promise<unknown>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Intercepts calls to emit logs from an Activity.
|
|
23
|
+
* Intercepts calls to emit logs and metrics from an Activity.
|
|
24
24
|
*
|
|
25
|
-
* Attach OpenTelemetry context tracing attributes to emitted log messages, if appropriate.
|
|
25
|
+
* Attach OpenTelemetry context tracing attributes to emitted log messages and metrics, if appropriate.
|
|
26
26
|
*/
|
|
27
27
|
export declare class OpenTelemetryActivityOutboundInterceptor implements ActivityOutboundCallsInterceptor {
|
|
28
28
|
protected readonly ctx: ActivityContext;
|
|
29
29
|
constructor(ctx: ActivityContext);
|
|
30
30
|
getLogAttributes(input: GetLogAttributesInput, next: Next<ActivityOutboundCallsInterceptor, 'getLogAttributes'>): Record<string, unknown>;
|
|
31
|
+
getMetricTags(input: GetMetricTagsInput, next: Next<ActivityOutboundCallsInterceptor, 'getMetricTags'>): GetMetricTagsInput;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Takes an opentelemetry SpanExporter and turns it into an injected Workflow span exporter sink
|
package/lib/worker/index.js
CHANGED
|
@@ -42,16 +42,26 @@ class OpenTelemetryActivityInboundInterceptor {
|
|
|
42
42
|
this.tracer = options?.tracer ?? otel.trace.getTracer('@temporalio/interceptor-activity');
|
|
43
43
|
}
|
|
44
44
|
async execute(input, next) {
|
|
45
|
-
const context =
|
|
45
|
+
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
46
46
|
const spanName = `${workflow_1.SpanName.ACTIVITY_EXECUTE}${workflow_1.SPAN_DELIMITER}${this.ctx.info.activityType}`;
|
|
47
|
-
return await (0, instrumentation_1.instrument)({
|
|
47
|
+
return await (0, instrumentation_1.instrument)({
|
|
48
|
+
tracer: this.tracer,
|
|
49
|
+
spanName,
|
|
50
|
+
fn: (span) => {
|
|
51
|
+
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, this.ctx.info.workflowExecution.workflowId);
|
|
52
|
+
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, this.ctx.info.workflowExecution.runId);
|
|
53
|
+
span.setAttribute(instrumentation_1.ACTIVITY_ID_ATTR_KEY, this.ctx.info.activityId);
|
|
54
|
+
return next(input);
|
|
55
|
+
},
|
|
56
|
+
context,
|
|
57
|
+
});
|
|
48
58
|
}
|
|
49
59
|
}
|
|
50
60
|
exports.OpenTelemetryActivityInboundInterceptor = OpenTelemetryActivityInboundInterceptor;
|
|
51
61
|
/**
|
|
52
|
-
* Intercepts calls to emit logs from an Activity.
|
|
62
|
+
* Intercepts calls to emit logs and metrics from an Activity.
|
|
53
63
|
*
|
|
54
|
-
* Attach OpenTelemetry context tracing attributes to emitted log messages, if appropriate.
|
|
64
|
+
* Attach OpenTelemetry context tracing attributes to emitted log messages and metrics, if appropriate.
|
|
55
65
|
*/
|
|
56
66
|
class OpenTelemetryActivityOutboundInterceptor {
|
|
57
67
|
ctx;
|
|
@@ -73,6 +83,21 @@ class OpenTelemetryActivityOutboundInterceptor {
|
|
|
73
83
|
return next(input);
|
|
74
84
|
}
|
|
75
85
|
}
|
|
86
|
+
getMetricTags(input, next) {
|
|
87
|
+
const span = otel.trace.getSpan(otel.context.active());
|
|
88
|
+
const spanContext = span?.spanContext();
|
|
89
|
+
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
90
|
+
return next({
|
|
91
|
+
trace_id: spanContext.traceId,
|
|
92
|
+
span_id: spanContext.spanId,
|
|
93
|
+
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
94
|
+
...input,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return next(input);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
76
101
|
}
|
|
77
102
|
exports.OpenTelemetryActivityOutboundInterceptor = OpenTelemetryActivityOutboundInterceptor;
|
|
78
103
|
/**
|
package/lib/worker/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/worker/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/worker/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2GA,oDAiBC;AA5HD,yDAA2C;AAa3C,wDAM4B;AAC5B,0CAAkH;AAMlH;;;;;GAKG;AACH,MAAa,uCAAuC;IAI7B;IAHF,MAAM,CAAc;IAEvC,YACqB,GAAoB,EACvC,OAA4B;QADT,QAAG,GAAH,GAAG,CAAiB;QAGvC,IAAI,CAAC,MAAM,G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AU,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;oBAC3C,qFAAqF;oBACrF,OAAO,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;gBACnD,CAAC,CAAC,CAAC;gBACH,0CAA0C;gBAC1C,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC1C,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,YAA8B,EAAE,QAAkB;IAC7E,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,YAAY,CAAC;IAC9C,OAAO;QACL,WAAW;YACT,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,QAAQ;QACR,GAAG,IAAI;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as otel from '@opentelemetry/api';
|
|
2
2
|
export declare class ContextManager implements otel.ContextManager {
|
|
3
|
-
protected storage: import("async_hooks").AsyncLocalStorage<otel.Context
|
|
3
|
+
protected storage: import("async_hooks").AsyncLocalStorage<otel.Context> | undefined;
|
|
4
|
+
constructor();
|
|
4
5
|
active(): otel.Context;
|
|
5
6
|
bind<T>(context: otel.Context, target: T): T;
|
|
6
7
|
enable(): this;
|
|
@@ -25,9 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ContextManager = void 0;
|
|
27
27
|
const otel = __importStar(require("@opentelemetry/api"));
|
|
28
|
-
const
|
|
28
|
+
const workflow_module_loader_1 = require("./workflow-module-loader");
|
|
29
|
+
const AsyncLocalStorage = (0, workflow_module_loader_1.getWorkflowModuleIfAvailable)()?.AsyncLocalStorage;
|
|
29
30
|
class ContextManager {
|
|
30
|
-
|
|
31
|
+
// If `@temporalio/workflow` is not available, ignore for now.
|
|
32
|
+
// When ContextManager is constructed module resolution error will be thrown.
|
|
33
|
+
storage = AsyncLocalStorage ? new AsyncLocalStorage() : undefined;
|
|
34
|
+
constructor() {
|
|
35
|
+
(0, workflow_module_loader_1.ensureWorkflowModuleLoaded)();
|
|
36
|
+
}
|
|
31
37
|
active() {
|
|
32
38
|
return this.storage.getStore() || otel.ROOT_CONTEXT;
|
|
33
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../src/workflow/context-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../src/workflow/context-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qEAAoG;AAEpG,MAAM,iBAAiB,GAAG,IAAA,qDAA4B,GAAE,EAAE,iBAAiB,CAAC;AAE5E,MAAa,cAAc;IACzB,8DAA8D;IAC9D,6EAA6E;IACnE,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,IAAI,iBAAiB,EAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1F;QACE,IAAA,mDAA0B,GAAE,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAQ,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;IACvD,CAAC;IAED,IAAI,CAAI,OAAqB,EAAE,MAAS;QACtC,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,MAAM,IAAI,SAAS,CAAC,2CAA2C,OAAO,MAAM,EAAE,CAAC,CAAC;QAClF,CAAC;QAED,8JAA8J;QAC9J,MAAM,cAAc,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;YAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,cAAc,EAAE,QAAQ,EAAE;YAC9C,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,MAAM,CAAC,MAAM;SACrB,CAAC,CAAC;QACH;;;WAGG;QACH,8DAA8D;QAC9D,OAAO,cAAqB,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAQ,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CACF,OAAqB,EACrB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,MAAM,EAAE,GAAG,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,OAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;CACF;AAtDD,wCAsDC"}
|
|
@@ -45,6 +45,46 @@ export declare enum SpanName {
|
|
|
45
45
|
* Workflow is client calls signalWithStart
|
|
46
46
|
*/
|
|
47
47
|
WORKFLOW_SIGNAL_WITH_START = "SignalWithStartWorkflow",
|
|
48
|
+
/**
|
|
49
|
+
* Workflow is queried
|
|
50
|
+
*/
|
|
51
|
+
WORKFLOW_QUERY = "QueryWorkflow",
|
|
52
|
+
/**
|
|
53
|
+
* Workflow update is started by client
|
|
54
|
+
*/
|
|
55
|
+
WORKFLOW_START_UPDATE = "StartWorkflowUpdate",
|
|
56
|
+
/**
|
|
57
|
+
* Workflow is started with an update
|
|
58
|
+
*/
|
|
59
|
+
WORKFLOW_UPDATE_WITH_START = "UpdateWithStartWorkflow",
|
|
60
|
+
/**
|
|
61
|
+
* Workflow handles an incoming signal
|
|
62
|
+
*/
|
|
63
|
+
WORKFLOW_HANDLE_SIGNAL = "HandleSignal",
|
|
64
|
+
/**
|
|
65
|
+
* Workflow handles an incoming query
|
|
66
|
+
*/
|
|
67
|
+
WORKFLOW_HANDLE_QUERY = "HandleQuery",
|
|
68
|
+
/**
|
|
69
|
+
* Workflow handles an incoming update
|
|
70
|
+
*/
|
|
71
|
+
WORKFLOW_HANDLE_UPDATE = "HandleUpdate",
|
|
72
|
+
/**
|
|
73
|
+
* Workflow validates an incoming update
|
|
74
|
+
*/
|
|
75
|
+
WORKFLOW_VALIDATE_UPDATE = "ValidateUpdate",
|
|
76
|
+
/**
|
|
77
|
+
* Workflow is terminated
|
|
78
|
+
*/
|
|
79
|
+
WORKFLOW_TERMINATE = "TerminateWorkflow",
|
|
80
|
+
/**
|
|
81
|
+
* Workflow is cancelled
|
|
82
|
+
*/
|
|
83
|
+
WORKFLOW_CANCEL = "CancelWorkflow",
|
|
84
|
+
/**
|
|
85
|
+
* Workflow is described
|
|
86
|
+
*/
|
|
87
|
+
WORKFLOW_DESCRIBE = "DescribeWorkflow",
|
|
48
88
|
/**
|
|
49
89
|
* Workflow run is executing
|
|
50
90
|
*/
|
|
@@ -64,6 +104,10 @@ export declare enum SpanName {
|
|
|
64
104
|
/**
|
|
65
105
|
* Workflow is continuing as new
|
|
66
106
|
*/
|
|
67
|
-
CONTINUE_AS_NEW = "ContinueAsNew"
|
|
107
|
+
CONTINUE_AS_NEW = "ContinueAsNew",
|
|
108
|
+
/**
|
|
109
|
+
* Nexus operation is started
|
|
110
|
+
*/
|
|
111
|
+
NEXUS_OPERATION_START = "StartNexusOperation"
|
|
68
112
|
}
|
|
69
113
|
export declare const SPAN_DELIMITER = ":";
|
|
@@ -15,6 +15,46 @@ var SpanName;
|
|
|
15
15
|
* Workflow is client calls signalWithStart
|
|
16
16
|
*/
|
|
17
17
|
SpanName["WORKFLOW_SIGNAL_WITH_START"] = "SignalWithStartWorkflow";
|
|
18
|
+
/**
|
|
19
|
+
* Workflow is queried
|
|
20
|
+
*/
|
|
21
|
+
SpanName["WORKFLOW_QUERY"] = "QueryWorkflow";
|
|
22
|
+
/**
|
|
23
|
+
* Workflow update is started by client
|
|
24
|
+
*/
|
|
25
|
+
SpanName["WORKFLOW_START_UPDATE"] = "StartWorkflowUpdate";
|
|
26
|
+
/**
|
|
27
|
+
* Workflow is started with an update
|
|
28
|
+
*/
|
|
29
|
+
SpanName["WORKFLOW_UPDATE_WITH_START"] = "UpdateWithStartWorkflow";
|
|
30
|
+
/**
|
|
31
|
+
* Workflow handles an incoming signal
|
|
32
|
+
*/
|
|
33
|
+
SpanName["WORKFLOW_HANDLE_SIGNAL"] = "HandleSignal";
|
|
34
|
+
/**
|
|
35
|
+
* Workflow handles an incoming query
|
|
36
|
+
*/
|
|
37
|
+
SpanName["WORKFLOW_HANDLE_QUERY"] = "HandleQuery";
|
|
38
|
+
/**
|
|
39
|
+
* Workflow handles an incoming update
|
|
40
|
+
*/
|
|
41
|
+
SpanName["WORKFLOW_HANDLE_UPDATE"] = "HandleUpdate";
|
|
42
|
+
/**
|
|
43
|
+
* Workflow validates an incoming update
|
|
44
|
+
*/
|
|
45
|
+
SpanName["WORKFLOW_VALIDATE_UPDATE"] = "ValidateUpdate";
|
|
46
|
+
/**
|
|
47
|
+
* Workflow is terminated
|
|
48
|
+
*/
|
|
49
|
+
SpanName["WORKFLOW_TERMINATE"] = "TerminateWorkflow";
|
|
50
|
+
/**
|
|
51
|
+
* Workflow is cancelled
|
|
52
|
+
*/
|
|
53
|
+
SpanName["WORKFLOW_CANCEL"] = "CancelWorkflow";
|
|
54
|
+
/**
|
|
55
|
+
* Workflow is described
|
|
56
|
+
*/
|
|
57
|
+
SpanName["WORKFLOW_DESCRIBE"] = "DescribeWorkflow";
|
|
18
58
|
/**
|
|
19
59
|
* Workflow run is executing
|
|
20
60
|
*/
|
|
@@ -35,6 +75,10 @@ var SpanName;
|
|
|
35
75
|
* Workflow is continuing as new
|
|
36
76
|
*/
|
|
37
77
|
SpanName["CONTINUE_AS_NEW"] = "ContinueAsNew";
|
|
78
|
+
/**
|
|
79
|
+
* Nexus operation is started
|
|
80
|
+
*/
|
|
81
|
+
SpanName["NEXUS_OPERATION_START"] = "StartNexusOperation";
|
|
38
82
|
})(SpanName || (exports.SpanName = SpanName = {}));
|
|
39
83
|
exports.SPAN_DELIMITER = ':';
|
|
40
84
|
//# sourceMappingURL=definitions.js.map
|