@moostjs/otel 0.4.16 → 0.4.18
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/dist/index.cjs +7 -3
- package/dist/index.mjs +8 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -119,14 +119,18 @@ function getMoostMetrics() {
|
|
|
119
119
|
|
|
120
120
|
function withSpan(span, cb, postProcess) {
|
|
121
121
|
const _span = typeof span.name === 'string' && !span.spanContext
|
|
122
|
-
?
|
|
123
|
-
: api.trace
|
|
122
|
+
? api.trace
|
|
124
123
|
.getTracer('default')
|
|
125
|
-
.startSpan(span.name, span.options)
|
|
124
|
+
.startSpan(span.name, span.options)
|
|
125
|
+
: span;
|
|
126
126
|
let result = undefined;
|
|
127
127
|
const finalizeSpan = (e, r) => {
|
|
128
128
|
if (e) {
|
|
129
129
|
_span.recordException(e);
|
|
130
|
+
_span.setStatus({
|
|
131
|
+
code: api.SpanStatusCode.ERROR,
|
|
132
|
+
message: e.message || 'Unknown Error',
|
|
133
|
+
});
|
|
130
134
|
}
|
|
131
135
|
if (postProcess) {
|
|
132
136
|
postProcess(_span, e, r);
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { trace, context, metrics, SpanKind } from '@opentelemetry/api';
|
|
1
|
+
import { trace, context, metrics, SpanStatusCode, SpanKind } from '@opentelemetry/api';
|
|
2
2
|
import { useAsyncEventContext as useAsyncEventContext$1, ContextInjector, useControllerContext, getConstructor as getConstructor$2, replaceContextInjector } from 'moost';
|
|
3
3
|
import { randomUUID } from 'crypto';
|
|
4
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
@@ -117,14 +117,18 @@ function getMoostMetrics() {
|
|
|
117
117
|
|
|
118
118
|
function withSpan(span, cb, postProcess) {
|
|
119
119
|
const _span = typeof span.name === 'string' && !span.spanContext
|
|
120
|
-
?
|
|
121
|
-
: trace
|
|
120
|
+
? trace
|
|
122
121
|
.getTracer('default')
|
|
123
|
-
.startSpan(span.name, span.options)
|
|
122
|
+
.startSpan(span.name, span.options)
|
|
123
|
+
: span;
|
|
124
124
|
let result = undefined;
|
|
125
125
|
const finalizeSpan = (e, r) => {
|
|
126
126
|
if (e) {
|
|
127
127
|
_span.recordException(e);
|
|
128
|
+
_span.setStatus({
|
|
129
|
+
code: SpanStatusCode.ERROR,
|
|
130
|
+
message: e.message || 'Unknown Error',
|
|
131
|
+
});
|
|
128
132
|
}
|
|
129
133
|
if (postProcess) {
|
|
130
134
|
postProcess(_span, e, r);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/otel",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "@moostjs/otel",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@opentelemetry/api": "^1.9.0",
|
|
41
41
|
"@opentelemetry/sdk-trace-base": "^1.25.1",
|
|
42
|
-
"moost": "0.4.
|
|
42
|
+
"moost": "0.4.18"
|
|
43
43
|
}
|
|
44
44
|
}
|