@contello/opentelemetry 1.0.0 → 1.0.1
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 +6 -5
- package/dist/index.js +6 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -49,16 +49,17 @@ function parseMetricAttrs(name, extra) {
|
|
|
49
49
|
...extra
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
var CHANNEL_PREFIXES = ["contello
|
|
52
|
+
var CHANNEL_PREFIXES = ["@contello/store", "@contello/client", "@contello/astro"];
|
|
53
53
|
var ContelloInstrumentation = class extends import_instrumentation.InstrumentationBase {
|
|
54
54
|
_subscriptions = [];
|
|
55
55
|
constructor(config = {}) {
|
|
56
|
-
super("@contello/opentelemetry", "
|
|
56
|
+
super("@contello/opentelemetry", "1.0.0", config);
|
|
57
57
|
}
|
|
58
58
|
init() {
|
|
59
59
|
return [];
|
|
60
60
|
}
|
|
61
61
|
enable() {
|
|
62
|
+
this._subscriptions ??= [];
|
|
62
63
|
if (this._subscriptions.length > 0) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
@@ -73,8 +74,8 @@ var ContelloInstrumentation = class extends import_instrumentation.Instrumentati
|
|
|
73
74
|
});
|
|
74
75
|
const userConfig = this.getConfig();
|
|
75
76
|
for (const prefix of CHANNEL_PREFIXES) {
|
|
76
|
-
const endChannel = import_node_diagnostics_channel.default.channel(`${prefix}
|
|
77
|
-
const errorChannel = import_node_diagnostics_channel.default.channel(`${prefix}
|
|
77
|
+
const endChannel = import_node_diagnostics_channel.default.channel(`${prefix}:end`);
|
|
78
|
+
const errorChannel = import_node_diagnostics_channel.default.channel(`${prefix}:error`);
|
|
78
79
|
const onEnd = (message) => {
|
|
79
80
|
const msg = message;
|
|
80
81
|
const attrs = parseMetricAttrs(msg.name, { cached: msg.cached ?? false });
|
|
@@ -100,7 +101,7 @@ var ContelloInstrumentation = class extends import_instrumentation.Instrumentati
|
|
|
100
101
|
this._subscriptions.push({ channel: endChannel, handler: onEnd });
|
|
101
102
|
this._subscriptions.push({ channel: errorChannel, handler: onError });
|
|
102
103
|
}
|
|
103
|
-
const messageChannel = import_node_diagnostics_channel.default.channel("contello:
|
|
104
|
+
const messageChannel = import_node_diagnostics_channel.default.channel("@contello/client:message");
|
|
104
105
|
const onMessage = (message) => {
|
|
105
106
|
const msg = message;
|
|
106
107
|
const output = {};
|
package/dist/index.js
CHANGED
|
@@ -13,16 +13,17 @@ function parseMetricAttrs(name, extra) {
|
|
|
13
13
|
...extra
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
var CHANNEL_PREFIXES = ["contello
|
|
16
|
+
var CHANNEL_PREFIXES = ["@contello/store", "@contello/client", "@contello/astro"];
|
|
17
17
|
var ContelloInstrumentation = class extends InstrumentationBase {
|
|
18
18
|
_subscriptions = [];
|
|
19
19
|
constructor(config = {}) {
|
|
20
|
-
super("@contello/opentelemetry", "
|
|
20
|
+
super("@contello/opentelemetry", "1.0.0", config);
|
|
21
21
|
}
|
|
22
22
|
init() {
|
|
23
23
|
return [];
|
|
24
24
|
}
|
|
25
25
|
enable() {
|
|
26
|
+
this._subscriptions ??= [];
|
|
26
27
|
if (this._subscriptions.length > 0) {
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
@@ -37,8 +38,8 @@ var ContelloInstrumentation = class extends InstrumentationBase {
|
|
|
37
38
|
});
|
|
38
39
|
const userConfig = this.getConfig();
|
|
39
40
|
for (const prefix of CHANNEL_PREFIXES) {
|
|
40
|
-
const endChannel = dc.channel(`${prefix}
|
|
41
|
-
const errorChannel = dc.channel(`${prefix}
|
|
41
|
+
const endChannel = dc.channel(`${prefix}:end`);
|
|
42
|
+
const errorChannel = dc.channel(`${prefix}:error`);
|
|
42
43
|
const onEnd = (message) => {
|
|
43
44
|
const msg = message;
|
|
44
45
|
const attrs = parseMetricAttrs(msg.name, { cached: msg.cached ?? false });
|
|
@@ -64,7 +65,7 @@ var ContelloInstrumentation = class extends InstrumentationBase {
|
|
|
64
65
|
this._subscriptions.push({ channel: endChannel, handler: onEnd });
|
|
65
66
|
this._subscriptions.push({ channel: errorChannel, handler: onError });
|
|
66
67
|
}
|
|
67
|
-
const messageChannel = dc.channel("contello:
|
|
68
|
+
const messageChannel = dc.channel("@contello/client:message");
|
|
68
69
|
const onMessage = (message) => {
|
|
69
70
|
const msg = message;
|
|
70
71
|
const output = {};
|