rian 0.4.0-beta.1 → 0.4.0-beta.3
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/async.js +4 -4
- package/async.mjs +4 -4
- package/index.d.ts +4 -4
- package/index.js +4 -4
- package/index.mjs +4 -4
- package/package.json +3 -3
package/async.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// src/async.ts
|
2
2
|
const async_hooks = require('node:async_hooks');
|
3
3
|
const { measure } = require('rian/utils');
|
4
|
-
const
|
4
|
+
const traceparent = require('tctx/traceparent');
|
5
5
|
|
6
6
|
// src/_internal/index.ts
|
7
7
|
var resource = {};
|
@@ -10,7 +10,7 @@ function configure(name, attributes = {}) {
|
|
10
10
|
...attributes,
|
11
11
|
["service.name"]: name,
|
12
12
|
["telemetry.sdk.name"]: "rian",
|
13
|
-
["telemetry.sdk.version"]: "0.4.0
|
13
|
+
["telemetry.sdk.version"]: "0.4.0-beta.3"
|
14
14
|
};
|
15
15
|
}
|
16
16
|
var span_buffer = /* @__PURE__ */ new Set(), wait_promises = /* @__PURE__ */ new WeakMap();
|
@@ -44,8 +44,8 @@ function span(name, parent_id) {
|
|
44
44
|
let context = resourceStore.getStore();
|
45
45
|
if (!context)
|
46
46
|
throw Error("no current tracer");
|
47
|
-
let api = context[0], scope = api.scope, current_span = context[1], should_sample = api.sampler, parent = typeof parent_id == "string" ?
|
48
|
-
is_sampling ?
|
47
|
+
let api = context[0], scope = api.scope, current_span = context[1], should_sample = api.sampler, parent = typeof parent_id == "string" ? traceparent.parse(parent_id) : parent_id || current_span?.traceparent, id = parent?.child() || traceparent.make(), is_sampling = typeof should_sample == "boolean" ? should_sample : should_sample(id.parent_id, parent, name, scope);
|
48
|
+
is_sampling ? traceparent.sample(id) : traceparent.unsample(id);
|
49
49
|
let span_obj = {
|
50
50
|
id,
|
51
51
|
parent,
|
package/async.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// src/async.ts
|
2
2
|
import * as async_hooks from "node:async_hooks";
|
3
3
|
import { measure } from "rian/utils";
|
4
|
-
import * as
|
4
|
+
import * as traceparent from "tctx/traceparent";
|
5
5
|
|
6
6
|
// src/_internal/index.ts
|
7
7
|
var resource = {};
|
@@ -10,7 +10,7 @@ function configure(name, attributes = {}) {
|
|
10
10
|
...attributes,
|
11
11
|
["service.name"]: name,
|
12
12
|
["telemetry.sdk.name"]: "rian",
|
13
|
-
["telemetry.sdk.version"]: "0.4.0
|
13
|
+
["telemetry.sdk.version"]: "0.4.0-beta.3"
|
14
14
|
};
|
15
15
|
}
|
16
16
|
var span_buffer = /* @__PURE__ */ new Set(), wait_promises = /* @__PURE__ */ new WeakMap();
|
@@ -44,8 +44,8 @@ function span(name, parent_id) {
|
|
44
44
|
let context = resourceStore.getStore();
|
45
45
|
if (!context)
|
46
46
|
throw Error("no current tracer");
|
47
|
-
let api = context[0], scope = api.scope, current_span = context[1], should_sample = api.sampler, parent = typeof parent_id == "string" ?
|
48
|
-
is_sampling ?
|
47
|
+
let api = context[0], scope = api.scope, current_span = context[1], should_sample = api.sampler, parent = typeof parent_id == "string" ? traceparent.parse(parent_id) : parent_id || current_span?.traceparent, id = parent?.child() || traceparent.make(), is_sampling = typeof should_sample == "boolean" ? should_sample : should_sample(id.parent_id, parent, name, scope);
|
48
|
+
is_sampling ? traceparent.sample(id) : traceparent.unsample(id);
|
49
49
|
let span_obj = {
|
50
50
|
id,
|
51
51
|
parent,
|
package/index.d.ts
CHANGED
@@ -27,7 +27,7 @@ export type Options = {
|
|
27
27
|
/**
|
28
28
|
* @borrows {@link Sampler}
|
29
29
|
*/
|
30
|
-
sampler?:
|
30
|
+
sampler?: Sampler | boolean;
|
31
31
|
|
32
32
|
clock?: ClockLike;
|
33
33
|
};
|
@@ -47,13 +47,13 @@ export type Context = {
|
|
47
47
|
* Return true if the span should be sampled, and reported to the {@link Exporter}.
|
48
48
|
* Return false if the span should not be sampled, and not reported to the {@link Exporter}.
|
49
49
|
*/
|
50
|
-
export
|
50
|
+
export type Sampler = (
|
51
51
|
/**
|
52
52
|
* The id of the new span looking for a sampling decision.
|
53
53
|
*/
|
54
54
|
id: string,
|
55
55
|
/**
|
56
|
-
* The
|
56
|
+
* The parent id of the new span looking for a sampling decision.
|
57
57
|
*/
|
58
58
|
parent: Traceparent | undefined,
|
59
59
|
/**
|
@@ -64,7 +64,7 @@ export function Sampler(
|
|
64
64
|
* The tracer this span belongs to.
|
65
65
|
*/
|
66
66
|
tracer: { readonly name: string },
|
67
|
-
)
|
67
|
+
) => boolean;
|
68
68
|
|
69
69
|
// --- spans
|
70
70
|
|
package/index.js
CHANGED
@@ -8,7 +8,7 @@ function configure(name, attributes = {}) {
|
|
8
8
|
...attributes,
|
9
9
|
["service.name"]: name,
|
10
10
|
["telemetry.sdk.name"]: "rian",
|
11
|
-
["telemetry.sdk.version"]: "0.4.0
|
11
|
+
["telemetry.sdk.version"]: "0.4.0-beta.3"
|
12
12
|
};
|
13
13
|
}
|
14
14
|
var span_buffer = /* @__PURE__ */ new Set(), wait_promises = /* @__PURE__ */ new WeakMap();
|
@@ -31,13 +31,13 @@ async function report(exporter) {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
// src/index.ts
|
34
|
-
const
|
34
|
+
const traceparent = require('tctx/traceparent');
|
35
35
|
function tracer(name, options) {
|
36
36
|
let should_sample = options?.sampler ?? !0, clock = options?.clock ?? Date, scope = { name }, ps = /* @__PURE__ */ new Set();
|
37
37
|
wait_promises.set(scope, ps);
|
38
38
|
let span = (name2, parent_id) => {
|
39
|
-
let parent = typeof parent_id == "string" ?
|
40
|
-
is_sampling ?
|
39
|
+
let parent = typeof parent_id == "string" ? traceparent.parse(parent_id) : parent_id, id = parent?.child() || traceparent.make(), is_sampling = typeof should_sample == "boolean" ? should_sample : should_sample(id.parent_id, parent, name2, scope);
|
40
|
+
is_sampling ? traceparent.sample(id) : traceparent.unsample(id);
|
41
41
|
let span_obj = {
|
42
42
|
id,
|
43
43
|
parent,
|
package/index.mjs
CHANGED
@@ -8,7 +8,7 @@ function configure(name, attributes = {}) {
|
|
8
8
|
...attributes,
|
9
9
|
["service.name"]: name,
|
10
10
|
["telemetry.sdk.name"]: "rian",
|
11
|
-
["telemetry.sdk.version"]: "0.4.0
|
11
|
+
["telemetry.sdk.version"]: "0.4.0-beta.3"
|
12
12
|
};
|
13
13
|
}
|
14
14
|
var span_buffer = /* @__PURE__ */ new Set(), wait_promises = /* @__PURE__ */ new WeakMap();
|
@@ -31,13 +31,13 @@ async function report(exporter) {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
// src/index.ts
|
34
|
-
import * as
|
34
|
+
import * as traceparent from "tctx/traceparent";
|
35
35
|
function tracer(name, options) {
|
36
36
|
let should_sample = options?.sampler ?? !0, clock = options?.clock ?? Date, scope = { name }, ps = /* @__PURE__ */ new Set();
|
37
37
|
wait_promises.set(scope, ps);
|
38
38
|
let span = (name2, parent_id) => {
|
39
|
-
let parent = typeof parent_id == "string" ?
|
40
|
-
is_sampling ?
|
39
|
+
let parent = typeof parent_id == "string" ? traceparent.parse(parent_id) : parent_id, id = parent?.child() || traceparent.make(), is_sampling = typeof should_sample == "boolean" ? should_sample : should_sample(id.parent_id, parent, name2, scope);
|
40
|
+
is_sampling ? traceparent.sample(id) : traceparent.unsample(id);
|
41
41
|
let span_obj = {
|
42
42
|
id,
|
43
43
|
parent,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rian",
|
3
|
-
"version": "0.4.0-beta.
|
3
|
+
"version": "0.4.0-beta.3",
|
4
4
|
"description": "Effective tracing for the edge and origins",
|
5
5
|
"keywords": [
|
6
6
|
"opentelemetry",
|
@@ -72,8 +72,8 @@
|
|
72
72
|
},
|
73
73
|
"prettier": "@marais/prettier",
|
74
74
|
"dependencies": {
|
75
|
-
"flattie": "^1.1.
|
76
|
-
"tctx": "
|
75
|
+
"flattie": "^1.1.1",
|
76
|
+
"tctx": "^0.2.3"
|
77
77
|
},
|
78
78
|
"devDependencies": {
|
79
79
|
"@marais/prettier": "0.0.4",
|