@sebspark/otel 0.2.3 → 0.2.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/dist/index.js +9 -3
- package/dist/index.mjs +9 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -614,6 +614,9 @@ var getResource = async () => {
|
|
|
614
614
|
const { resourceAttributes } = detectTelemetryContext();
|
|
615
615
|
const customRes = (0, import_resources.resourceFromAttributes)(resourceAttributes);
|
|
616
616
|
const resource = baseRes.merge(customRes);
|
|
617
|
+
if (resource.waitForAsyncAttributes) {
|
|
618
|
+
await resource.waitForAsyncAttributes();
|
|
619
|
+
}
|
|
617
620
|
return resource;
|
|
618
621
|
};
|
|
619
622
|
|
|
@@ -779,11 +782,11 @@ function extractArgs(spanOptionsSpanOrFunc, spanOrFunc, func) {
|
|
|
779
782
|
let options = {};
|
|
780
783
|
let parent;
|
|
781
784
|
let fn;
|
|
782
|
-
if (
|
|
785
|
+
if (isFunction(spanOptionsSpanOrFunc)) {
|
|
783
786
|
fn = spanOptionsSpanOrFunc;
|
|
784
|
-
} else if (
|
|
787
|
+
} else if (isFunction(spanOrFunc)) {
|
|
785
788
|
const spanOrSpanOptions = spanOptionsSpanOrFunc;
|
|
786
|
-
if (
|
|
789
|
+
if (isSpanOptions(spanOrSpanOptions)) {
|
|
787
790
|
options = spanOrSpanOptions;
|
|
788
791
|
} else {
|
|
789
792
|
parent = spanOrSpanOptions;
|
|
@@ -796,6 +799,9 @@ function extractArgs(spanOptionsSpanOrFunc, spanOrFunc, func) {
|
|
|
796
799
|
}
|
|
797
800
|
return { options, parent, fn };
|
|
798
801
|
}
|
|
802
|
+
var isFunction = (value) => typeof value === "function";
|
|
803
|
+
var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.spanContext) && isFunction(value.end);
|
|
804
|
+
var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
|
|
799
805
|
|
|
800
806
|
// src/index.ts
|
|
801
807
|
initialize();
|
package/dist/index.mjs
CHANGED
|
@@ -591,6 +591,9 @@ var getResource = async () => {
|
|
|
591
591
|
const { resourceAttributes } = detectTelemetryContext();
|
|
592
592
|
const customRes = resourceFromAttributes(resourceAttributes);
|
|
593
593
|
const resource = baseRes.merge(customRes);
|
|
594
|
+
if (resource.waitForAsyncAttributes) {
|
|
595
|
+
await resource.waitForAsyncAttributes();
|
|
596
|
+
}
|
|
594
597
|
return resource;
|
|
595
598
|
};
|
|
596
599
|
|
|
@@ -760,11 +763,11 @@ function extractArgs(spanOptionsSpanOrFunc, spanOrFunc, func) {
|
|
|
760
763
|
let options = {};
|
|
761
764
|
let parent;
|
|
762
765
|
let fn;
|
|
763
|
-
if (
|
|
766
|
+
if (isFunction(spanOptionsSpanOrFunc)) {
|
|
764
767
|
fn = spanOptionsSpanOrFunc;
|
|
765
|
-
} else if (
|
|
768
|
+
} else if (isFunction(spanOrFunc)) {
|
|
766
769
|
const spanOrSpanOptions = spanOptionsSpanOrFunc;
|
|
767
|
-
if (
|
|
770
|
+
if (isSpanOptions(spanOrSpanOptions)) {
|
|
768
771
|
options = spanOrSpanOptions;
|
|
769
772
|
} else {
|
|
770
773
|
parent = spanOrSpanOptions;
|
|
@@ -777,6 +780,9 @@ function extractArgs(spanOptionsSpanOrFunc, spanOrFunc, func) {
|
|
|
777
780
|
}
|
|
778
781
|
return { options, parent, fn };
|
|
779
782
|
}
|
|
783
|
+
var isFunction = (value) => typeof value === "function";
|
|
784
|
+
var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.spanContext) && isFunction(value.end);
|
|
785
|
+
var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
|
|
780
786
|
|
|
781
787
|
// src/index.ts
|
|
782
788
|
initialize();
|