rian 0.0.2-alpha.1 → 0.0.2-alpha.5
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/index.d.ts +1 -1
- package/index.js +7 -7
- package/index.mjs +8 -8
- package/package.json +2 -2
- package/tracecontext.js +12 -5
- package/tracecontext.mjs +1 -5
package/index.d.ts
CHANGED
@@ -10,7 +10,7 @@ declare type Span = {
|
|
10
10
|
};
|
11
11
|
declare type Collector = (spans: ReadonlySet<Span>) => any;
|
12
12
|
declare type Attributes = {
|
13
|
-
[property: string]:
|
13
|
+
[property: string]: any;
|
14
14
|
};
|
15
15
|
declare type Options = {
|
16
16
|
collector: Collector;
|
package/index.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
const tracecontext_1 = require("rian/tracecontext");
|
3
|
+
const tracecontext = require('rian/tracecontext');
|
4
|
+
|
6
5
|
const measure = (cb, scope, promises) => {
|
7
6
|
const set_error = (error) => {
|
8
7
|
scope.set_attributes({
|
@@ -27,9 +26,9 @@ const create = (name, options) => {
|
|
27
26
|
const spans = new Set();
|
28
27
|
const promises = [];
|
29
28
|
const scope = (name, parent) => {
|
30
|
-
const me = parent ? parent.child() :
|
29
|
+
const me = parent ? parent.child() : tracecontext.make_traceparent();
|
31
30
|
const attributes = {};
|
32
|
-
const start =
|
31
|
+
const start = Date.now();
|
33
32
|
let ended = false;
|
34
33
|
const $ = {
|
35
34
|
get traceparent() {
|
@@ -52,7 +51,7 @@ const create = (name, options) => {
|
|
52
51
|
id: me,
|
53
52
|
parent,
|
54
53
|
start,
|
55
|
-
end:
|
54
|
+
end: Date.now(),
|
56
55
|
name,
|
57
56
|
attributes,
|
58
57
|
});
|
@@ -62,7 +61,7 @@ const create = (name, options) => {
|
|
62
61
|
return Object.setPrototypeOf((cb) => measure(cb, $, promises), $);
|
63
62
|
};
|
64
63
|
const me = scope(name, typeof options.traceparent === 'string'
|
65
|
-
?
|
64
|
+
? tracecontext.parse_traceparent(options.traceparent)
|
66
65
|
: options.traceparent);
|
67
66
|
const meEnd = me.end.bind(me);
|
68
67
|
me.end = async () => {
|
@@ -72,4 +71,5 @@ const create = (name, options) => {
|
|
72
71
|
};
|
73
72
|
return me;
|
74
73
|
};
|
74
|
+
|
75
75
|
exports.create = create;
|
package/index.mjs
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const tracecontext_1 = require("rian/tracecontext");
|
1
|
+
import { parse_traceparent, make_traceparent } from 'rian/tracecontext';
|
2
|
+
|
4
3
|
const measure = (cb, scope, promises) => {
|
5
4
|
const set_error = (error) => {
|
6
5
|
scope.set_attributes({
|
@@ -25,9 +24,9 @@ const create = (name, options) => {
|
|
25
24
|
const spans = new Set();
|
26
25
|
const promises = [];
|
27
26
|
const scope = (name, parent) => {
|
28
|
-
const me = parent ? parent.child() :
|
27
|
+
const me = parent ? parent.child() : make_traceparent();
|
29
28
|
const attributes = {};
|
30
|
-
const start =
|
29
|
+
const start = Date.now();
|
31
30
|
let ended = false;
|
32
31
|
const $ = {
|
33
32
|
get traceparent() {
|
@@ -50,7 +49,7 @@ const create = (name, options) => {
|
|
50
49
|
id: me,
|
51
50
|
parent,
|
52
51
|
start,
|
53
|
-
end:
|
52
|
+
end: Date.now(),
|
54
53
|
name,
|
55
54
|
attributes,
|
56
55
|
});
|
@@ -60,7 +59,7 @@ const create = (name, options) => {
|
|
60
59
|
return Object.setPrototypeOf((cb) => measure(cb, $, promises), $);
|
61
60
|
};
|
62
61
|
const me = scope(name, typeof options.traceparent === 'string'
|
63
|
-
?
|
62
|
+
? parse_traceparent(options.traceparent)
|
64
63
|
: options.traceparent);
|
65
64
|
const meEnd = me.end.bind(me);
|
66
65
|
me.end = async () => {
|
@@ -70,4 +69,5 @@ const create = (name, options) => {
|
|
70
69
|
};
|
71
70
|
return me;
|
72
71
|
};
|
73
|
-
|
72
|
+
|
73
|
+
export { create };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rian",
|
3
|
-
"version": "0.0.2-alpha.
|
3
|
+
"version": "0.0.2-alpha.5",
|
4
4
|
"description": "A tracer for the edge",
|
5
5
|
"keywords": [
|
6
6
|
"TODO"
|
@@ -34,6 +34,6 @@
|
|
34
34
|
"*.d.ts"
|
35
35
|
],
|
36
36
|
"dependencies": {
|
37
|
-
"tctx": "^0.0.
|
37
|
+
"tctx": "^0.0.7"
|
38
38
|
}
|
39
39
|
}
|
package/tracecontext.js
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Object.defineProperty(exports,
|
3
|
+
const tctx = require('tctx');
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
Object.defineProperty(exports, 'make_traceparent', {
|
8
|
+
enumerable: true,
|
9
|
+
get: function () { return tctx.make; }
|
10
|
+
});
|
11
|
+
Object.defineProperty(exports, 'parse_traceparent', {
|
12
|
+
enumerable: true,
|
13
|
+
get: function () { return tctx.parse; }
|
14
|
+
});
|
package/tracecontext.mjs
CHANGED
@@ -1,5 +1 @@
|
|
1
|
-
|
2
|
-
exports.parse_traceparent = exports.make_traceparent = void 0;
|
3
|
-
var tctx_1 = require("tctx");
|
4
|
-
Object.defineProperty(exports, "make_traceparent", { enumerable: true, get: function () { return tctx_1.make; } });
|
5
|
-
Object.defineProperty(exports, "parse_traceparent", { enumerable: true, get: function () { return tctx_1.parse; } });
|
1
|
+
export { make as make_traceparent, parse as parse_traceparent } from 'tctx';
|