@temporalio/interceptors-opentelemetry 1.17.2 → 1.17.3
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 +12 -13
- package/lib/client/index.d.ts +0 -24
- package/lib/client/index.js +0 -183
- package/lib/client/index.js.map +0 -1
- package/lib/index.d.ts +0 -15
- package/lib/index.js +0 -34
- package/lib/index.js.map +0 -1
- package/lib/instrumentation.d.ts +0 -58
- package/lib/instrumentation.js +0 -156
- package/lib/instrumentation.js.map +0 -1
- package/lib/plugin.d.ts +0 -31
- package/lib/plugin.js +0 -66
- package/lib/plugin.js.map +0 -1
- package/lib/worker/index.d.ts +0 -69
- package/lib/worker/index.js +0 -235
- package/lib/worker/index.js.map +0 -1
- package/lib/workflow/context-manager.d.ts +0 -10
- package/lib/workflow/context-manager.js +0 -67
- package/lib/workflow/context-manager.js.map +0 -1
- package/lib/workflow/definitions.d.ts +0 -127
- package/lib/workflow/definitions.js +0 -92
- package/lib/workflow/definitions.js.map +0 -1
- package/lib/workflow/index.d.ts +0 -41
- package/lib/workflow/index.js +0 -275
- package/lib/workflow/index.js.map +0 -1
- package/lib/workflow/runtime.d.ts +0 -1
- package/lib/workflow/runtime.js +0 -20
- package/lib/workflow/runtime.js.map +0 -1
- package/lib/workflow/span-exporter.d.ts +0 -9
- package/lib/workflow/span-exporter.js +0 -48
- package/lib/workflow/span-exporter.js.map +0 -1
- package/lib/workflow/workflow-imports-impl.d.ts +0 -9
- package/lib/workflow/workflow-imports-impl.js +0 -20
- package/lib/workflow/workflow-imports-impl.js.map +0 -1
- package/lib/workflow/workflow-imports.d.ts +0 -19
- package/lib/workflow/workflow-imports.js +0 -26
- package/lib/workflow/workflow-imports.js.map +0 -1
- package/lib/workflow-interceptors.d.ts +0 -3
- package/lib/workflow-interceptors.js +0 -12
- package/lib/workflow-interceptors.js.map +0 -1
package/lib/worker/index.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as otel from '@opentelemetry/api';
|
|
2
|
-
import type { Resource } from '@opentelemetry/resources';
|
|
3
|
-
import type { SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
4
|
-
import type * as nexus from 'nexus-rpc';
|
|
5
|
-
import type { Context as ActivityContext } from '@temporalio/activity';
|
|
6
|
-
import type { Next, ActivityInboundCallsInterceptor, ActivityOutboundCallsInterceptor, NexusInboundCallsInterceptor, NexusOutboundCallsInterceptor, NexusStartOperationInput, NexusStartOperationOutput, NexusCancelOperationInput, InjectedSink, GetLogAttributesInput, GetMetricTagsInput, ActivityExecuteInput } from '@temporalio/worker';
|
|
7
|
-
import { type OpenTelemetryWorkflowExporter } from '../workflow/definitions';
|
|
8
|
-
export interface InterceptorOptions {
|
|
9
|
-
readonly tracer?: otel.Tracer;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Intercepts calls to start an Activity.
|
|
13
|
-
*
|
|
14
|
-
* Wraps the operation in an opentelemetry Span and links it to a parent Span context if one is
|
|
15
|
-
* provided in the Activity input headers.
|
|
16
|
-
*/
|
|
17
|
-
export declare class OpenTelemetryActivityInboundInterceptor implements ActivityInboundCallsInterceptor {
|
|
18
|
-
protected readonly ctx: ActivityContext;
|
|
19
|
-
protected readonly tracer: otel.Tracer;
|
|
20
|
-
constructor(ctx: ActivityContext, options?: InterceptorOptions);
|
|
21
|
-
execute(input: ActivityExecuteInput, next: Next<ActivityInboundCallsInterceptor, 'execute'>): Promise<unknown>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Intercepts calls to emit logs and metrics from an Activity.
|
|
25
|
-
*
|
|
26
|
-
* Attach OpenTelemetry context tracing attributes to emitted log messages and metrics, if appropriate.
|
|
27
|
-
*/
|
|
28
|
-
export declare class OpenTelemetryActivityOutboundInterceptor implements ActivityOutboundCallsInterceptor {
|
|
29
|
-
protected readonly ctx: ActivityContext;
|
|
30
|
-
constructor(ctx: ActivityContext);
|
|
31
|
-
getLogAttributes(input: GetLogAttributesInput, next: Next<ActivityOutboundCallsInterceptor, 'getLogAttributes'>): Record<string, unknown>;
|
|
32
|
-
getMetricTags(input: GetMetricTagsInput, next: Next<ActivityOutboundCallsInterceptor, 'getMetricTags'>): GetMetricTagsInput;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Intercepts inbound Nexus Operation calls on the worker.
|
|
36
|
-
*
|
|
37
|
-
* Wraps `startOperation` and `cancelOperation` in opentelemetry Spans, linking to a parent Span context
|
|
38
|
-
* if one is provided in the Nexus request headers.
|
|
39
|
-
*/
|
|
40
|
-
export declare class OpenTelemetryNexusInboundInterceptor implements NexusInboundCallsInterceptor {
|
|
41
|
-
protected readonly ctx: nexus.OperationContext;
|
|
42
|
-
protected readonly tracer: otel.Tracer;
|
|
43
|
-
constructor(ctx: nexus.OperationContext, options?: InterceptorOptions);
|
|
44
|
-
startOperation(input: NexusStartOperationInput, next: Next<NexusInboundCallsInterceptor, 'startOperation'>): Promise<NexusStartOperationOutput>;
|
|
45
|
-
cancelOperation(input: NexusCancelOperationInput, next: Next<NexusInboundCallsInterceptor, 'cancelOperation'>): Promise<void>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Intercepts outbound calls from a Nexus Operation handler.
|
|
49
|
-
*
|
|
50
|
-
* Attaches OpenTelemetry context tracing attributes to emitted log messages and metrics.
|
|
51
|
-
*/
|
|
52
|
-
export declare class OpenTelemetryNexusOutboundInterceptor implements NexusOutboundCallsInterceptor {
|
|
53
|
-
protected readonly ctx: nexus.OperationContext;
|
|
54
|
-
constructor(ctx: nexus.OperationContext);
|
|
55
|
-
getLogAttributes(input: GetLogAttributesInput, next: Next<NexusOutboundCallsInterceptor, 'getLogAttributes'>): Record<string, unknown>;
|
|
56
|
-
getMetricTags(input: GetMetricTagsInput, next: Next<NexusOutboundCallsInterceptor, 'getMetricTags'>): GetMetricTagsInput;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Takes an opentelemetry SpanExporter and turns it into an injected Workflow span exporter sink
|
|
60
|
-
*
|
|
61
|
-
* @deprecated Do not directly pass a `SpanExporter`. Pass a `SpanProcessor` instead to ensure proper handling of async attributes.
|
|
62
|
-
*/
|
|
63
|
-
export declare function makeWorkflowExporter(spanExporter: SpanExporter, resource: Resource): InjectedSink<OpenTelemetryWorkflowExporter>;
|
|
64
|
-
/**
|
|
65
|
-
* Takes an opentelemetry SpanProcessor and turns it into an injected Workflow span exporter sink.
|
|
66
|
-
*
|
|
67
|
-
* For backward compatibility, passing a `SpanExporter` directly is still supported.
|
|
68
|
-
*/
|
|
69
|
-
export declare function makeWorkflowExporter(spanProcessor: SpanProcessor, resource: Resource): InjectedSink<OpenTelemetryWorkflowExporter>;
|
package/lib/worker/index.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.OpenTelemetryNexusOutboundInterceptor = exports.OpenTelemetryNexusInboundInterceptor = exports.OpenTelemetryActivityOutboundInterceptor = exports.OpenTelemetryActivityInboundInterceptor = void 0;
|
|
27
|
-
exports.makeWorkflowExporter = makeWorkflowExporter;
|
|
28
|
-
const otel = __importStar(require("@opentelemetry/api"));
|
|
29
|
-
const api_1 = require("@opentelemetry/api");
|
|
30
|
-
const common_1 = require("@temporalio/common");
|
|
31
|
-
const instrumentation_1 = require("../instrumentation");
|
|
32
|
-
const definitions_1 = require("../workflow/definitions");
|
|
33
|
-
/**
|
|
34
|
-
* Intercepts calls to start an Activity.
|
|
35
|
-
*
|
|
36
|
-
* Wraps the operation in an opentelemetry Span and links it to a parent Span context if one is
|
|
37
|
-
* provided in the Activity input headers.
|
|
38
|
-
*/
|
|
39
|
-
class OpenTelemetryActivityInboundInterceptor {
|
|
40
|
-
ctx;
|
|
41
|
-
tracer;
|
|
42
|
-
constructor(ctx, options) {
|
|
43
|
-
this.ctx = ctx;
|
|
44
|
-
this.tracer = options?.tracer ?? otel.trace.getTracer('@temporalio/interceptor-activity');
|
|
45
|
-
}
|
|
46
|
-
async execute(input, next) {
|
|
47
|
-
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
48
|
-
const spanName = `${definitions_1.SpanName.ACTIVITY_EXECUTE}${definitions_1.SPAN_DELIMITER}${this.ctx.info.activityType}`;
|
|
49
|
-
return await (0, instrumentation_1.instrument)({
|
|
50
|
-
tracer: this.tracer,
|
|
51
|
-
spanName,
|
|
52
|
-
fn: (span) => {
|
|
53
|
-
span.setAttribute(instrumentation_1.ACTIVITY_ID_ATTR_KEY, this.ctx.info.activityId);
|
|
54
|
-
if (this.ctx.info.inWorkflow) {
|
|
55
|
-
span.setAttribute(instrumentation_1.WORKFLOW_ID_ATTR_KEY, this.ctx.info.workflowExecution.workflowId);
|
|
56
|
-
span.setAttribute(instrumentation_1.RUN_ID_ATTR_KEY, this.ctx.info.workflowExecution.runId);
|
|
57
|
-
}
|
|
58
|
-
return next(input);
|
|
59
|
-
},
|
|
60
|
-
context,
|
|
61
|
-
acceptableErrors: (err) => err instanceof common_1.CompleteAsyncError,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.OpenTelemetryActivityInboundInterceptor = OpenTelemetryActivityInboundInterceptor;
|
|
66
|
-
/**
|
|
67
|
-
* Intercepts calls to emit logs and metrics from an Activity.
|
|
68
|
-
*
|
|
69
|
-
* Attach OpenTelemetry context tracing attributes to emitted log messages and metrics, if appropriate.
|
|
70
|
-
*/
|
|
71
|
-
class OpenTelemetryActivityOutboundInterceptor {
|
|
72
|
-
ctx;
|
|
73
|
-
constructor(ctx) {
|
|
74
|
-
this.ctx = ctx;
|
|
75
|
-
}
|
|
76
|
-
getLogAttributes(input, next) {
|
|
77
|
-
const span = otel.trace.getSpan(otel.context.active());
|
|
78
|
-
const spanContext = span?.spanContext();
|
|
79
|
-
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
80
|
-
return next({
|
|
81
|
-
trace_id: spanContext.traceId,
|
|
82
|
-
span_id: spanContext.spanId,
|
|
83
|
-
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
84
|
-
...input,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
return next(input);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
getMetricTags(input, next) {
|
|
92
|
-
const span = otel.trace.getSpan(otel.context.active());
|
|
93
|
-
const spanContext = span?.spanContext();
|
|
94
|
-
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
95
|
-
return next({
|
|
96
|
-
trace_id: spanContext.traceId,
|
|
97
|
-
span_id: spanContext.spanId,
|
|
98
|
-
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
99
|
-
...input,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return next(input);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.OpenTelemetryActivityOutboundInterceptor = OpenTelemetryActivityOutboundInterceptor;
|
|
108
|
-
/**
|
|
109
|
-
* Intercepts inbound Nexus Operation calls on the worker.
|
|
110
|
-
*
|
|
111
|
-
* Wraps `startOperation` and `cancelOperation` in opentelemetry Spans, linking to a parent Span context
|
|
112
|
-
* if one is provided in the Nexus request headers.
|
|
113
|
-
*/
|
|
114
|
-
class OpenTelemetryNexusInboundInterceptor {
|
|
115
|
-
ctx;
|
|
116
|
-
tracer;
|
|
117
|
-
constructor(ctx, options) {
|
|
118
|
-
this.ctx = ctx;
|
|
119
|
-
this.tracer = options?.tracer ?? otel.trace.getTracer('@temporalio/interceptor-nexus');
|
|
120
|
-
}
|
|
121
|
-
async startOperation(input, next) {
|
|
122
|
-
const context = (0, instrumentation_1.extractContextFromNexusHeaders)(input.ctx.headers);
|
|
123
|
-
const spanName = `${definitions_1.SpanName.NEXUS_START_OPERATION_EXECUTE}${definitions_1.SPAN_DELIMITER}${input.ctx.service}/${input.ctx.operation}`;
|
|
124
|
-
return await (0, instrumentation_1.instrument)({
|
|
125
|
-
tracer: this.tracer,
|
|
126
|
-
spanName,
|
|
127
|
-
fn: (span) => {
|
|
128
|
-
span.setAttribute(instrumentation_1.NEXUS_SERVICE_ATTR_KEY, input.ctx.service);
|
|
129
|
-
span.setAttribute(instrumentation_1.NEXUS_OPERATION_ATTR_KEY, input.ctx.operation);
|
|
130
|
-
return next(input);
|
|
131
|
-
},
|
|
132
|
-
context,
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
async cancelOperation(input, next) {
|
|
136
|
-
const context = (0, instrumentation_1.extractContextFromNexusHeaders)(input.ctx.headers);
|
|
137
|
-
const spanName = `${definitions_1.SpanName.NEXUS_CANCEL_OPERATION_EXECUTE}${definitions_1.SPAN_DELIMITER}${input.ctx.service}/${input.ctx.operation}`;
|
|
138
|
-
return await (0, instrumentation_1.instrument)({
|
|
139
|
-
tracer: this.tracer,
|
|
140
|
-
spanName,
|
|
141
|
-
fn: (span) => {
|
|
142
|
-
span.setAttribute(instrumentation_1.NEXUS_SERVICE_ATTR_KEY, input.ctx.service);
|
|
143
|
-
span.setAttribute(instrumentation_1.NEXUS_OPERATION_ATTR_KEY, input.ctx.operation);
|
|
144
|
-
return next(input);
|
|
145
|
-
},
|
|
146
|
-
context,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.OpenTelemetryNexusInboundInterceptor = OpenTelemetryNexusInboundInterceptor;
|
|
151
|
-
/**
|
|
152
|
-
* Intercepts outbound calls from a Nexus Operation handler.
|
|
153
|
-
*
|
|
154
|
-
* Attaches OpenTelemetry context tracing attributes to emitted log messages and metrics.
|
|
155
|
-
*/
|
|
156
|
-
class OpenTelemetryNexusOutboundInterceptor {
|
|
157
|
-
ctx;
|
|
158
|
-
constructor(ctx) {
|
|
159
|
-
this.ctx = ctx;
|
|
160
|
-
}
|
|
161
|
-
getLogAttributes(input, next) {
|
|
162
|
-
const span = otel.trace.getSpan(otel.context.active());
|
|
163
|
-
const spanContext = span?.spanContext();
|
|
164
|
-
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
165
|
-
return next({
|
|
166
|
-
trace_id: spanContext.traceId,
|
|
167
|
-
span_id: spanContext.spanId,
|
|
168
|
-
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
169
|
-
...input,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
return next(input);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
getMetricTags(input, next) {
|
|
177
|
-
const span = otel.trace.getSpan(otel.context.active());
|
|
178
|
-
const spanContext = span?.spanContext();
|
|
179
|
-
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
180
|
-
return next({
|
|
181
|
-
trace_id: spanContext.traceId,
|
|
182
|
-
span_id: spanContext.spanId,
|
|
183
|
-
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
184
|
-
...input,
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
return next(input);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
exports.OpenTelemetryNexusOutboundInterceptor = OpenTelemetryNexusOutboundInterceptor;
|
|
193
|
-
function makeWorkflowExporter(processorOrExporter, resource) {
|
|
194
|
-
const givenSpanProcessor = isSpanProcessor(processorOrExporter);
|
|
195
|
-
return {
|
|
196
|
-
export: {
|
|
197
|
-
fn: (info, spanData) => {
|
|
198
|
-
const spans = spanData.map((serialized) => {
|
|
199
|
-
Object.assign(serialized.attributes, info);
|
|
200
|
-
// Spans are copied over from the isolate and are converted to ReadableSpan instances
|
|
201
|
-
return extractReadableSpan(serialized, resource);
|
|
202
|
-
});
|
|
203
|
-
if (givenSpanProcessor) {
|
|
204
|
-
spans.forEach((span) => processorOrExporter.onEnd(span));
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
// Ignore the export result for simplicity
|
|
208
|
-
processorOrExporter.export(spans, () => undefined);
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function isSpanProcessor(obj) {
|
|
215
|
-
return 'onEnd' in obj && typeof obj.onEnd === 'function';
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Deserialize a serialized span created by the Workflow isolate
|
|
219
|
-
*/
|
|
220
|
-
function extractReadableSpan(serializable, resource) {
|
|
221
|
-
const { spanContext: { traceState, ...restSpanContext }, ...rest } = serializable;
|
|
222
|
-
const spanContext = {
|
|
223
|
-
// Reconstruct the TraceState from the serialized string.
|
|
224
|
-
traceState: traceState ? (0, api_1.createTraceState)(traceState) : undefined,
|
|
225
|
-
...restSpanContext,
|
|
226
|
-
};
|
|
227
|
-
return {
|
|
228
|
-
spanContext() {
|
|
229
|
-
return spanContext;
|
|
230
|
-
},
|
|
231
|
-
resource,
|
|
232
|
-
...rest,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
//# sourceMappingURL=index.js.map
|
package/lib/worker/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/worker/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+OA,oDAwBC;AAvQD,yDAA2C;AAC3C,4CAAsD;AAKtD,+CAAwD;AAexD,wDAS4B;AAC5B,yDAKiC;AAMjC;;;;;GAKG;AACH,MAAa,uCAAuC;IAI7B;IAHF,MAAM,CAAc;IAEvC,YACqB,GAAoB,EACvC,OAA4B;QADT,QAAG,GAAH,GAAG,CAAiB;QAGvC,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;IAC5F,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAA2B,EAAE,IAAsD;QAC/F,MAAM,OAAO,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,GAAG,sBAAQ,CAAC,gBAAgB,GAAG,4BAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC9F,OAAO,MAAM,IAAA,4BAAU,EAAC;YACtB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ;YACR,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;gBACX,IAAI,CAAC,YAAY,CAAC,sCAAoB,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClE,IAAI,IAAI,CAAC,GAAG,CAA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CAAC,CAAC,UAAU,EAAE,EAAE;oBACxC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;oBAC3C,qFAAqF;oBACrF,OAAO,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;gBACnD,CAAC,CAAC,CAAC;gBAEH,IAAI,kBAAkB,EAAE,CAAC;oBACvB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC3D,CAAC;qBAAM,CAAC;oBACN,0CAA0C;oBAC1C,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,GAAiC;IACxD,OAAO,OAAO,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,YAA8B,EAAE,QAAkB;IAC7E,MAAM,EACJ,WAAW,EAAE,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,EAC/C,GAAG,IAAI,EACR,GAAG,YAAY,CAAC;IACjB,MAAM,WAAW,GAAqB;QACpC,yDAAyD;QACzD,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,IAAA,sBAAgB,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;QACjE,GAAG,eAAe;KACnB,CAAC;IACF,OAAO;QACL,WAAW;YACT,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,QAAQ;QACR,GAAG,IAAI;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type AsyncLocalStorage } from 'async_hooks';
|
|
2
|
-
import * as otel from '@opentelemetry/api';
|
|
3
|
-
export declare class ContextManager implements otel.ContextManager {
|
|
4
|
-
protected storage: AsyncLocalStorage<otel.Context>;
|
|
5
|
-
active(): otel.Context;
|
|
6
|
-
bind<T>(context: otel.Context, target: T): T;
|
|
7
|
-
enable(): this;
|
|
8
|
-
disable(): this;
|
|
9
|
-
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: otel.Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
10
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ContextManager = void 0;
|
|
27
|
-
const otel = __importStar(require("@opentelemetry/api"));
|
|
28
|
-
class ContextManager {
|
|
29
|
-
// The workflow sandbox provides AsyncLocalStorage through globalThis.
|
|
30
|
-
storage = new globalThis.AsyncLocalStorage();
|
|
31
|
-
active() {
|
|
32
|
-
return this.storage.getStore() || otel.ROOT_CONTEXT;
|
|
33
|
-
}
|
|
34
|
-
bind(context, target) {
|
|
35
|
-
if (typeof target !== 'function') {
|
|
36
|
-
throw new TypeError(`Only function binding is supported, got ${typeof target}`);
|
|
37
|
-
}
|
|
38
|
-
// Stolen from https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts
|
|
39
|
-
const contextWrapper = (...args) => {
|
|
40
|
-
return this.with(context, () => target.apply(this, args));
|
|
41
|
-
};
|
|
42
|
-
Object.defineProperty(contextWrapper, 'length', {
|
|
43
|
-
enumerable: false,
|
|
44
|
-
configurable: true,
|
|
45
|
-
writable: false,
|
|
46
|
-
value: target.length,
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* It isn't possible to tell Typescript that contextWrapper is the same as T
|
|
50
|
-
* so we forced to cast as any here.
|
|
51
|
-
*/
|
|
52
|
-
return contextWrapper;
|
|
53
|
-
}
|
|
54
|
-
enable() {
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
disable() {
|
|
58
|
-
this.storage.disable();
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
with(context, fn, thisArg, ...args) {
|
|
62
|
-
const cb = thisArg == null ? fn : fn.bind(thisArg);
|
|
63
|
-
return this.storage.run(context, cb, ...args);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.ContextManager = ContextManager;
|
|
67
|
-
//# sourceMappingURL=context-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../src/workflow/context-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yDAA2C;AAE3C,MAAa,cAAc;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CACF;AAjDD,wCAiDC"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type * as otel from '@opentelemetry/api';
|
|
2
|
-
import type * as tracing from '@opentelemetry/sdk-trace-base';
|
|
3
|
-
import type { InstrumentationLibrary } from '@opentelemetry/core';
|
|
4
|
-
import type { Sink, Sinks } from '@temporalio/workflow';
|
|
5
|
-
/**
|
|
6
|
-
* Serializable version of SpanContext where traceState is converted to a string.
|
|
7
|
-
*/
|
|
8
|
-
export type SerializableSpanContext = Omit<otel.SpanContext, 'traceState'> & {
|
|
9
|
-
traceState?: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Serializable version of the opentelemetry Span for cross isolate copying
|
|
13
|
-
*/
|
|
14
|
-
export interface SerializableSpan {
|
|
15
|
-
readonly name: string;
|
|
16
|
-
readonly kind: otel.SpanKind;
|
|
17
|
-
readonly spanContext: SerializableSpanContext;
|
|
18
|
-
readonly parentSpanId?: string;
|
|
19
|
-
readonly startTime: otel.HrTime;
|
|
20
|
-
readonly endTime: otel.HrTime;
|
|
21
|
-
readonly status: otel.SpanStatus;
|
|
22
|
-
readonly attributes: otel.Attributes;
|
|
23
|
-
readonly links: otel.Link[];
|
|
24
|
-
readonly events: tracing.TimedEvent[];
|
|
25
|
-
readonly duration: otel.HrTime;
|
|
26
|
-
readonly ended: boolean;
|
|
27
|
-
readonly droppedAttributesCount: number;
|
|
28
|
-
readonly droppedLinksCount: number;
|
|
29
|
-
readonly droppedEventsCount: number;
|
|
30
|
-
readonly instrumentationLibrary: InstrumentationLibrary;
|
|
31
|
-
}
|
|
32
|
-
export interface OpenTelemetryWorkflowExporter extends Sink {
|
|
33
|
-
export(span: SerializableSpan[]): void;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Required external dependencies for Workflow interceptor to export spans
|
|
37
|
-
*/
|
|
38
|
-
export interface OpenTelemetrySinks extends Sinks {
|
|
39
|
-
exporter: OpenTelemetryWorkflowExporter;
|
|
40
|
-
}
|
|
41
|
-
export declare enum SpanName {
|
|
42
|
-
/**
|
|
43
|
-
* Workflow is scheduled by a client
|
|
44
|
-
*/
|
|
45
|
-
WORKFLOW_START = "StartWorkflow",
|
|
46
|
-
/**
|
|
47
|
-
* Workflow is signalled
|
|
48
|
-
*/
|
|
49
|
-
WORKFLOW_SIGNAL = "SignalWorkflow",
|
|
50
|
-
/**
|
|
51
|
-
* Workflow is client calls signalWithStart
|
|
52
|
-
*/
|
|
53
|
-
WORKFLOW_SIGNAL_WITH_START = "SignalWithStartWorkflow",
|
|
54
|
-
/**
|
|
55
|
-
* Workflow is queried
|
|
56
|
-
*/
|
|
57
|
-
WORKFLOW_QUERY = "QueryWorkflow",
|
|
58
|
-
/**
|
|
59
|
-
* Workflow update is started by client
|
|
60
|
-
*/
|
|
61
|
-
WORKFLOW_START_UPDATE = "StartWorkflowUpdate",
|
|
62
|
-
/**
|
|
63
|
-
* Workflow is started with an update
|
|
64
|
-
*/
|
|
65
|
-
WORKFLOW_UPDATE_WITH_START = "UpdateWithStartWorkflow",
|
|
66
|
-
/**
|
|
67
|
-
* Workflow handles an incoming signal
|
|
68
|
-
*/
|
|
69
|
-
WORKFLOW_HANDLE_SIGNAL = "HandleSignal",
|
|
70
|
-
/**
|
|
71
|
-
* Workflow handles an incoming query
|
|
72
|
-
*/
|
|
73
|
-
WORKFLOW_HANDLE_QUERY = "HandleQuery",
|
|
74
|
-
/**
|
|
75
|
-
* Workflow handles an incoming update
|
|
76
|
-
*/
|
|
77
|
-
WORKFLOW_HANDLE_UPDATE = "HandleUpdate",
|
|
78
|
-
/**
|
|
79
|
-
* Workflow validates an incoming update
|
|
80
|
-
*/
|
|
81
|
-
WORKFLOW_VALIDATE_UPDATE = "ValidateUpdate",
|
|
82
|
-
/**
|
|
83
|
-
* Workflow is terminated
|
|
84
|
-
*/
|
|
85
|
-
WORKFLOW_TERMINATE = "TerminateWorkflow",
|
|
86
|
-
/**
|
|
87
|
-
* Workflow is cancelled
|
|
88
|
-
*/
|
|
89
|
-
WORKFLOW_CANCEL = "CancelWorkflow",
|
|
90
|
-
/**
|
|
91
|
-
* Workflow is described
|
|
92
|
-
*/
|
|
93
|
-
WORKFLOW_DESCRIBE = "DescribeWorkflow",
|
|
94
|
-
/**
|
|
95
|
-
* Workflow run is executing
|
|
96
|
-
*/
|
|
97
|
-
WORKFLOW_EXECUTE = "RunWorkflow",
|
|
98
|
-
/**
|
|
99
|
-
* Child Workflow is started (by parent Workflow)
|
|
100
|
-
*/
|
|
101
|
-
CHILD_WORKFLOW_START = "StartChildWorkflow",
|
|
102
|
-
/**
|
|
103
|
-
* Activity is scheduled by a Workflow
|
|
104
|
-
*/
|
|
105
|
-
ACTIVITY_START = "StartActivity",
|
|
106
|
-
/**
|
|
107
|
-
* Activity is executing
|
|
108
|
-
*/
|
|
109
|
-
ACTIVITY_EXECUTE = "RunActivity",
|
|
110
|
-
/**
|
|
111
|
-
* Workflow is continuing as new
|
|
112
|
-
*/
|
|
113
|
-
CONTINUE_AS_NEW = "ContinueAsNew",
|
|
114
|
-
/**
|
|
115
|
-
* Nexus operation is started
|
|
116
|
-
*/
|
|
117
|
-
NEXUS_OPERATION_START = "StartNexusOperation",
|
|
118
|
-
/**
|
|
119
|
-
* Nexus operation is executing
|
|
120
|
-
*/
|
|
121
|
-
NEXUS_START_OPERATION_EXECUTE = "RunStartNexusOperation",
|
|
122
|
-
/**
|
|
123
|
-
* Nexus operation cancel is executing
|
|
124
|
-
*/
|
|
125
|
-
NEXUS_CANCEL_OPERATION_EXECUTE = "RunCancelNexusOperation"
|
|
126
|
-
}
|
|
127
|
-
export declare const SPAN_DELIMITER = ":";
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SPAN_DELIMITER = exports.SpanName = void 0;
|
|
4
|
-
var SpanName;
|
|
5
|
-
(function (SpanName) {
|
|
6
|
-
/**
|
|
7
|
-
* Workflow is scheduled by a client
|
|
8
|
-
*/
|
|
9
|
-
SpanName["WORKFLOW_START"] = "StartWorkflow";
|
|
10
|
-
/**
|
|
11
|
-
* Workflow is signalled
|
|
12
|
-
*/
|
|
13
|
-
SpanName["WORKFLOW_SIGNAL"] = "SignalWorkflow";
|
|
14
|
-
/**
|
|
15
|
-
* Workflow is client calls signalWithStart
|
|
16
|
-
*/
|
|
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";
|
|
58
|
-
/**
|
|
59
|
-
* Workflow run is executing
|
|
60
|
-
*/
|
|
61
|
-
SpanName["WORKFLOW_EXECUTE"] = "RunWorkflow";
|
|
62
|
-
/**
|
|
63
|
-
* Child Workflow is started (by parent Workflow)
|
|
64
|
-
*/
|
|
65
|
-
SpanName["CHILD_WORKFLOW_START"] = "StartChildWorkflow";
|
|
66
|
-
/**
|
|
67
|
-
* Activity is scheduled by a Workflow
|
|
68
|
-
*/
|
|
69
|
-
SpanName["ACTIVITY_START"] = "StartActivity";
|
|
70
|
-
/**
|
|
71
|
-
* Activity is executing
|
|
72
|
-
*/
|
|
73
|
-
SpanName["ACTIVITY_EXECUTE"] = "RunActivity";
|
|
74
|
-
/**
|
|
75
|
-
* Workflow is continuing as new
|
|
76
|
-
*/
|
|
77
|
-
SpanName["CONTINUE_AS_NEW"] = "ContinueAsNew";
|
|
78
|
-
/**
|
|
79
|
-
* Nexus operation is started
|
|
80
|
-
*/
|
|
81
|
-
SpanName["NEXUS_OPERATION_START"] = "StartNexusOperation";
|
|
82
|
-
/**
|
|
83
|
-
* Nexus operation is executing
|
|
84
|
-
*/
|
|
85
|
-
SpanName["NEXUS_START_OPERATION_EXECUTE"] = "RunStartNexusOperation";
|
|
86
|
-
/**
|
|
87
|
-
* Nexus operation cancel is executing
|
|
88
|
-
*/
|
|
89
|
-
SpanName["NEXUS_CANCEL_OPERATION_EXECUTE"] = "RunCancelNexusOperation";
|
|
90
|
-
})(SpanName || (exports.SpanName = SpanName = {}));
|
|
91
|
-
exports.SPAN_DELIMITER = ':';
|
|
92
|
-
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/workflow/definitions.ts"],"names":[],"mappings":";;;AA6CA,IAAY,QAkGX;AAlGD,WAAY,QAAQ;IAClB;;OAEG;IACH,4CAAgC,CAAA;IAEhC;;OAEG;IACH,8CAAkC,CAAA;IAElC;;OAEG;IACH,kEAAsD,CAAA;IAEtD;;OAEG;IACH,4CAAgC,CAAA;IAEhC;;OAEG;IACH,yDAA6C,CAAA;IAE7C;;OAEG;IACH,kEAAsD,CAAA;IAEtD;;OAEG;IACH,mDAAuC,CAAA;IAEvC;;OAEG;IACH,iDAAqC,CAAA;IAErC;;OAEG;IACH,mDAAuC,CAAA;IAEvC;;OAEG;IACH,uDAA2C,CAAA;IAE3C;;OAEG;IACH,oDAAwC,CAAA;IAExC;;OAEG;IACH,8CAAkC,CAAA;IAElC;;OAEG;IACH,kDAAsC,CAAA;IAEtC;;OAEG;IACH,4CAAgC,CAAA;IAChC;;OAEG;IACH,uDAA2C,CAAA;IAC3C;;OAEG;IACH,4CAAgC,CAAA;IAChC;;OAEG;IACH,4CAAgC,CAAA;IAChC;;OAEG;IACH,6CAAiC,CAAA;IACjC;;OAEG;IACH,yDAA6C,CAAA;IAC7C;;OAEG;IACH,oEAAwD,CAAA;IACxD;;OAEG;IACH,sEAA0D,CAAA;AAC5D,CAAC,EAlGW,QAAQ,wBAAR,QAAQ,QAkGnB;AAEY,QAAA,cAAc,GAAG,GAAG,CAAC"}
|
package/lib/workflow/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import './runtime';
|
|
2
|
-
import * as otel from '@opentelemetry/api';
|
|
3
|
-
import type { ActivityInput, ContinueAsNewInput, DisposeInput, GetLogAttributesInput, GetMetricTagsInput, LocalActivityInput, Next, QueryInput, SignalInput, SignalWorkflowInput, StartChildWorkflowExecutionInput, UpdateInput, WorkflowExecuteInput, WorkflowInboundCallsInterceptor, WorkflowInternalsInterceptor, WorkflowOutboundCallsInterceptor, StartNexusOperationInput, StartNexusOperationOutput } from '@temporalio/workflow';
|
|
4
|
-
export * from './definitions';
|
|
5
|
-
/**
|
|
6
|
-
* Intercepts calls to run a Workflow
|
|
7
|
-
*
|
|
8
|
-
* Wraps the operation in an opentelemetry Span and links it to a parent Span context if one is
|
|
9
|
-
* provided in the Workflow input headers.
|
|
10
|
-
*
|
|
11
|
-
* `@temporalio/workflow` must be provided by host package in order to function.
|
|
12
|
-
*/
|
|
13
|
-
export declare class OpenTelemetryInboundInterceptor implements WorkflowInboundCallsInterceptor {
|
|
14
|
-
protected readonly tracer: otel.Tracer;
|
|
15
|
-
execute(input: WorkflowExecuteInput, next: Next<WorkflowInboundCallsInterceptor, 'execute'>): Promise<unknown>;
|
|
16
|
-
handleSignal(input: SignalInput, next: Next<WorkflowInboundCallsInterceptor, 'handleSignal'>): Promise<void>;
|
|
17
|
-
handleUpdate(input: UpdateInput, next: Next<WorkflowInboundCallsInterceptor, 'handleUpdate'>): Promise<unknown>;
|
|
18
|
-
validateUpdate(input: UpdateInput, next: Next<WorkflowInboundCallsInterceptor, 'validateUpdate'>): void;
|
|
19
|
-
handleQuery(input: QueryInput, next: Next<WorkflowInboundCallsInterceptor, 'handleQuery'>): Promise<unknown>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Intercepts outbound calls to schedule an Activity
|
|
23
|
-
*
|
|
24
|
-
* Wraps the operation in an opentelemetry Span and passes it to the Activity via headers.
|
|
25
|
-
*
|
|
26
|
-
* `@temporalio/workflow` must be provided by host package in order to function.
|
|
27
|
-
*/
|
|
28
|
-
export declare class OpenTelemetryOutboundInterceptor implements WorkflowOutboundCallsInterceptor {
|
|
29
|
-
protected readonly tracer: otel.Tracer;
|
|
30
|
-
scheduleActivity(input: ActivityInput, next: Next<WorkflowOutboundCallsInterceptor, 'scheduleActivity'>): Promise<unknown>;
|
|
31
|
-
scheduleLocalActivity(input: LocalActivityInput, next: Next<WorkflowOutboundCallsInterceptor, 'scheduleLocalActivity'>): Promise<unknown>;
|
|
32
|
-
startNexusOperation(input: StartNexusOperationInput, next: Next<WorkflowOutboundCallsInterceptor, 'startNexusOperation'>): Promise<StartNexusOperationOutput>;
|
|
33
|
-
startChildWorkflowExecution(input: StartChildWorkflowExecutionInput, next: Next<WorkflowOutboundCallsInterceptor, 'startChildWorkflowExecution'>): Promise<[Promise<string>, Promise<unknown>]>;
|
|
34
|
-
continueAsNew(input: ContinueAsNewInput, next: Next<WorkflowOutboundCallsInterceptor, 'continueAsNew'>): Promise<never>;
|
|
35
|
-
signalWorkflow(input: SignalWorkflowInput, next: Next<WorkflowOutboundCallsInterceptor, 'signalWorkflow'>): Promise<void>;
|
|
36
|
-
getLogAttributes(input: GetLogAttributesInput, next: Next<WorkflowOutboundCallsInterceptor, 'getLogAttributes'>): Record<string, unknown>;
|
|
37
|
-
getMetricTags(input: GetMetricTagsInput, next: Next<WorkflowOutboundCallsInterceptor, 'getMetricTags'>): GetMetricTagsInput;
|
|
38
|
-
}
|
|
39
|
-
export declare class OpenTelemetryInternalsInterceptor implements WorkflowInternalsInterceptor {
|
|
40
|
-
dispose(input: DisposeInput, next: Next<WorkflowInternalsInterceptor, 'dispose'>): Promise<void>;
|
|
41
|
-
}
|