@dxos/observability 0.6.13 → 0.6.14-main.2b6a0f3
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/lib/browser/{chunk-QUPP43SQ.mjs → chunk-4OXG76Y3.mjs} +58 -388
- package/dist/lib/browser/chunk-4OXG76Y3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +323 -13
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/observability-WZNQCJ5C.mjs +7 -0
- package/dist/lib/node/{chunk-2ZVQBEPN.cjs → chunk-AMV7JU2O.cjs} +44 -379
- package/dist/lib/node/chunk-AMV7JU2O.cjs.map +7 -0
- package/dist/lib/node/index.cjs +340 -15
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{observability-YPS7RMWB.cjs → observability-Y2NU446N.cjs} +6 -6
- package/dist/lib/node/{observability-YPS7RMWB.cjs.map → observability-Y2NU446N.cjs.map} +2 -2
- package/dist/lib/node-esm/chunk-CMDADTM3.mjs +133 -0
- package/dist/lib/node-esm/chunk-CMDADTM3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D7JZEGRD.mjs +609 -0
- package/dist/lib/node-esm/chunk-D7JZEGRD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YJ4KVBWC.mjs +2 -0
- package/dist/lib/node-esm/chunk-YJ4KVBWC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +344 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/observability-RAXT3Z2H.mjs +8 -0
- package/dist/lib/node-esm/observability-RAXT3Z2H.mjs.map +7 -0
- package/dist/lib/node-esm/otel-YI7HAFOG.mjs +258 -0
- package/dist/lib/node-esm/otel-YI7HAFOG.mjs.map +7 -0
- package/dist/lib/node-esm/segment/index.mjs +144 -0
- package/dist/lib/node-esm/segment/index.mjs.map +7 -0
- package/dist/lib/node-esm/sentry/index.mjs +25 -0
- package/dist/lib/node-esm/sentry/index.mjs.map +7 -0
- package/dist/lib/node-esm/sentry-log-processor-JYJH3AMG.mjs +133 -0
- package/dist/lib/node-esm/sentry-log-processor-JYJH3AMG.mjs.map +7 -0
- package/dist/types/src/observability.d.ts.map +1 -1
- package/dist/types/src/observability.js +2 -0
- package/dist/types/src/observability.js.map +1 -1
- package/dist/types/src/sentry/node.node.test.d.ts +2 -0
- package/dist/types/src/sentry/node.node.test.d.ts.map +1 -0
- package/dist/types/src/sentry/{node.test.js → node.node.test.js} +8 -15
- package/dist/types/src/sentry/node.node.test.js.map +1 -0
- package/dist/types/src/sentry/sentry.node.test.d.ts +2 -0
- package/dist/types/src/sentry/sentry.node.test.d.ts.map +1 -0
- package/dist/types/src/sentry/{sentry.test.js → sentry.node.test.js} +8 -15
- package/dist/types/src/sentry/sentry.node.test.js.map +1 -0
- package/package.json +22 -18
- package/src/observability.ts +2 -1
- package/src/sentry/{node.test.ts → node.node.test.ts} +2 -9
- package/src/sentry/{sentry.test.ts → sentry.node.test.ts} +2 -7
- package/dist/lib/browser/chunk-QUPP43SQ.mjs.map +0 -7
- package/dist/lib/browser/observability-EJU34BZA.mjs +0 -7
- package/dist/lib/node/chunk-2ZVQBEPN.cjs.map +0 -7
- package/dist/types/src/sentry/node.test.d.ts +0 -2
- package/dist/types/src/sentry/node.test.d.ts.map +0 -1
- package/dist/types/src/sentry/node.test.js.map +0 -1
- package/dist/types/src/sentry/sentry.test.d.ts +0 -2
- package/dist/types/src/sentry/sentry.test.d.ts.map +0 -1
- package/dist/types/src/sentry/sentry.test.js.map +0 -1
- /package/dist/lib/browser/{observability-EJU34BZA.mjs.map → observability-WZNQCJ5C.mjs.map} +0 -0
|
@@ -26,39 +26,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
OBSERVABILITY_DISABLED_KEY: () => OBSERVABILITY_DISABLED_KEY,
|
|
32
|
-
OBSERVABILITY_GROUP_KEY: () => OBSERVABILITY_GROUP_KEY,
|
|
29
|
+
var chunk_AMV7JU2O_exports = {};
|
|
30
|
+
__export(chunk_AMV7JU2O_exports, {
|
|
33
31
|
Observability: () => Observability,
|
|
34
|
-
getObservabilityGroup: () => getObservabilityGroup,
|
|
35
|
-
getObservabilityState: () => getObservabilityState,
|
|
36
32
|
getTelemetryIdentifier: () => getTelemetryIdentifier,
|
|
37
|
-
|
|
38
|
-
initializeNodeObservability: () => initializeNodeObservability,
|
|
39
|
-
isObservabilityDisabled: () => isObservabilityDisabled,
|
|
40
|
-
mapSpaces: () => mapSpaces,
|
|
41
|
-
setupTelemetryListeners: () => setupTelemetryListeners,
|
|
42
|
-
showObservabilityBanner: () => showObservabilityBanner,
|
|
43
|
-
storeObservabilityDisabled: () => storeObservabilityDisabled,
|
|
44
|
-
storeObservabilityGroup: () => storeObservabilityGroup
|
|
33
|
+
mapSpaces: () => mapSpaces
|
|
45
34
|
});
|
|
46
|
-
module.exports = __toCommonJS(
|
|
35
|
+
module.exports = __toCommonJS(chunk_AMV7JU2O_exports);
|
|
47
36
|
var import_async = require("@dxos/async");
|
|
37
|
+
var import_client = require("@dxos/client");
|
|
48
38
|
var import_context = require("@dxos/context");
|
|
49
39
|
var import_invariant = require("@dxos/invariant");
|
|
50
40
|
var import_log = require("@dxos/log");
|
|
51
41
|
var import_network_manager = require("@dxos/network-manager");
|
|
52
42
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
53
43
|
var import_util = require("@dxos/util");
|
|
54
|
-
var localForage = __toESM(require("localforage"));
|
|
55
|
-
var import_log2 = require("@dxos/log");
|
|
56
|
-
var import_js_yaml = __toESM(require("js-yaml"));
|
|
57
|
-
var import_node_fs = require("node:fs");
|
|
58
|
-
var import_promises = require("node:fs/promises");
|
|
59
|
-
var import_node_path = require("node:path");
|
|
60
|
-
var import_uuid = require("uuid");
|
|
61
|
-
var import_log3 = require("@dxos/log");
|
|
62
44
|
var cli_observability_secrets_default = {
|
|
63
45
|
SENTRY_DESTINATION: "https://2647916221e643869965e78469479aa4@o4504012000067584.ingest.sentry.io/4504012027265029",
|
|
64
46
|
TELEMETRY_API_KEY: "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
|
|
@@ -66,150 +48,6 @@ var cli_observability_secrets_default = {
|
|
|
66
48
|
OTEL_ENDPOINT: null,
|
|
67
49
|
OTEL_AUTHORIZATION: null
|
|
68
50
|
};
|
|
69
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/helpers/browser-observability.ts";
|
|
70
|
-
var OBSERVABILITY_DISABLED_KEY = "observability-disabled";
|
|
71
|
-
var OBSERVABILITY_GROUP_KEY = "observability-group";
|
|
72
|
-
var isObservabilityDisabled = async (namespace) => {
|
|
73
|
-
try {
|
|
74
|
-
return await localForage.getItem(`${namespace}:${OBSERVABILITY_DISABLED_KEY}`) === "true";
|
|
75
|
-
} catch (err) {
|
|
76
|
-
import_log2.log.catch("Failed to check if observability is disabled, assuming it is", err, {
|
|
77
|
-
F: __dxlog_file,
|
|
78
|
-
L: 24,
|
|
79
|
-
S: void 0,
|
|
80
|
-
C: (f, a) => f(...a)
|
|
81
|
-
});
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var storeObservabilityDisabled = async (namespace, value) => {
|
|
86
|
-
try {
|
|
87
|
-
await localForage.setItem(`${namespace}:${OBSERVABILITY_DISABLED_KEY}`, String(value));
|
|
88
|
-
} catch (err) {
|
|
89
|
-
import_log2.log.catch("Failed to store observability disabled", err, {
|
|
90
|
-
F: __dxlog_file,
|
|
91
|
-
L: 33,
|
|
92
|
-
S: void 0,
|
|
93
|
-
C: (f, a) => f(...a)
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
var getObservabilityGroup = async (namespace) => {
|
|
98
|
-
try {
|
|
99
|
-
return await localForage.getItem(`${namespace}:${OBSERVABILITY_GROUP_KEY}`) ?? void 0;
|
|
100
|
-
} catch (err) {
|
|
101
|
-
import_log2.log.catch("Failed to get observability group", err, {
|
|
102
|
-
F: __dxlog_file,
|
|
103
|
-
L: 41,
|
|
104
|
-
S: void 0,
|
|
105
|
-
C: (f, a) => f(...a)
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
var storeObservabilityGroup = async (namespace, value) => {
|
|
110
|
-
try {
|
|
111
|
-
await localForage.setItem(`${namespace}:${OBSERVABILITY_GROUP_KEY}`, value);
|
|
112
|
-
} catch (err) {
|
|
113
|
-
import_log2.log.catch("Failed to store observability group", err, {
|
|
114
|
-
F: __dxlog_file,
|
|
115
|
-
L: 49,
|
|
116
|
-
S: void 0,
|
|
117
|
-
C: (f, a) => f(...a)
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
var initializeAppObservability = async ({ namespace, config, mode = "basic", tracingEnable = true, replayEnable = true }) => {
|
|
122
|
-
(0, import_log2.log)("initializeAppObservability", {
|
|
123
|
-
config
|
|
124
|
-
}, {
|
|
125
|
-
F: __dxlog_file,
|
|
126
|
-
L: 72,
|
|
127
|
-
S: void 0,
|
|
128
|
-
C: (f, a) => f(...a)
|
|
129
|
-
});
|
|
130
|
-
const group = await getObservabilityGroup(namespace) ?? void 0;
|
|
131
|
-
const release = `${namespace}@${config.get("runtime.app.build.version")}`;
|
|
132
|
-
const environment = config.get("runtime.app.env.DX_ENVIRONMENT");
|
|
133
|
-
const observabilityDisabled = await isObservabilityDisabled(namespace);
|
|
134
|
-
const { Observability: Observability2 } = await import("./observability-YPS7RMWB.cjs");
|
|
135
|
-
const observability = new Observability2({
|
|
136
|
-
namespace,
|
|
137
|
-
release,
|
|
138
|
-
environment,
|
|
139
|
-
group,
|
|
140
|
-
mode,
|
|
141
|
-
config,
|
|
142
|
-
errorLog: {
|
|
143
|
-
sentryInitOptions: {
|
|
144
|
-
environment,
|
|
145
|
-
release,
|
|
146
|
-
tracing: tracingEnable,
|
|
147
|
-
replay: replayEnable,
|
|
148
|
-
// TODO(wittjosiah): Configure these.
|
|
149
|
-
sampleRate: 1,
|
|
150
|
-
replaySampleRate: 0.1,
|
|
151
|
-
replaySampleRateOnError: 1
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
if (observabilityDisabled) {
|
|
156
|
-
observability.setMode("disabled");
|
|
157
|
-
import_log2.log.info("observability disabled", void 0, {
|
|
158
|
-
F: __dxlog_file,
|
|
159
|
-
L: 115,
|
|
160
|
-
S: void 0,
|
|
161
|
-
C: (f, a) => f(...a)
|
|
162
|
-
});
|
|
163
|
-
return observability;
|
|
164
|
-
}
|
|
165
|
-
try {
|
|
166
|
-
const getIPData = async (config2) => {
|
|
167
|
-
const IP_DATA_CACHE_TIMEOUT = 6 * 60 * 60 * 1e3;
|
|
168
|
-
const cachedData = await localForage.getItem("dxos:observability:ipdata");
|
|
169
|
-
if (cachedData && cachedData.timestamp > Date.now() - IP_DATA_CACHE_TIMEOUT) {
|
|
170
|
-
return cachedData.data;
|
|
171
|
-
}
|
|
172
|
-
const IPDATA_API_KEY = config2.get("runtime.app.env.DX_IPDATA_API_KEY");
|
|
173
|
-
if (IPDATA_API_KEY) {
|
|
174
|
-
return fetch(`https://api.ipdata.co?api-key=${IPDATA_API_KEY}`).then((res) => res.json()).then((data) => {
|
|
175
|
-
localForage.setItem("dxos:observability:ipdata", {
|
|
176
|
-
data,
|
|
177
|
-
timestamp: Date.now()
|
|
178
|
-
}).catch((err) => observability.captureException(err));
|
|
179
|
-
return data;
|
|
180
|
-
}).catch((err) => observability.captureException(err));
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
await observability.initialize();
|
|
184
|
-
observability.startErrorLogs();
|
|
185
|
-
const ipData = await getIPData(config);
|
|
186
|
-
ipData && observability.addIPDataTelemetryTags(ipData);
|
|
187
|
-
if (typeof navigator !== "undefined" && navigator.storage?.estimate) {
|
|
188
|
-
setInterval(async () => {
|
|
189
|
-
try {
|
|
190
|
-
const storageEstimate = await navigator.storage.estimate();
|
|
191
|
-
storageEstimate.usage && observability.setTag("storageUsage", storageEstimate.usage.toString(), "telemetry");
|
|
192
|
-
storageEstimate.quota && observability.setTag("storageQuota", storageEstimate.quota.toString(), "telemetry");
|
|
193
|
-
} catch (error) {
|
|
194
|
-
import_log2.log.warn("Failed to run estimate()", error, {
|
|
195
|
-
F: __dxlog_file,
|
|
196
|
-
L: 171,
|
|
197
|
-
S: void 0,
|
|
198
|
-
C: (f, a) => f(...a)
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}, 1e4);
|
|
202
|
-
}
|
|
203
|
-
} catch (err) {
|
|
204
|
-
import_log2.log.error("Failed to initialize app observability", err, {
|
|
205
|
-
F: __dxlog_file,
|
|
206
|
-
L: 176,
|
|
207
|
-
S: void 0,
|
|
208
|
-
C: (f, a) => f(...a)
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
return observability;
|
|
212
|
-
};
|
|
213
51
|
var getTelemetryIdentifier = (client) => {
|
|
214
52
|
if (!client?.initialized) {
|
|
215
53
|
return void 0;
|
|
@@ -220,90 +58,6 @@ var getTelemetryIdentifier = (client) => {
|
|
|
220
58
|
}
|
|
221
59
|
return void 0;
|
|
222
60
|
};
|
|
223
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/helpers/node-observability.ts";
|
|
224
|
-
var showObservabilityBanner = async (configDir, bannercb) => {
|
|
225
|
-
const path = (0, import_node_path.join)(configDir, ".observability-banner-printed");
|
|
226
|
-
if ((0, import_node_fs.existsSync)(path)) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
bannercb(
|
|
230
|
-
// eslint-disable-next-line no-multi-str
|
|
231
|
-
"Basic observability data will be sent to the DXOS team in order to improve the product. This includes performance metrics, error logs, and usage data. No personally identifiable information, other than your public key, is included with this data and no private data ever leaves your devices. To disable sending observability data, set the environment variable DX_DISABLE_OBSERVABILITY=true."
|
|
232
|
-
);
|
|
233
|
-
await (0, import_promises.writeFile)(path, "", "utf-8");
|
|
234
|
-
};
|
|
235
|
-
var getObservabilityState = async (configDir) => {
|
|
236
|
-
if ((0, import_node_fs.existsSync)(configDir)) {
|
|
237
|
-
if (!(0, import_node_fs.statSync)(configDir).isDirectory()) {
|
|
238
|
-
throw new Error(`Config directory ${configDir} exists but is not a directory`);
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
await (0, import_promises.mkdir)(configDir, {
|
|
242
|
-
recursive: true
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
const idPath = (0, import_node_path.join)(configDir, "observability.yml");
|
|
246
|
-
if ((0, import_node_fs.existsSync)(idPath)) {
|
|
247
|
-
const context = await (0, import_promises.readFile)(idPath, "utf-8");
|
|
248
|
-
return validate(context) ?? initializeState(idPath);
|
|
249
|
-
}
|
|
250
|
-
return initializeState(idPath);
|
|
251
|
-
};
|
|
252
|
-
var initializeState = async (idPath) => {
|
|
253
|
-
const observabilityState = {
|
|
254
|
-
installationId: (0, import_uuid.v4)(),
|
|
255
|
-
group: process.env.DX_OBSERVABILITY_GROUP ?? void 0,
|
|
256
|
-
mode: process.env.DX_DISABLE_OBSERVABILITY ? "disabled" : process.env.DX_OBSERVABILITY_MODE ?? "basic"
|
|
257
|
-
};
|
|
258
|
-
await (0, import_promises.writeFile)(idPath, "# This file is automatically generated by the @dxos/cli.\n" + import_js_yaml.default.dump(observabilityState), "utf-8");
|
|
259
|
-
return observabilityState;
|
|
260
|
-
};
|
|
261
|
-
var validate = (contextString) => {
|
|
262
|
-
const context = import_js_yaml.default.load(contextString);
|
|
263
|
-
if (Boolean(context.installationId) && (0, import_uuid.validate)(context.installationId)) {
|
|
264
|
-
return {
|
|
265
|
-
...context,
|
|
266
|
-
mode: process.env.DX_DISABLE_OBSERVABILITY ? "disabled" : context.mode ?? "basic"
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
var initializeNodeObservability = async ({ namespace, version, config, installationId, group, mode = "basic", tracingEnable = true, replayEnable = true }) => {
|
|
271
|
-
(0, import_log3.log)("initializeCliObservability", {
|
|
272
|
-
config
|
|
273
|
-
}, {
|
|
274
|
-
F: __dxlog_file2,
|
|
275
|
-
L: 110,
|
|
276
|
-
S: void 0,
|
|
277
|
-
C: (f, a) => f(...a)
|
|
278
|
-
});
|
|
279
|
-
const release = `${namespace}@${version}`;
|
|
280
|
-
const environment = process.env.DX_ENVIRONMENT ?? "unknown";
|
|
281
|
-
const observability = new Observability({
|
|
282
|
-
namespace,
|
|
283
|
-
release,
|
|
284
|
-
environment,
|
|
285
|
-
group,
|
|
286
|
-
mode,
|
|
287
|
-
errorLog: {
|
|
288
|
-
sentryInitOptions: {
|
|
289
|
-
environment,
|
|
290
|
-
release,
|
|
291
|
-
// TODO(wittjosiah): Configure this.
|
|
292
|
-
sampleRate: 1
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
observability.setTag("installationId", installationId);
|
|
297
|
-
const IPDATA_API_KEY = config.get("runtime.app.env.DX_IPDATA_API_KEY");
|
|
298
|
-
try {
|
|
299
|
-
const res = await fetch(`https://api.ipdata.co/?api-key=${IPDATA_API_KEY}`);
|
|
300
|
-
const ipData = await res.json();
|
|
301
|
-
ipData && observability.addIPDataTelemetryTags(ipData);
|
|
302
|
-
} catch (err) {
|
|
303
|
-
observability?.captureException(err);
|
|
304
|
-
}
|
|
305
|
-
return observability;
|
|
306
|
-
};
|
|
307
61
|
var mapSpaces = (spaces, options = {
|
|
308
62
|
verbose: false,
|
|
309
63
|
truncateKeys: false
|
|
@@ -333,86 +87,7 @@ var mapSpaces = (spaces, options = {
|
|
|
333
87
|
};
|
|
334
88
|
});
|
|
335
89
|
};
|
|
336
|
-
var
|
|
337
|
-
var totalTime = 0;
|
|
338
|
-
var setupTelemetryListeners = (namespace, client, observability) => {
|
|
339
|
-
const clickCallback = (event) => {
|
|
340
|
-
const id = event.target?.id;
|
|
341
|
-
if (!id) {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
setTimeout(() => observability.event({
|
|
345
|
-
identityId: getTelemetryIdentifier(client),
|
|
346
|
-
name: `${namespace}.window.click`,
|
|
347
|
-
properties: {
|
|
348
|
-
href: window.location.href,
|
|
349
|
-
id: event.target?.id,
|
|
350
|
-
path: event.composedPath().filter((el) => Boolean(el.tagName)).map((el) => `${el.tagName.toLowerCase()}${el.id ? `#${el.id}` : ""}`).reverse().join(">")
|
|
351
|
-
}
|
|
352
|
-
}));
|
|
353
|
-
};
|
|
354
|
-
const focusCallback = () => {
|
|
355
|
-
const now = /* @__PURE__ */ new Date();
|
|
356
|
-
setTimeout(() => observability.event({
|
|
357
|
-
identityId: getTelemetryIdentifier(client),
|
|
358
|
-
name: `${namespace}.window.focus`,
|
|
359
|
-
properties: {
|
|
360
|
-
href: window.location.href,
|
|
361
|
-
timeAway: now.getTime() - lastFocusEvent.getTime()
|
|
362
|
-
}
|
|
363
|
-
}));
|
|
364
|
-
lastFocusEvent = now;
|
|
365
|
-
};
|
|
366
|
-
const blurCallback = () => {
|
|
367
|
-
const now = /* @__PURE__ */ new Date();
|
|
368
|
-
const timeSpent = now.getTime() - lastFocusEvent.getTime();
|
|
369
|
-
setTimeout(() => observability.event({
|
|
370
|
-
identityId: getTelemetryIdentifier(client),
|
|
371
|
-
name: `${namespace}.window.blur`,
|
|
372
|
-
properties: {
|
|
373
|
-
href: window.location.href,
|
|
374
|
-
timeSpent
|
|
375
|
-
}
|
|
376
|
-
}));
|
|
377
|
-
lastFocusEvent = now;
|
|
378
|
-
totalTime = totalTime + timeSpent;
|
|
379
|
-
};
|
|
380
|
-
const unloadCallback = () => {
|
|
381
|
-
setTimeout(() => observability.event({
|
|
382
|
-
identityId: getTelemetryIdentifier(client),
|
|
383
|
-
name: `${namespace}.page.unload`,
|
|
384
|
-
properties: {
|
|
385
|
-
href: window.location.href,
|
|
386
|
-
timeSpent: totalTime
|
|
387
|
-
}
|
|
388
|
-
}));
|
|
389
|
-
};
|
|
390
|
-
const errorCallback = (event) => {
|
|
391
|
-
setTimeout(() => observability.event({
|
|
392
|
-
identityId: getTelemetryIdentifier(client),
|
|
393
|
-
name: `${namespace}.window.error`,
|
|
394
|
-
properties: {
|
|
395
|
-
href: window.location.href,
|
|
396
|
-
message: event.message,
|
|
397
|
-
filename: event.filename,
|
|
398
|
-
stack: event.error.stack
|
|
399
|
-
}
|
|
400
|
-
}));
|
|
401
|
-
};
|
|
402
|
-
window.addEventListener("click", clickCallback, true);
|
|
403
|
-
window.addEventListener("focus", focusCallback);
|
|
404
|
-
window.addEventListener("blur", blurCallback);
|
|
405
|
-
window.addEventListener("beforeunload", unloadCallback);
|
|
406
|
-
window.addEventListener("error", errorCallback);
|
|
407
|
-
return () => {
|
|
408
|
-
window.removeEventListener("click", clickCallback, true);
|
|
409
|
-
window.removeEventListener("focus", focusCallback);
|
|
410
|
-
window.removeEventListener("blur", blurCallback);
|
|
411
|
-
window.removeEventListener("beforeunload", unloadCallback);
|
|
412
|
-
window.removeEventListener("error", errorCallback);
|
|
413
|
-
};
|
|
414
|
-
};
|
|
415
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
90
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
416
91
|
var SPACE_METRICS_MIN_INTERVAL = 1e3 * 60;
|
|
417
92
|
var SPACE_TELEMETRY_MIN_INTERVAL = 1e3 * 60 * 60;
|
|
418
93
|
var NETWORK_METRICS_MIN_INTERVAL = 1e3 * 60 * 5;
|
|
@@ -420,7 +95,7 @@ var Observability = class {
|
|
|
420
95
|
// TODO(nf): make platform a required extension?
|
|
421
96
|
constructor({ namespace, environment, release, config, secrets, group, mode, telemetry, errorLog }) {
|
|
422
97
|
this._ctx = new import_context.Context(void 0, {
|
|
423
|
-
F:
|
|
98
|
+
F: __dxlog_file,
|
|
424
99
|
L: 87
|
|
425
100
|
});
|
|
426
101
|
this._tags = /* @__PURE__ */ new Map();
|
|
@@ -445,6 +120,7 @@ var Observability = class {
|
|
|
445
120
|
environment && this.setTag("environment", environment);
|
|
446
121
|
release && this.setTag("release", release);
|
|
447
122
|
this.setTag("mode", this._mode);
|
|
123
|
+
this.setTag("session", import_client.PublicKey.random().toHex());
|
|
448
124
|
}
|
|
449
125
|
get mode() {
|
|
450
126
|
return this._mode;
|
|
@@ -474,8 +150,8 @@ var Observability = class {
|
|
|
474
150
|
rtc: this._secrets,
|
|
475
151
|
config
|
|
476
152
|
}, {
|
|
477
|
-
F:
|
|
478
|
-
L:
|
|
153
|
+
F: __dxlog_file,
|
|
154
|
+
L: 151,
|
|
479
155
|
S: this,
|
|
480
156
|
C: (f, a) => f(...a)
|
|
481
157
|
});
|
|
@@ -534,8 +210,8 @@ var Observability = class {
|
|
|
534
210
|
(0, import_log.log)("empty response from identity service", {
|
|
535
211
|
idqr
|
|
536
212
|
}, {
|
|
537
|
-
F:
|
|
538
|
-
L:
|
|
213
|
+
F: __dxlog_file,
|
|
214
|
+
L: 219,
|
|
539
215
|
S: this,
|
|
540
216
|
C: (f, a) => f(...a)
|
|
541
217
|
});
|
|
@@ -550,16 +226,16 @@ var Observability = class {
|
|
|
550
226
|
(0, import_log.log)("empty response from device service", {
|
|
551
227
|
device: dqr
|
|
552
228
|
}, {
|
|
553
|
-
F:
|
|
554
|
-
L:
|
|
229
|
+
F: __dxlog_file,
|
|
230
|
+
L: 229,
|
|
555
231
|
S: this,
|
|
556
232
|
C: (f, a) => f(...a)
|
|
557
233
|
});
|
|
558
234
|
return;
|
|
559
235
|
}
|
|
560
236
|
(0, import_invariant.invariant)(dqr, "empty response from device service", {
|
|
561
|
-
F:
|
|
562
|
-
L:
|
|
237
|
+
F: __dxlog_file,
|
|
238
|
+
L: 232,
|
|
563
239
|
S: this,
|
|
564
240
|
A: [
|
|
565
241
|
"dqr",
|
|
@@ -571,8 +247,8 @@ var Observability = class {
|
|
|
571
247
|
(0, import_log.log)("no current device", {
|
|
572
248
|
device: dqr
|
|
573
249
|
}, {
|
|
574
|
-
F:
|
|
575
|
-
L:
|
|
250
|
+
F: __dxlog_file,
|
|
251
|
+
L: 236,
|
|
576
252
|
S: this,
|
|
577
253
|
C: (f, a) => f(...a)
|
|
578
254
|
});
|
|
@@ -604,15 +280,15 @@ var Observability = class {
|
|
|
604
280
|
]))
|
|
605
281
|
});
|
|
606
282
|
(0, import_log.log)("otel metrics enabled", void 0, {
|
|
607
|
-
F:
|
|
608
|
-
L:
|
|
283
|
+
F: __dxlog_file,
|
|
284
|
+
L: 268,
|
|
609
285
|
S: this,
|
|
610
286
|
C: (f, a) => f(...a)
|
|
611
287
|
});
|
|
612
288
|
} else {
|
|
613
289
|
(0, import_log.log)("otel metrics disabled", void 0, {
|
|
614
|
-
F:
|
|
615
|
-
L:
|
|
290
|
+
F: __dxlog_file,
|
|
291
|
+
L: 270,
|
|
616
292
|
S: this,
|
|
617
293
|
C: (f, a) => f(...a)
|
|
618
294
|
});
|
|
@@ -634,8 +310,8 @@ var Observability = class {
|
|
|
634
310
|
const updateSignalMetrics = new import_async.Event().debounce(NETWORK_METRICS_MIN_INTERVAL);
|
|
635
311
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
636
312
|
(0, import_log.log)("send signal metrics", void 0, {
|
|
637
|
-
F:
|
|
638
|
-
L:
|
|
313
|
+
F: __dxlog_file,
|
|
314
|
+
L: 292,
|
|
639
315
|
S: this,
|
|
640
316
|
C: (f, a) => f(...a)
|
|
641
317
|
});
|
|
@@ -686,8 +362,8 @@ var Observability = class {
|
|
|
686
362
|
const updateSpaceMetrics = new import_async.Event().debounce(SPACE_METRICS_MIN_INTERVAL);
|
|
687
363
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
688
364
|
(0, import_log.log)("send space metrics", void 0, {
|
|
689
|
-
F:
|
|
690
|
-
L:
|
|
365
|
+
F: __dxlog_file,
|
|
366
|
+
L: 346,
|
|
691
367
|
S: this,
|
|
692
368
|
C: (f, a) => f(...a)
|
|
693
369
|
});
|
|
@@ -711,8 +387,8 @@ var Observability = class {
|
|
|
711
387
|
const updateSpaceTelemetry = new import_async.Event().debounce(SPACE_TELEMETRY_MIN_INTERVAL);
|
|
712
388
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
713
389
|
(0, import_log.log)("send space telemetry", void 0, {
|
|
714
|
-
F:
|
|
715
|
-
L:
|
|
390
|
+
F: __dxlog_file,
|
|
391
|
+
L: 357,
|
|
716
392
|
S: this,
|
|
717
393
|
C: (f, a) => f(...a)
|
|
718
394
|
});
|
|
@@ -747,8 +423,8 @@ var Observability = class {
|
|
|
747
423
|
async startRuntimeMetrics(client, frequency = NETWORK_METRICS_MIN_INTERVAL) {
|
|
748
424
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
749
425
|
(0, import_invariant.invariant)(platform, "platform is required", {
|
|
750
|
-
F:
|
|
751
|
-
L:
|
|
426
|
+
F: __dxlog_file,
|
|
427
|
+
L: 394,
|
|
752
428
|
S: this,
|
|
753
429
|
A: [
|
|
754
430
|
"platform",
|
|
@@ -785,8 +461,8 @@ var Observability = class {
|
|
|
785
461
|
}).catch((error) => (0, import_log.log)("platform error", {
|
|
786
462
|
error
|
|
787
463
|
}, {
|
|
788
|
-
F:
|
|
789
|
-
L:
|
|
464
|
+
F: __dxlog_file,
|
|
465
|
+
L: 429,
|
|
790
466
|
S: this,
|
|
791
467
|
C: (f, a) => f(...a)
|
|
792
468
|
}));
|
|
@@ -810,8 +486,8 @@ var Observability = class {
|
|
|
810
486
|
});
|
|
811
487
|
} else {
|
|
812
488
|
(0, import_log.log)("segment disabled", void 0, {
|
|
813
|
-
F:
|
|
814
|
-
L:
|
|
489
|
+
F: __dxlog_file,
|
|
490
|
+
L: 455,
|
|
815
491
|
S: this,
|
|
816
492
|
C: (f, a) => f(...a)
|
|
817
493
|
});
|
|
@@ -847,8 +523,8 @@ var Observability = class {
|
|
|
847
523
|
dest: this._secrets.SENTRY_DESTINATION,
|
|
848
524
|
options: this._errorReportingOptions
|
|
849
525
|
}, {
|
|
850
|
-
F:
|
|
851
|
-
L:
|
|
526
|
+
F: __dxlog_file,
|
|
527
|
+
L: 491,
|
|
852
528
|
S: this,
|
|
853
529
|
C: (f, a) => f(...a)
|
|
854
530
|
});
|
|
@@ -866,8 +542,8 @@ var Observability = class {
|
|
|
866
542
|
});
|
|
867
543
|
} else {
|
|
868
544
|
(0, import_log.log)("sentry disabled", void 0, {
|
|
869
|
-
F:
|
|
870
|
-
L:
|
|
545
|
+
F: __dxlog_file,
|
|
546
|
+
L: 511,
|
|
871
547
|
S: this,
|
|
872
548
|
C: (f, a) => f(...a)
|
|
873
549
|
});
|
|
@@ -889,15 +565,15 @@ var Observability = class {
|
|
|
889
565
|
(0, import_log.log)("otel logs enabled", {
|
|
890
566
|
namespace: this._namespace
|
|
891
567
|
}, {
|
|
892
|
-
F:
|
|
893
|
-
L:
|
|
568
|
+
F: __dxlog_file,
|
|
569
|
+
L: 530,
|
|
894
570
|
S: this,
|
|
895
571
|
C: (f, a) => f(...a)
|
|
896
572
|
});
|
|
897
573
|
} else {
|
|
898
574
|
(0, import_log.log)("otel logs disabled", void 0, {
|
|
899
|
-
F:
|
|
900
|
-
L:
|
|
575
|
+
F: __dxlog_file,
|
|
576
|
+
L: 532,
|
|
901
577
|
S: this,
|
|
902
578
|
C: (f, a) => f(...a)
|
|
903
579
|
});
|
|
@@ -949,19 +625,8 @@ var Observability = class {
|
|
|
949
625
|
};
|
|
950
626
|
// Annotate the CommonJS export names for ESM import in node:
|
|
951
627
|
0 && (module.exports = {
|
|
952
|
-
OBSERVABILITY_DISABLED_KEY,
|
|
953
|
-
OBSERVABILITY_GROUP_KEY,
|
|
954
628
|
Observability,
|
|
955
|
-
getObservabilityGroup,
|
|
956
|
-
getObservabilityState,
|
|
957
629
|
getTelemetryIdentifier,
|
|
958
|
-
|
|
959
|
-
initializeNodeObservability,
|
|
960
|
-
isObservabilityDisabled,
|
|
961
|
-
mapSpaces,
|
|
962
|
-
setupTelemetryListeners,
|
|
963
|
-
showObservabilityBanner,
|
|
964
|
-
storeObservabilityDisabled,
|
|
965
|
-
storeObservabilityGroup
|
|
630
|
+
mapSpaces
|
|
966
631
|
});
|
|
967
|
-
//# sourceMappingURL=chunk-
|
|
632
|
+
//# sourceMappingURL=chunk-AMV7JU2O.cjs.map
|