rian 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/exporter.otel.http.js +1 -1
- package/exporter.otel.http.mjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +6 -2
- package/index.mjs +6 -2
- package/package.json +1 -1
package/exporter.otel.http.js
CHANGED
@@ -19,7 +19,7 @@ const convert_value_to_anyvalue = (value) => {
|
|
19
19
|
any_value.arrayValue = {
|
20
20
|
values: value.map((i) => convert_value_to_anyvalue(i)),
|
21
21
|
};
|
22
|
-
else
|
22
|
+
else if (value)
|
23
23
|
any_value.kvlistValue = { values: convert_object_to_kv(value) };
|
24
24
|
return any_value;
|
25
25
|
};
|
package/exporter.otel.http.mjs
CHANGED
@@ -17,7 +17,7 @@ const convert_value_to_anyvalue = (value) => {
|
|
17
17
|
any_value.arrayValue = {
|
18
18
|
values: value.map((i) => convert_value_to_anyvalue(i)),
|
19
19
|
};
|
20
|
-
else
|
20
|
+
else if (value)
|
21
21
|
any_value.kvlistValue = { values: convert_object_to_kv(value) };
|
22
22
|
return any_value;
|
23
23
|
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -72,8 +72,11 @@ const create = (name, options) => {
|
|
72
72
|
const spans = new Set();
|
73
73
|
const promises = [];
|
74
74
|
const sampler = options.sampler || defaultSampler;
|
75
|
+
const sampler_callable = typeof sampler !== 'boolean';
|
75
76
|
const span = (name, parent) => {
|
76
|
-
const should_sample =
|
77
|
+
const should_sample = sampler_callable
|
78
|
+
? sampler(name, parent, options.context)
|
79
|
+
: sampler;
|
77
80
|
const id = parent
|
78
81
|
? parent.child(should_sample)
|
79
82
|
: tctx__namespace.make(should_sample);
|
@@ -116,7 +119,8 @@ const create = (name, options) => {
|
|
116
119
|
const endRoot = root.end.bind(root);
|
117
120
|
root.end = async () => {
|
118
121
|
endRoot();
|
119
|
-
|
122
|
+
if (promises.length)
|
123
|
+
await Promise.all(promises);
|
120
124
|
return options.exporter(spans, {
|
121
125
|
...(options.context || {}),
|
122
126
|
...sdk_object,
|
package/index.mjs
CHANGED
@@ -50,8 +50,11 @@ const create = (name, options) => {
|
|
50
50
|
const spans = new Set();
|
51
51
|
const promises = [];
|
52
52
|
const sampler = options.sampler || defaultSampler;
|
53
|
+
const sampler_callable = typeof sampler !== 'boolean';
|
53
54
|
const span = (name, parent) => {
|
54
|
-
const should_sample =
|
55
|
+
const should_sample = sampler_callable
|
56
|
+
? sampler(name, parent, options.context)
|
57
|
+
: sampler;
|
55
58
|
const id = parent
|
56
59
|
? parent.child(should_sample)
|
57
60
|
: tctx.make(should_sample);
|
@@ -94,7 +97,8 @@ const create = (name, options) => {
|
|
94
97
|
const endRoot = root.end.bind(root);
|
95
98
|
root.end = async () => {
|
96
99
|
endRoot();
|
97
|
-
|
100
|
+
if (promises.length)
|
101
|
+
await Promise.all(promises);
|
98
102
|
return options.exporter(spans, {
|
99
103
|
...(options.context || {}),
|
100
104
|
...sdk_object,
|