@temporalio/interceptors-opentelemetry 1.12.3 → 1.13.1
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/instrumentation.js +3 -1
- package/lib/instrumentation.js.map +1 -1
- package/package.json +12 -12
- package/src/instrumentation.ts +4 -2
package/lib/instrumentation.js
CHANGED
|
@@ -64,8 +64,10 @@ async function wrapWithSpan(span, fn, acceptableErrors) {
|
|
|
64
64
|
return ret;
|
|
65
65
|
}
|
|
66
66
|
catch (err) {
|
|
67
|
+
const isBenignErr = err instanceof common_1.ApplicationFailure && err.category === common_1.ApplicationFailureCategory.BENIGN;
|
|
67
68
|
if (acceptableErrors === undefined || !acceptableErrors(err)) {
|
|
68
|
-
|
|
69
|
+
const statusCode = isBenignErr ? otel.SpanStatusCode.UNSET : otel.SpanStatusCode.ERROR;
|
|
70
|
+
span.setStatus({ code: statusCode, message: err.message ?? String(err) });
|
|
69
71
|
span.recordException(err);
|
|
70
72
|
}
|
|
71
73
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,8DAOC;AAKD,gDAIC;
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,8DAOC;AAKD,gDAIC;AAqCD,gCAaC;AAnFD;;;GAGG;AACH,yDAA2C;AAC3C,+CAAsH;AAEtH,0DAA0D;AAC7C,QAAA,YAAY,GAAG,cAAc,CAAC;AAC3C,4BAA4B;AACf,QAAA,eAAe,GAAG,QAAQ,CAAC;AAExC,MAAM,gBAAgB,GAAG,gCAAuB,CAAC;AAEjD;;GAEG;AACI,KAAK,UAAU,yBAAyB,CAAC,OAAgB;IAC9D,MAAM,kBAAkB,GAAG,OAAO,CAA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interceptors bundle for tracing with opentelemetry",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"@opentelemetry/sdk-trace-base": "^1.19.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@temporalio/activity": "1.
|
|
24
|
-
"@temporalio/client": "1.
|
|
25
|
-
"@temporalio/common": "1.
|
|
26
|
-
"@temporalio/worker": "1.
|
|
27
|
-
"@temporalio/workflow": "1.
|
|
23
|
+
"@temporalio/activity": "1.13.1",
|
|
24
|
+
"@temporalio/client": "1.13.1",
|
|
25
|
+
"@temporalio/common": "1.13.1",
|
|
26
|
+
"@temporalio/worker": "1.13.1",
|
|
27
|
+
"@temporalio/workflow": "1.13.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@temporalio/activity": "1.
|
|
31
|
-
"@temporalio/client": "1.
|
|
32
|
-
"@temporalio/common": "1.
|
|
33
|
-
"@temporalio/worker": "1.
|
|
34
|
-
"@temporalio/workflow": "1.
|
|
30
|
+
"@temporalio/activity": "1.13.1",
|
|
31
|
+
"@temporalio/client": "1.13.1",
|
|
32
|
+
"@temporalio/common": "1.13.1",
|
|
33
|
+
"@temporalio/worker": "1.13.1",
|
|
34
|
+
"@temporalio/workflow": "1.13.1"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/temporalio/sdk-typescript/issues"
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"src",
|
|
53
53
|
"lib"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "7904e19bc72dcdf9eb0275ecaa585a2ff2fec072"
|
|
56
56
|
}
|
package/src/instrumentation.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
5
|
import * as otel from '@opentelemetry/api';
|
|
6
|
-
import { Headers, defaultPayloadConverter } from '@temporalio/common';
|
|
6
|
+
import { ApplicationFailure, ApplicationFailureCategory, Headers, defaultPayloadConverter } from '@temporalio/common';
|
|
7
7
|
|
|
8
8
|
/** Default trace header for opentelemetry interceptors */
|
|
9
9
|
export const TRACE_HEADER = '_tracer-data';
|
|
@@ -43,8 +43,10 @@ async function wrapWithSpan<T>(
|
|
|
43
43
|
span.setStatus({ code: otel.SpanStatusCode.OK });
|
|
44
44
|
return ret;
|
|
45
45
|
} catch (err: any) {
|
|
46
|
+
const isBenignErr = err instanceof ApplicationFailure && err.category === ApplicationFailureCategory.BENIGN;
|
|
46
47
|
if (acceptableErrors === undefined || !acceptableErrors(err)) {
|
|
47
|
-
|
|
48
|
+
const statusCode = isBenignErr ? otel.SpanStatusCode.UNSET : otel.SpanStatusCode.ERROR;
|
|
49
|
+
span.setStatus({ code: statusCode, message: (err as Error).message ?? String(err) });
|
|
48
50
|
span.recordException(err);
|
|
49
51
|
} else {
|
|
50
52
|
span.setStatus({ code: otel.SpanStatusCode.OK });
|