@temporalio/interceptors-opentelemetry 1.4.3 → 1.5.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/lib/client/index.d.ts +3 -3
- package/lib/client/index.js +3 -3
- package/lib/client/index.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/workflow/index.js +3 -1
- package/lib/workflow/index.js.map +1 -1
- package/package.json +7 -6
- package/src/client/index.ts +3 -3
- package/src/index.ts +5 -1
- package/src/workflow/index.ts +3 -1
package/lib/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as otel from '@opentelemetry/api';
|
|
2
|
-
import { Next,
|
|
2
|
+
import { Next, WorkflowClientInterceptor, WorkflowStartInput } from '@temporalio/client';
|
|
3
3
|
export interface InterceptorOptions {
|
|
4
4
|
readonly tracer?: otel.Tracer;
|
|
5
5
|
}
|
|
@@ -8,8 +8,8 @@ export interface InterceptorOptions {
|
|
|
8
8
|
*
|
|
9
9
|
* Wraps the operation in an opentelemetry Span and passes it to the Workflow via headers.
|
|
10
10
|
*/
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class OpenTelemetryWorkflowClientInterceptor implements WorkflowClientInterceptor {
|
|
12
12
|
protected readonly tracer: otel.Tracer;
|
|
13
13
|
constructor(options?: InterceptorOptions);
|
|
14
|
-
start(input: WorkflowStartInput, next: Next<
|
|
14
|
+
start(input: WorkflowStartInput, next: Next<WorkflowClientInterceptor, 'start'>): Promise<string>;
|
|
15
15
|
}
|
package/lib/client/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.OpenTelemetryWorkflowClientInterceptor = void 0;
|
|
27
27
|
const otel = __importStar(require("@opentelemetry/api"));
|
|
28
28
|
const otel_1 = require("@temporalio/common/lib/otel");
|
|
29
29
|
const instrumentation_1 = require("../instrumentation");
|
|
@@ -33,7 +33,7 @@ const workflow_1 = require("../workflow");
|
|
|
33
33
|
*
|
|
34
34
|
* Wraps the operation in an opentelemetry Span and passes it to the Workflow via headers.
|
|
35
35
|
*/
|
|
36
|
-
class
|
|
36
|
+
class OpenTelemetryWorkflowClientInterceptor {
|
|
37
37
|
constructor(options) {
|
|
38
38
|
this.tracer = options?.tracer ?? otel.trace.getTracer('@temporalio/interceptor-client');
|
|
39
39
|
}
|
|
@@ -50,5 +50,5 @@ class OpenTelemetryWorkflowClientCallsInterceptor {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
exports.
|
|
53
|
+
exports.OpenTelemetryWorkflowClientInterceptor = OpenTelemetryWorkflowClientInterceptor;
|
|
54
54
|
//# 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;AAE3C,sDAAkF;AAClF,wDAAgD;AAChD,0CAAuD;AAMvD;;;;GAIG;AACH,MAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAE3C,sDAAkF;AAClF,wDAAgD;AAChD,0CAAuD;AAMvD;;;;GAIG;AACH,MAAa,sCAAsC;IAGjD,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,MAAM,IAAA,yBAAkB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACxD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,sBAAe,EAAE,KAAK,CAAC,CAAC;gBAC1C,OAAO,KAAK,CAAC;YACf,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAnBD,wFAmBC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from './workflow';
|
|
11
11
|
export * from './worker';
|
|
12
|
-
export {
|
|
12
|
+
export { OpenTelemetryWorkflowClientInterceptor,
|
|
13
|
+
/** deprecated: Use OpenTelemetryWorkflowClientInterceptor instead */
|
|
14
|
+
OpenTelemetryWorkflowClientInterceptor as OpenTelemetryWorkflowClientCallsInterceptor, } from './client';
|
package/lib/index.js
CHANGED
|
@@ -23,9 +23,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
23
23
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.OpenTelemetryWorkflowClientCallsInterceptor = void 0;
|
|
26
|
+
exports.OpenTelemetryWorkflowClientCallsInterceptor = exports.OpenTelemetryWorkflowClientInterceptor = void 0;
|
|
27
27
|
__exportStar(require("./workflow"), exports);
|
|
28
28
|
__exportStar(require("./worker"), exports);
|
|
29
29
|
var client_1 = require("./client");
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "OpenTelemetryWorkflowClientInterceptor", { enumerable: true, get: function () { return client_1.OpenTelemetryWorkflowClientInterceptor; } });
|
|
31
|
+
/** deprecated: Use OpenTelemetryWorkflowClientInterceptor instead */
|
|
32
|
+
Object.defineProperty(exports, "OpenTelemetryWorkflowClientCallsInterceptor", { enumerable: true, get: function () { return client_1.OpenTelemetryWorkflowClientInterceptor; } });
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,2CAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,2CAAyB;AACzB,mCAIkB;AAHhB,gIAAA,sCAAsC,OAAA;AACtC,qEAAqE;AACrE,qIAAA,sCAAsC,OAA+C"}
|
package/lib/workflow/index.js
CHANGED
|
@@ -27,6 +27,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.OpenTelemetryInternalsInterceptor = exports.OpenTelemetryOutboundInterceptor = exports.OpenTelemetryInboundInterceptor = void 0;
|
|
30
|
+
/* eslint-disable import/order */
|
|
31
|
+
// eslint-disable-next-line import/no-unassigned-import
|
|
30
32
|
require("./runtime"); // Patch the Workflow isolate runtime for opentelemetry
|
|
31
33
|
const tracing = __importStar(require("@opentelemetry/sdk-trace-base"));
|
|
32
34
|
const otel_1 = require("@temporalio/common/lib/otel");
|
|
@@ -128,7 +130,7 @@ class OpenTelemetryInternalsInterceptor {
|
|
|
128
130
|
if (contextManager !== undefined) {
|
|
129
131
|
contextManager.disable();
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
next(input);
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
exports.OpenTelemetryInternalsInterceptor = OpenTelemetryInternalsInterceptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAmB,CAAC,uDAAuD;AAE3E,uEAAyD;AACzD,sDAA4F;AAC5F,mDAY8B;AAC9B,wDAAgD;AAChD,uDAAmD;AACnD,+CAAyD;AACzD,mDAA+C;AAE/C,gDAA8B;AAE9B,IAAI,MAAM,GAA4B,SAAS,CAAC;AAChD,IAAI,cAAc,GAA+B,SAAS,CAAC;AAE3D,SAAS,SAAS;IAChB,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;KACvC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACnD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,IAAI,4BAAY,EAAE,CAAC,CAAC,CAAC;QAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;QACtC,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;KACjE;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAa,+BAA+B;IAA5C;QACqB,WAAM,GAAG,SAAS,EAAE,CAAC;IAe1C,CAAC;IAbQ,KAAK,CAAC,OAAO,CAClB,KAA2B,EAC3B,IAAsD;QAEtD,MAAM,OAAO,GAAG,MAAM,IAAA,gCAAyB,EAAC,KAAK,CAAC,OAAO,C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AgB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,YAAY,wBAAa;SACxD,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,4EAsDC;AAED,MAAa,iCAAiC;IAC5C,KAAK,CAAC,OAAO,CAAC,KAAmB,EAAE,IAAmD;QACpF,IAAI,cAAc,KAAK,SAAS,EAAE;YAChC,cAAc,CAAC,OAAO,EAAE,CAAC;SAC1B;QACD,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;CACF;AAPD,8EAOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/interceptors-opentelemetry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
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",
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
"@opentelemetry/core": "^1.3.1",
|
|
19
19
|
"@opentelemetry/resources": "^1.3.1",
|
|
20
20
|
"@opentelemetry/sdk-trace-base": "^1.3.1",
|
|
21
|
-
"@temporalio/
|
|
22
|
-
"@temporalio/
|
|
23
|
-
"@temporalio/
|
|
24
|
-
"@temporalio/
|
|
21
|
+
"@temporalio/activity": "~1.5.0",
|
|
22
|
+
"@temporalio/client": "~1.5.0",
|
|
23
|
+
"@temporalio/common": "~1.5.0",
|
|
24
|
+
"@temporalio/worker": "~1.5.0",
|
|
25
|
+
"@temporalio/workflow": "~1.5.0"
|
|
25
26
|
},
|
|
26
27
|
"bugs": {
|
|
27
28
|
"url": "https://github.com/temporalio/sdk-typescript/issues"
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"src",
|
|
35
36
|
"lib"
|
|
36
37
|
],
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "b46426d8b9b342c052d53520b50dbb991b8d5e03"
|
|
38
39
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as otel from '@opentelemetry/api';
|
|
2
|
-
import { Next,
|
|
2
|
+
import { Next, WorkflowClientInterceptor, WorkflowStartInput } from '@temporalio/client';
|
|
3
3
|
import { headersWithContext, RUN_ID_ATTR_KEY } from '@temporalio/common/lib/otel';
|
|
4
4
|
import { instrument } from '../instrumentation';
|
|
5
5
|
import { SpanName, SPAN_DELIMITER } from '../workflow';
|
|
@@ -13,14 +13,14 @@ export interface InterceptorOptions {
|
|
|
13
13
|
*
|
|
14
14
|
* Wraps the operation in an opentelemetry Span and passes it to the Workflow via headers.
|
|
15
15
|
*/
|
|
16
|
-
export class
|
|
16
|
+
export class OpenTelemetryWorkflowClientInterceptor implements WorkflowClientInterceptor {
|
|
17
17
|
protected readonly tracer: otel.Tracer;
|
|
18
18
|
|
|
19
19
|
constructor(options?: InterceptorOptions) {
|
|
20
20
|
this.tracer = options?.tracer ?? otel.trace.getTracer('@temporalio/interceptor-client');
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async start(input: WorkflowStartInput, next: Next<
|
|
23
|
+
async start(input: WorkflowStartInput, next: Next<WorkflowClientInterceptor, 'start'>): Promise<string> {
|
|
24
24
|
return await instrument({
|
|
25
25
|
tracer: this.tracer,
|
|
26
26
|
spanName: `${SpanName.WORKFLOW_START}${SPAN_DELIMITER}${input.workflowType}`,
|
package/src/index.ts
CHANGED
|
@@ -10,4 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
export * from './workflow';
|
|
12
12
|
export * from './worker';
|
|
13
|
-
export {
|
|
13
|
+
export {
|
|
14
|
+
OpenTelemetryWorkflowClientInterceptor,
|
|
15
|
+
/** deprecated: Use OpenTelemetryWorkflowClientInterceptor instead */
|
|
16
|
+
OpenTelemetryWorkflowClientInterceptor as OpenTelemetryWorkflowClientCallsInterceptor,
|
|
17
|
+
} from './client';
|
package/src/workflow/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable import/order */
|
|
2
|
+
// eslint-disable-next-line import/no-unassigned-import
|
|
1
3
|
import './runtime'; // Patch the Workflow isolate runtime for opentelemetry
|
|
2
4
|
import * as otel from '@opentelemetry/api';
|
|
3
5
|
import * as tracing from '@opentelemetry/sdk-trace-base';
|
|
@@ -128,6 +130,6 @@ export class OpenTelemetryInternalsInterceptor implements WorkflowInternalsInter
|
|
|
128
130
|
if (contextManager !== undefined) {
|
|
129
131
|
contextManager.disable();
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
next(input);
|
|
132
134
|
}
|
|
133
135
|
}
|