@temporalio/interceptors-opentelemetry 1.17.3 → 1.17.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/lib/client/index.d.ts +24 -0
- package/lib/client/index.js +183 -0
- package/lib/client/index.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +34 -0
- package/lib/index.js.map +1 -0
- package/lib/instrumentation.d.ts +58 -0
- package/lib/instrumentation.js +156 -0
- package/lib/instrumentation.js.map +1 -0
- package/lib/plugin.d.ts +31 -0
- package/lib/plugin.js +66 -0
- package/lib/plugin.js.map +1 -0
- package/lib/worker/index.d.ts +69 -0
- package/lib/worker/index.js +235 -0
- package/lib/worker/index.js.map +1 -0
- package/lib/workflow/context-manager.d.ts +10 -0
- package/lib/workflow/context-manager.js +67 -0
- package/lib/workflow/context-manager.js.map +1 -0
- package/lib/workflow/definitions.d.ts +127 -0
- package/lib/workflow/definitions.js +92 -0
- package/lib/workflow/definitions.js.map +1 -0
- package/lib/workflow/index.d.ts +41 -0
- package/lib/workflow/index.js +275 -0
- package/lib/workflow/index.js.map +1 -0
- package/lib/workflow/runtime.d.ts +1 -0
- package/lib/workflow/runtime.js +20 -0
- package/lib/workflow/runtime.js.map +1 -0
- package/lib/workflow/span-exporter.d.ts +9 -0
- package/lib/workflow/span-exporter.js +48 -0
- package/lib/workflow/span-exporter.js.map +1 -0
- package/lib/workflow/workflow-imports-impl.d.ts +9 -0
- package/lib/workflow/workflow-imports-impl.js +20 -0
- package/lib/workflow/workflow-imports-impl.js.map +1 -0
- package/lib/workflow/workflow-imports.d.ts +19 -0
- package/lib/workflow/workflow-imports.js +26 -0
- package/lib/workflow/workflow-imports.js.map +1 -0
- package/lib/workflow-interceptors.d.ts +3 -0
- package/lib/workflow-interceptors.js +12 -0
- package/lib/workflow-interceptors.js.map +1 -0
- package/package.json +13 -12
|
@@ -0,0 +1,275 @@
|
|
|
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
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.OpenTelemetryInternalsInterceptor = exports.OpenTelemetryOutboundInterceptor = exports.OpenTelemetryInboundInterceptor = void 0;
|
|
30
|
+
// eslint-disable-next-line import/no-unassigned-import
|
|
31
|
+
require("./runtime"); // Patch the Workflow isolate runtime for opentelemetry
|
|
32
|
+
const otel = __importStar(require("@opentelemetry/api"));
|
|
33
|
+
const tracing = __importStar(require("@opentelemetry/sdk-trace-base"));
|
|
34
|
+
const instrumentation_1 = require("../instrumentation");
|
|
35
|
+
const context_manager_1 = require("./context-manager");
|
|
36
|
+
const definitions_1 = require("./definitions");
|
|
37
|
+
const span_exporter_1 = require("./span-exporter");
|
|
38
|
+
const workflow_imports_1 = require("./workflow-imports");
|
|
39
|
+
__exportStar(require("./definitions"), exports);
|
|
40
|
+
let tracer = undefined;
|
|
41
|
+
let contextManager = undefined;
|
|
42
|
+
function getTracer() {
|
|
43
|
+
if (contextManager === undefined) {
|
|
44
|
+
contextManager = new context_manager_1.ContextManager();
|
|
45
|
+
}
|
|
46
|
+
if (tracer === undefined) {
|
|
47
|
+
const provider = new tracing.BasicTracerProvider();
|
|
48
|
+
provider.addSpanProcessor(new tracing.SimpleSpanProcessor(new span_exporter_1.SpanExporter()));
|
|
49
|
+
provider.register({ contextManager });
|
|
50
|
+
tracer = provider.getTracer('@temporalio/interceptor-workflow');
|
|
51
|
+
}
|
|
52
|
+
return tracer;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Intercepts calls to run a Workflow
|
|
56
|
+
*
|
|
57
|
+
* Wraps the operation in an opentelemetry Span and links it to a parent Span context if one is
|
|
58
|
+
* provided in the Workflow input headers.
|
|
59
|
+
*
|
|
60
|
+
* `@temporalio/workflow` must be provided by host package in order to function.
|
|
61
|
+
*/
|
|
62
|
+
class OpenTelemetryInboundInterceptor {
|
|
63
|
+
tracer = getTracer();
|
|
64
|
+
async execute(input, next) {
|
|
65
|
+
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
66
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
67
|
+
await Promise.resolve();
|
|
68
|
+
return await (0, instrumentation_1.instrument)({
|
|
69
|
+
tracer: this.tracer,
|
|
70
|
+
spanName: `${definitions_1.SpanName.WORKFLOW_EXECUTE}${definitions_1.SPAN_DELIMITER}${(0, workflow_imports_1.workflowInfo)().workflowType}`,
|
|
71
|
+
fn: () => next(input),
|
|
72
|
+
context,
|
|
73
|
+
acceptableErrors: (err) => err instanceof workflow_imports_1.ContinueAsNew,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async handleSignal(input, next) {
|
|
77
|
+
// Tracing of inbound signals was added in v1.11.5.
|
|
78
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceptorsTracesInboundSignals))
|
|
79
|
+
return next(input);
|
|
80
|
+
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
81
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
82
|
+
await Promise.resolve();
|
|
83
|
+
return await (0, instrumentation_1.instrument)({
|
|
84
|
+
tracer: this.tracer,
|
|
85
|
+
spanName: `${definitions_1.SpanName.WORKFLOW_HANDLE_SIGNAL}${definitions_1.SPAN_DELIMITER}${input.signalName}`,
|
|
86
|
+
fn: () => next(input),
|
|
87
|
+
context,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async handleUpdate(input, next) {
|
|
91
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceptorsInstrumentsAllMethods))
|
|
92
|
+
return next(input);
|
|
93
|
+
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
94
|
+
return await (0, instrumentation_1.instrument)({
|
|
95
|
+
tracer: this.tracer,
|
|
96
|
+
spanName: `${definitions_1.SpanName.WORKFLOW_HANDLE_UPDATE}${definitions_1.SPAN_DELIMITER}${input.name}`,
|
|
97
|
+
fn: (span) => {
|
|
98
|
+
span.setAttribute(instrumentation_1.UPDATE_ID_ATTR_KEY, input.updateId);
|
|
99
|
+
return next(input);
|
|
100
|
+
},
|
|
101
|
+
context,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
validateUpdate(input, next) {
|
|
105
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceptorsInstrumentsAllMethods))
|
|
106
|
+
return next(input);
|
|
107
|
+
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
108
|
+
(0, instrumentation_1.instrumentSync)({
|
|
109
|
+
tracer: this.tracer,
|
|
110
|
+
spanName: `${definitions_1.SpanName.WORKFLOW_VALIDATE_UPDATE}${definitions_1.SPAN_DELIMITER}${input.name}`,
|
|
111
|
+
fn: (span) => {
|
|
112
|
+
span.setAttribute(instrumentation_1.UPDATE_ID_ATTR_KEY, input.updateId);
|
|
113
|
+
return next(input);
|
|
114
|
+
},
|
|
115
|
+
context,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async handleQuery(input, next) {
|
|
119
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceptorsInstrumentsAllMethods))
|
|
120
|
+
return next(input);
|
|
121
|
+
const context = (0, instrumentation_1.extractContextFromHeaders)(input.headers);
|
|
122
|
+
return await (0, instrumentation_1.instrument)({
|
|
123
|
+
tracer: this.tracer,
|
|
124
|
+
spanName: `${definitions_1.SpanName.WORKFLOW_HANDLE_QUERY}${definitions_1.SPAN_DELIMITER}${input.queryName}`,
|
|
125
|
+
fn: () => next(input),
|
|
126
|
+
context,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.OpenTelemetryInboundInterceptor = OpenTelemetryInboundInterceptor;
|
|
131
|
+
/**
|
|
132
|
+
* Intercepts outbound calls to schedule an Activity
|
|
133
|
+
*
|
|
134
|
+
* Wraps the operation in an opentelemetry Span and passes it to the Activity via headers.
|
|
135
|
+
*
|
|
136
|
+
* `@temporalio/workflow` must be provided by host package in order to function.
|
|
137
|
+
*/
|
|
138
|
+
class OpenTelemetryOutboundInterceptor {
|
|
139
|
+
tracer = getTracer();
|
|
140
|
+
async scheduleActivity(input, next) {
|
|
141
|
+
return await (0, instrumentation_1.instrument)({
|
|
142
|
+
tracer: this.tracer,
|
|
143
|
+
spanName: `${definitions_1.SpanName.ACTIVITY_START}${definitions_1.SPAN_DELIMITER}${input.activityType}`,
|
|
144
|
+
fn: async () => {
|
|
145
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
146
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
147
|
+
await Promise.resolve();
|
|
148
|
+
return next({
|
|
149
|
+
...input,
|
|
150
|
+
headers,
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async scheduleLocalActivity(input, next) {
|
|
156
|
+
// Tracing of local activities was added in v1.11.6.
|
|
157
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceptorsTracesLocalActivities))
|
|
158
|
+
return next(input);
|
|
159
|
+
return await (0, instrumentation_1.instrument)({
|
|
160
|
+
tracer: this.tracer,
|
|
161
|
+
spanName: `${definitions_1.SpanName.ACTIVITY_START}${definitions_1.SPAN_DELIMITER}${input.activityType}`,
|
|
162
|
+
fn: async () => {
|
|
163
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
164
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
165
|
+
await Promise.resolve();
|
|
166
|
+
return next({
|
|
167
|
+
...input,
|
|
168
|
+
headers,
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async startNexusOperation(input, next) {
|
|
174
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceptorsInstrumentsAllMethods))
|
|
175
|
+
return next(input);
|
|
176
|
+
return await (0, instrumentation_1.instrument)({
|
|
177
|
+
tracer: this.tracer,
|
|
178
|
+
spanName: `${definitions_1.SpanName.NEXUS_OPERATION_START}${definitions_1.SPAN_DELIMITER}${input.service}/${input.operation}`,
|
|
179
|
+
fn: async (span) => {
|
|
180
|
+
span.setAttribute(instrumentation_1.NEXUS_SERVICE_ATTR_KEY, input.service);
|
|
181
|
+
span.setAttribute(instrumentation_1.NEXUS_OPERATION_ATTR_KEY, input.operation);
|
|
182
|
+
span.setAttribute(instrumentation_1.NEXUS_ENDPOINT_ATTR_KEY, input.endpoint);
|
|
183
|
+
const headers = (0, instrumentation_1.nexusHeadersWithContext)(input.headers);
|
|
184
|
+
return await next({ ...input, headers });
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
async startChildWorkflowExecution(input, next) {
|
|
189
|
+
return await (0, instrumentation_1.instrument)({
|
|
190
|
+
tracer: this.tracer,
|
|
191
|
+
spanName: `${definitions_1.SpanName.CHILD_WORKFLOW_START}${definitions_1.SPAN_DELIMITER}${input.workflowType}`,
|
|
192
|
+
fn: async () => {
|
|
193
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
194
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
195
|
+
await Promise.resolve();
|
|
196
|
+
return next({
|
|
197
|
+
...input,
|
|
198
|
+
headers,
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async continueAsNew(input, next) {
|
|
204
|
+
return await (0, instrumentation_1.instrument)({
|
|
205
|
+
tracer: this.tracer,
|
|
206
|
+
spanName: `${definitions_1.SpanName.CONTINUE_AS_NEW}${definitions_1.SPAN_DELIMITER}${input.options.workflowType}`,
|
|
207
|
+
fn: async () => {
|
|
208
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
209
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
210
|
+
await Promise.resolve();
|
|
211
|
+
return next({
|
|
212
|
+
...input,
|
|
213
|
+
headers,
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
acceptableErrors: (err) => err instanceof workflow_imports_1.ContinueAsNew,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
async signalWorkflow(input, next) {
|
|
220
|
+
return await (0, instrumentation_1.instrument)({
|
|
221
|
+
tracer: this.tracer,
|
|
222
|
+
spanName: `${definitions_1.SpanName.WORKFLOW_SIGNAL}${definitions_1.SPAN_DELIMITER}${input.signalName}`,
|
|
223
|
+
fn: async () => {
|
|
224
|
+
const headers = (0, instrumentation_1.headersWithContext)(input.headers);
|
|
225
|
+
if (!(0, workflow_imports_1.getActivator)().hasFlag(workflow_imports_1.SdkFlags.OpenTelemetryInterceporsAvoidsExtraYields))
|
|
226
|
+
await Promise.resolve();
|
|
227
|
+
return next({
|
|
228
|
+
...input,
|
|
229
|
+
headers,
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
getLogAttributes(input, next) {
|
|
235
|
+
const span = otel.trace.getSpan(otel.context.active());
|
|
236
|
+
const spanContext = span?.spanContext();
|
|
237
|
+
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
238
|
+
return next({
|
|
239
|
+
trace_id: spanContext.traceId,
|
|
240
|
+
span_id: spanContext.spanId,
|
|
241
|
+
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
242
|
+
...input,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
return next(input);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
getMetricTags(input, next) {
|
|
250
|
+
const span = otel.trace.getSpan(otel.context.active());
|
|
251
|
+
const spanContext = span?.spanContext();
|
|
252
|
+
if (spanContext && otel.isSpanContextValid(spanContext)) {
|
|
253
|
+
return next({
|
|
254
|
+
trace_id: spanContext.traceId,
|
|
255
|
+
span_id: spanContext.spanId,
|
|
256
|
+
trace_flags: `0${spanContext.traceFlags.toString(16)}`,
|
|
257
|
+
...input,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
return next(input);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.OpenTelemetryOutboundInterceptor = OpenTelemetryOutboundInterceptor;
|
|
266
|
+
class OpenTelemetryInternalsInterceptor {
|
|
267
|
+
async dispose(input, next) {
|
|
268
|
+
if (contextManager !== undefined) {
|
|
269
|
+
contextManager.disable();
|
|
270
|
+
}
|
|
271
|
+
next(input);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.OpenTelemetryInternalsInterceptor = OpenTelemetryInternalsInterceptor;
|
|
275
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,qBAAmB,CAAC,uDAAuD;AAC3E,yDAA2C;AAC3C,uEAAyD;AAqBzD,wDAU4B;AAC5B,uDAAmD;AACnD,+CAAyD;AACzD,mDAA+C;AAC/C,yDAAyF;AAEzF,gDAA8B;AAE9B,IAAI,MAAM,GAA4B,SAAS,CAAC;AAChD,IAAI,cAAc,GAA+B,SAAS,CAAC;AAE3D,SAAS,SAAS;IAChB,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACnD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,mBAAmB,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;YACjC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;CACF;AAPD,8EAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Sets global variables required for importing opentelemetry in isolate
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
const workflow_imports_1 = require("./workflow-imports");
|
|
8
|
+
if ((0, workflow_imports_1.inWorkflowContext)()) {
|
|
9
|
+
// Required by opentelemetry (pretend to be a browser)
|
|
10
|
+
Object.assign(globalThis, {
|
|
11
|
+
performance: {
|
|
12
|
+
timeOrigin: Date.now(),
|
|
13
|
+
now() {
|
|
14
|
+
return Date.now() - this.timeOrigin;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
window: globalThis,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/workflow/runtime.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,yDAAuD;AAEvD,IAAI,IAAA,oCAAiB,GAAE,EAAE,CAAC;IACxB,sDAAsD;IACtD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;QACxB,WAAW,EAAE;YACX,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;YACtB,GAAG;gBACD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;YACtC,CAAC;SACF;QACD,MAAM,EAAE,UAAU;KACnB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as tracing from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import type { ExportResult } from '@opentelemetry/core';
|
|
3
|
+
import type { SerializableSpan } from './definitions';
|
|
4
|
+
export declare class SpanExporter implements tracing.SpanExporter {
|
|
5
|
+
private exporter?;
|
|
6
|
+
export(spans: tracing.ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
7
|
+
shutdown(): Promise<void>;
|
|
8
|
+
makeSerializable(span: tracing.ReadableSpan): SerializableSpan;
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpanExporter = void 0;
|
|
4
|
+
const core_1 = require("@opentelemetry/core");
|
|
5
|
+
const workflow_imports_1 = require("./workflow-imports");
|
|
6
|
+
class SpanExporter {
|
|
7
|
+
exporter;
|
|
8
|
+
export(spans, resultCallback) {
|
|
9
|
+
if (!this.exporter) {
|
|
10
|
+
this.exporter = (0, workflow_imports_1.proxySinks)().exporter;
|
|
11
|
+
}
|
|
12
|
+
this.exporter.export(spans.map((span) => this.makeSerializable(span)));
|
|
13
|
+
resultCallback({ code: core_1.ExportResultCode.SUCCESS });
|
|
14
|
+
}
|
|
15
|
+
async shutdown() {
|
|
16
|
+
// Nothing to shut down
|
|
17
|
+
}
|
|
18
|
+
makeSerializable(span) {
|
|
19
|
+
const { traceState, ...restSpanContext } = span.spanContext();
|
|
20
|
+
// Serialize traceState to a string because TraceState objects lose their
|
|
21
|
+
// prototype methods when crossing the V8 isolate boundary.
|
|
22
|
+
// See: https://github.com/temporalio/sdk-typescript/issues/1738
|
|
23
|
+
const serializableSpanContext = {
|
|
24
|
+
traceState: traceState?.serialize(),
|
|
25
|
+
...restSpanContext,
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
name: span.name,
|
|
29
|
+
kind: span.kind,
|
|
30
|
+
spanContext: serializableSpanContext,
|
|
31
|
+
parentSpanId: span.parentSpanId,
|
|
32
|
+
startTime: span.startTime,
|
|
33
|
+
endTime: span.endTime,
|
|
34
|
+
status: span.status,
|
|
35
|
+
attributes: span.attributes,
|
|
36
|
+
links: span.links,
|
|
37
|
+
events: span.events,
|
|
38
|
+
duration: span.duration,
|
|
39
|
+
ended: span.ended,
|
|
40
|
+
droppedAttributesCount: span.droppedAttributesCount,
|
|
41
|
+
droppedEventsCount: span.droppedEventsCount,
|
|
42
|
+
droppedLinksCount: span.droppedLinksCount,
|
|
43
|
+
instrumentationLibrary: span.instrumentationLibrary,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.SpanExporter = SpanExporter;
|
|
48
|
+
//# sourceMappingURL=span-exporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-exporter.js","sourceRoot":"","sources":["../../src/workflow/span-exporter.ts"],"names":[],"mappings":";;;AAEA,8CAAuD;AAEvD,yDAAgD;AAEhD,MAAa,YAAY;IACf,QAAQ,CAAkC;IAE3C,MAAM,CAAC,KAA6B,EAAE,cAA8C;QACzF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAA,6BAAU,GAAsB,CAAC,QAAQ,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvE,cAAc,CAAC,EAAE,IAAI,EAAE,uBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,uBAAuB;IACzB,CAAC;IAEM,gBAAgB,CAAC,IAA0B;QAChD,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC9D,yEAAyE;QACzE,2DAA2D;QAC3D,gEAAgE;QAChE,MAAM,uBAAuB,GAA4B;YACvD,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE;YACnC,GAAG,eAAe;SACnB,CAAC;QACF,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,uBAAuB;YACpC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;SACpD,CAAC;IACJ,CAAC;CACF;AA3CD,oCA2CC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real workflow imports for otel interceptors.
|
|
3
|
+
* This replaces the stub via webpack alias when bundled.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
export { inWorkflowContext, proxySinks, workflowInfo, AsyncLocalStorage, ContinueAsNew } from '@temporalio/workflow';
|
|
8
|
+
export { SdkFlags } from '@temporalio/workflow/lib/flags';
|
|
9
|
+
export { getActivator } from '@temporalio/workflow/lib/global-attributes';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getActivator = exports.SdkFlags = exports.ContinueAsNew = exports.AsyncLocalStorage = exports.workflowInfo = exports.proxySinks = exports.inWorkflowContext = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Real workflow imports for otel interceptors.
|
|
6
|
+
* This replaces the stub via webpack alias when bundled.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
var workflow_1 = require("@temporalio/workflow");
|
|
11
|
+
Object.defineProperty(exports, "inWorkflowContext", { enumerable: true, get: function () { return workflow_1.inWorkflowContext; } });
|
|
12
|
+
Object.defineProperty(exports, "proxySinks", { enumerable: true, get: function () { return workflow_1.proxySinks; } });
|
|
13
|
+
Object.defineProperty(exports, "workflowInfo", { enumerable: true, get: function () { return workflow_1.workflowInfo; } });
|
|
14
|
+
Object.defineProperty(exports, "AsyncLocalStorage", { enumerable: true, get: function () { return workflow_1.AsyncLocalStorage; } });
|
|
15
|
+
Object.defineProperty(exports, "ContinueAsNew", { enumerable: true, get: function () { return workflow_1.ContinueAsNew; } });
|
|
16
|
+
var flags_1 = require("@temporalio/workflow/lib/flags");
|
|
17
|
+
Object.defineProperty(exports, "SdkFlags", { enumerable: true, get: function () { return flags_1.SdkFlags; } });
|
|
18
|
+
var global_attributes_1 = require("@temporalio/workflow/lib/global-attributes");
|
|
19
|
+
Object.defineProperty(exports, "getActivator", { enumerable: true, get: function () { return global_attributes_1.getActivator; } });
|
|
20
|
+
//# sourceMappingURL=workflow-imports-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-imports-impl.js","sourceRoot":"","sources":["../../src/workflow/workflow-imports-impl.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,iDAAqH;AAA5G,6GAAA,iBAAiB,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,yGAAA,aAAa,OAAA;AACtF,wDAA0D;AAAjD,iGAAA,QAAQ,OAAA;AACjB,gFAA0E;AAAjE,iHAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow imports stub module.
|
|
3
|
+
*
|
|
4
|
+
* This module provides stubs for workflow functionality needed by interceptors.
|
|
5
|
+
* When bundled by the workflow bundler, this is replaced with the real
|
|
6
|
+
* implementation via NormalModuleReplacementPlugin.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { inWorkflowContext as inWorkflowContextT, workflowInfo as workflowInfoT, proxySinks as proxySinksT, AsyncLocalStorage as AsyncLocalStorageT, ContinueAsNew as ContinueAsNewT } from '@temporalio/workflow';
|
|
11
|
+
import type { getActivator as getActivatorT } from '@temporalio/workflow/lib/global-attributes';
|
|
12
|
+
import type { SdkFlags as SdkFlagsT } from '@temporalio/workflow/lib/flags';
|
|
13
|
+
export declare const inWorkflowContext: typeof inWorkflowContextT;
|
|
14
|
+
export declare const workflowInfo: typeof workflowInfoT;
|
|
15
|
+
export declare const ContinueAsNew: typeof ContinueAsNewT;
|
|
16
|
+
export declare const AsyncLocalStorage: typeof AsyncLocalStorageT;
|
|
17
|
+
export declare const getActivator: typeof getActivatorT;
|
|
18
|
+
export declare const proxySinks: typeof proxySinksT;
|
|
19
|
+
export declare const SdkFlags: typeof SdkFlagsT;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SdkFlags = exports.proxySinks = exports.getActivator = exports.AsyncLocalStorage = exports.ContinueAsNew = exports.workflowInfo = exports.inWorkflowContext = void 0;
|
|
4
|
+
const common_1 = require("@temporalio/common");
|
|
5
|
+
// always returns false since if using this implementation, we are outside of workflow context
|
|
6
|
+
const inWorkflowContext = () => false;
|
|
7
|
+
exports.inWorkflowContext = inWorkflowContext;
|
|
8
|
+
// All of the following stubs will throw if used
|
|
9
|
+
const workflowInfo = () => {
|
|
10
|
+
throw new common_1.IllegalStateError('Workflow.workflowInfo(...) may only be used from a Workflow Execution.');
|
|
11
|
+
};
|
|
12
|
+
exports.workflowInfo = workflowInfo;
|
|
13
|
+
exports.ContinueAsNew = class ContinueAsNew {
|
|
14
|
+
};
|
|
15
|
+
exports.AsyncLocalStorage = class AsyncLocalStorage {
|
|
16
|
+
};
|
|
17
|
+
const getActivator = () => {
|
|
18
|
+
throw new common_1.IllegalStateError('Workflow uninitialized');
|
|
19
|
+
};
|
|
20
|
+
exports.getActivator = getActivator;
|
|
21
|
+
const proxySinks = () => {
|
|
22
|
+
throw new common_1.IllegalStateError('Proxied sinks functions may only be used from a Workflow Execution.');
|
|
23
|
+
};
|
|
24
|
+
exports.proxySinks = proxySinks;
|
|
25
|
+
exports.SdkFlags = {};
|
|
26
|
+
//# sourceMappingURL=workflow-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-imports.js","sourceRoot":"","sources":["../../src/workflow/workflow-imports.ts"],"names":[],"mappings":";;;AAmBA,+CAAuD;AAEvD,8FAA8F;AACvF,MAAM,iBAAiB,GAA8B,GAAG,EAAE,CAAC,KAAK,CAAC;AAA3D,QAAA,iBAAiB,qBAA0C;AAExE,gDAAgD;AACzC,MAAM,YAAY,GAAyB,GAAG,EAAE;IACrD,MAAM,IAAI,0BAAiB,CAAC,wEAAwE,CAAC,CAAC;AACxG,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEW,QAAA,aAAa,GAAG,MAAM,aAAa;CAAuC,CAAC;AAE3E,QAAA,iBAAiB,GAAG,MAAM,iBAAiB;CAA2C,CAAC;AAE7F,MAAM,YAAY,GAAyB,GAAG,EAAE;IACrD,MAAM,IAAI,0BAAiB,CAAC,wBAAwB,CAAC,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,UAAU,GAAuB,GAAG,EAAE;IACjD,MAAM,IAAI,0BAAiB,CAAC,qEAAqE,CAAC,CAAC;AACrG,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEW,QAAA,QAAQ,GAAqB,EAAsB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Not a workflow, just interceptors */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.interceptors = void 0;
|
|
5
|
+
const workflow_1 = require("./workflow");
|
|
6
|
+
const interceptors = () => ({
|
|
7
|
+
inbound: [new workflow_1.OpenTelemetryInboundInterceptor()],
|
|
8
|
+
outbound: [new workflow_1.OpenTelemetryOutboundInterceptor()],
|
|
9
|
+
internals: [new workflow_1.OpenTelemetryInternalsInterceptor()],
|
|
10
|
+
});
|
|
11
|
+
exports.interceptors = interceptors;
|
|
12
|
+
//# sourceMappingURL=workflow-interceptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-interceptors.js","sourceRoot":"","sources":["../src/workflow-interceptors.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;AAGxC,yCAIoB;AAEb,MAAM,YAAY,GAAG,GAAyB,EAAE,CAAC,CAAC;IACvD,OAAO,EAAE,CAAC,IAAI,0CAA+B,EAAE,CAAC;IAChD,QAAQ,EAAE,CAAC,IAAI,2CAAgC,EAAE,CAAC;IAClD,SAAS,EAAE,CAAC,IAAI,4CAAiC,EAAE,CAAC;CACrD,CAAC,CAAC;AAJU,QAAA,YAAY,gBAItB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/interceptors-opentelemetry",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.4",
|
|
4
4
|
"description": "Temporal.io SDK interceptors bundle for tracing with opentelemetry",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@opentelemetry/core": "^1.25.1",
|
|
18
18
|
"@opentelemetry/resources": "^1.25.1",
|
|
19
19
|
"@opentelemetry/sdk-trace-base": "^1.25.1",
|
|
20
|
-
"@temporalio/plugin": "1.17.
|
|
20
|
+
"@temporalio/plugin": "1.17.4"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@opentelemetry/exporter-trace-otlp-grpc": "^0.52.1",
|
|
@@ -26,18 +26,19 @@
|
|
|
26
26
|
"ava": "^5.3.1",
|
|
27
27
|
"nexus-rpc": "^0.0.2",
|
|
28
28
|
"rxjs": "7.8.1",
|
|
29
|
-
"
|
|
30
|
-
"@temporalio/
|
|
31
|
-
"@temporalio/proto": "1.17.
|
|
32
|
-
"@temporalio/
|
|
33
|
-
"@temporalio/
|
|
34
|
-
"@temporalio/
|
|
35
|
-
"@temporalio/worker": "1.17.
|
|
36
|
-
"@temporalio/
|
|
29
|
+
"uuid": "^11.1.0",
|
|
30
|
+
"@temporalio/activity": "1.17.4",
|
|
31
|
+
"@temporalio/proto": "1.17.4",
|
|
32
|
+
"@temporalio/client": "1.17.4",
|
|
33
|
+
"@temporalio/common": "1.17.4",
|
|
34
|
+
"@temporalio/workflow": "1.17.4",
|
|
35
|
+
"@temporalio/worker": "1.17.4",
|
|
36
|
+
"@temporalio/testing": "1.17.4",
|
|
37
|
+
"@temporalio/test-helpers": "1.17.4"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
|
-
"@temporalio/common": "1.17.
|
|
40
|
-
"@temporalio/workflow": "1.17.
|
|
40
|
+
"@temporalio/common": "1.17.4",
|
|
41
|
+
"@temporalio/workflow": "1.17.4"
|
|
41
42
|
},
|
|
42
43
|
"peerDependenciesMeta": {
|
|
43
44
|
"@temporalio/workflow": {
|