@dxos/observability 0.6.2 → 0.6.3-main.0308ae2
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-HKNRDUTP.mjs → chunk-2CXA7PYK.mjs} +187 -221
- package/dist/lib/browser/chunk-2CXA7PYK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/observability-MXAPN7J6.mjs +7 -0
- package/dist/lib/browser/otel-BUKBDMAL.mjs +275 -0
- package/dist/lib/browser/otel-BUKBDMAL.mjs.map +7 -0
- package/dist/lib/browser/sentry-log-processor-DVUUOZ6G.mjs +132 -0
- package/dist/lib/browser/sentry-log-processor-DVUUOZ6G.mjs.map +7 -0
- package/dist/lib/node/{chunk-6QQAPUDU.cjs → chunk-HBLKTDQE.cjs} +190 -217
- package/dist/lib/node/chunk-HBLKTDQE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +15 -16
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{observability-7TFOBOTA.cjs → observability-4R6M4JMU.cjs} +6 -7
- package/dist/lib/node/observability-4R6M4JMU.cjs.map +7 -0
- package/dist/lib/node/otel-TSHMOAB4.cjs +276 -0
- package/dist/lib/node/otel-TSHMOAB4.cjs.map +7 -0
- package/dist/lib/node/sentry-log-processor-H6FUSKZI.cjs +150 -0
- package/dist/lib/node/sentry-log-processor-H6FUSKZI.cjs.map +7 -0
- package/dist/types/src/cli-observability-secrets.json +3 -1
- package/dist/types/src/helpers/browser-observability.d.ts.map +1 -1
- package/dist/types/src/helpers/browser-observability.js +1 -0
- package/dist/types/src/helpers/browser-observability.js.map +1 -1
- package/dist/types/src/observability.d.ts +12 -2
- package/dist/types/src/observability.d.ts.map +1 -1
- package/dist/types/src/observability.js +125 -42
- package/dist/types/src/observability.js.map +1 -1
- package/dist/types/src/otel/index.d.ts +5 -0
- package/dist/types/src/otel/index.d.ts.map +1 -0
- package/dist/types/src/otel/index.js +24 -0
- package/dist/types/src/otel/index.js.map +1 -0
- package/dist/types/src/otel/logs.d.ts +11 -0
- package/dist/types/src/otel/logs.d.ts.map +1 -0
- package/dist/types/src/otel/logs.js +72 -0
- package/dist/types/src/otel/logs.js.map +1 -0
- package/dist/types/src/otel/metrics.d.ts +14 -0
- package/dist/types/src/otel/metrics.d.ts.map +1 -0
- package/dist/types/src/otel/metrics.js +91 -0
- package/dist/types/src/otel/metrics.js.map +1 -0
- package/dist/types/src/otel/otel.d.ts +12 -0
- package/dist/types/src/otel/otel.d.ts.map +1 -0
- package/dist/types/src/otel/otel.js +15 -0
- package/dist/types/src/otel/otel.js.map +1 -0
- package/dist/types/src/otel/traces-browser.d.ts +8 -0
- package/dist/types/src/otel/traces-browser.d.ts.map +1 -0
- package/dist/types/src/otel/traces-browser.js +51 -0
- package/dist/types/src/otel/traces-browser.js.map +1 -0
- package/dist/types/src/otel/traces.d.ts +8 -0
- package/dist/types/src/otel/traces.d.ts.map +1 -0
- package/dist/types/src/otel/traces.js +44 -0
- package/dist/types/src/otel/traces.js.map +1 -0
- package/package.json +35 -20
- package/src/cli-observability-secrets.json +3 -1
- package/src/helpers/browser-observability.ts +1 -0
- package/src/observability.ts +141 -42
- package/src/otel/index.ts +8 -0
- package/src/otel/logs.ts +86 -0
- package/src/otel/metrics.ts +111 -0
- package/src/otel/otel.ts +21 -0
- package/src/otel/traces-browser.ts +59 -0
- package/src/otel/traces.ts +57 -0
- package/dist/lib/browser/chunk-HKNRDUTP.mjs.map +0 -7
- package/dist/lib/browser/observability-6FYBCIL6.mjs +0 -8
- package/dist/lib/node/chunk-6QQAPUDU.cjs.map +0 -7
- package/dist/lib/node/observability-7TFOBOTA.cjs.map +0 -7
- /package/dist/lib/browser/{observability-6FYBCIL6.mjs.map → observability-MXAPN7J6.mjs.map} +0 -0
|
@@ -26,8 +26,8 @@ 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(
|
|
29
|
+
var chunk_HBLKTDQE_exports = {};
|
|
30
|
+
__export(chunk_HBLKTDQE_exports, {
|
|
31
31
|
OBSERVABILITY_DISABLED_KEY: () => OBSERVABILITY_DISABLED_KEY,
|
|
32
32
|
OBSERVABILITY_GROUP_KEY: () => OBSERVABILITY_GROUP_KEY,
|
|
33
33
|
Observability: () => Observability,
|
|
@@ -43,8 +43,7 @@ __export(chunk_6QQAPUDU_exports, {
|
|
|
43
43
|
storeObservabilityDisabled: () => storeObservabilityDisabled,
|
|
44
44
|
storeObservabilityGroup: () => storeObservabilityGroup
|
|
45
45
|
});
|
|
46
|
-
module.exports = __toCommonJS(
|
|
47
|
-
var import_chunk_HKBUNAUG = require("./chunk-HKBUNAUG.cjs");
|
|
46
|
+
module.exports = __toCommonJS(chunk_HBLKTDQE_exports);
|
|
48
47
|
var import_async = require("@dxos/async");
|
|
49
48
|
var import_context = require("@dxos/context");
|
|
50
49
|
var import_invariant = require("@dxos/invariant");
|
|
@@ -60,15 +59,14 @@ var import_promises = require("node:fs/promises");
|
|
|
60
59
|
var import_node_path = require("node:path");
|
|
61
60
|
var import_uuid = require("uuid");
|
|
62
61
|
var import_log3 = require("@dxos/log");
|
|
63
|
-
var import_invariant2 = require("@dxos/invariant");
|
|
64
|
-
var import_log4 = require("@dxos/log");
|
|
65
|
-
var import_util2 = require("@dxos/util");
|
|
66
62
|
var cli_observability_secrets_default = {
|
|
67
63
|
SENTRY_DESTINATION: "https://2647916221e643869965e78469479aa4@o4504012000067584.ingest.sentry.io/4504012027265029",
|
|
68
64
|
TELEMETRY_API_KEY: "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
|
|
69
65
|
IPDATA_API_KEY: "73dfdecdf979c18f07d50cf841bbdd9e589f237256326ac8cca23786",
|
|
70
66
|
DATADOG_API_KEY: null,
|
|
71
|
-
DATADOG_APP_KEY: null
|
|
67
|
+
DATADOG_APP_KEY: null,
|
|
68
|
+
OTEL_ENDPOINT: null,
|
|
69
|
+
OTEL_AUTHORIZATION: null
|
|
72
70
|
};
|
|
73
71
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/helpers/browser-observability.ts";
|
|
74
72
|
var OBSERVABILITY_DISABLED_KEY = "observability-disabled";
|
|
@@ -135,7 +133,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
135
133
|
const release = `${namespace}@${config.get("runtime.app.build.version")}`;
|
|
136
134
|
const environment = config.get("runtime.app.env.DX_ENVIRONMENT");
|
|
137
135
|
const observabilityDisabled = await isObservabilityDisabled(namespace);
|
|
138
|
-
const { Observability: Observability2 } = await import("./observability-
|
|
136
|
+
const { Observability: Observability2 } = await import("./observability-4R6M4JMU.cjs");
|
|
139
137
|
const observability = new Observability2({
|
|
140
138
|
namespace,
|
|
141
139
|
release,
|
|
@@ -185,6 +183,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
185
183
|
}
|
|
186
184
|
};
|
|
187
185
|
await observability.initialize();
|
|
186
|
+
observability.startErrorLogs();
|
|
188
187
|
const ipData = await getIPData(config);
|
|
189
188
|
ipData && observability.addIPDataTelemetryTags(ipData);
|
|
190
189
|
if (typeof navigator !== "undefined" && navigator.storage?.estimate) {
|
|
@@ -196,7 +195,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
196
195
|
} catch (error) {
|
|
197
196
|
import_log2.log.warn("Failed to run estimate()", error, {
|
|
198
197
|
F: __dxlog_file,
|
|
199
|
-
L:
|
|
198
|
+
L: 171,
|
|
200
199
|
S: void 0,
|
|
201
200
|
C: (f, a) => f(...a)
|
|
202
201
|
});
|
|
@@ -206,7 +205,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
206
205
|
} catch (err) {
|
|
207
206
|
import_log2.log.error("Failed to initialize app observability", err, {
|
|
208
207
|
F: __dxlog_file,
|
|
209
|
-
L:
|
|
208
|
+
L: 176,
|
|
210
209
|
S: void 0,
|
|
211
210
|
C: (f, a) => f(...a)
|
|
212
211
|
});
|
|
@@ -415,124 +414,6 @@ var setupTelemetryListeners = (namespace, client, observability) => {
|
|
|
415
414
|
window.removeEventListener("error", errorCallback);
|
|
416
415
|
};
|
|
417
416
|
};
|
|
418
|
-
var MAX_LOG_BREADCRUMBS = 80;
|
|
419
|
-
var SentryLogProcessor = class {
|
|
420
|
-
constructor() {
|
|
421
|
-
this._breadcrumbs = new import_util2.CircularBuffer(MAX_LOG_BREADCRUMBS);
|
|
422
|
-
this.logProcessor = (config, entry) => {
|
|
423
|
-
const { level, meta, error } = entry;
|
|
424
|
-
if (!(0, import_log4.shouldLog)(entry, config.captureFilters) || meta?.S?.remoteSessionId) {
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
if (entry.level !== import_log4.LogLevel.WARN && entry.level !== import_log4.LogLevel.ERROR) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
(0, import_chunk_HKBUNAUG.withScope)((scope) => {
|
|
431
|
-
const severity = convertLevel(level);
|
|
432
|
-
scope.setLevel(severity);
|
|
433
|
-
scope.setContext("dxoslog", entry.context ?? null);
|
|
434
|
-
if (meta) {
|
|
435
|
-
scope.setTag("transaction", `${getRelativeFilename(meta.F)}:${meta.L}`);
|
|
436
|
-
if (meta.S?.hostSessionId) {
|
|
437
|
-
scope.setTags({
|
|
438
|
-
service_host_issue: true,
|
|
439
|
-
service_host_session: meta.S?.hostSessionId
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
if (!Number.isNaN(meta.S?.uptimeSeconds)) {
|
|
443
|
-
scope.setExtra("uptime_seconds", meta.S?.uptimeSeconds);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
const extendedMessage = formatMessageForSentry(entry);
|
|
447
|
-
let capturedError = error;
|
|
448
|
-
if (capturedError == null && entry.level === import_log4.LogLevel.ERROR) {
|
|
449
|
-
capturedError = Object.values(entry.context ?? {}).find((v) => v instanceof Error);
|
|
450
|
-
}
|
|
451
|
-
if (capturedError) {
|
|
452
|
-
if (capturedError instanceof import_invariant2.InvariantViolation) {
|
|
453
|
-
scope.setExtra("invariant_violation", true);
|
|
454
|
-
}
|
|
455
|
-
const isMessageDifferentFromStackTrace = error == null;
|
|
456
|
-
if (isMessageDifferentFromStackTrace) {
|
|
457
|
-
scope.setExtra("message", extendedMessage);
|
|
458
|
-
}
|
|
459
|
-
const eventId2 = (0, import_chunk_HKBUNAUG.captureException)(capturedError);
|
|
460
|
-
this._addBreadcrumb(eventId2, extendedMessage, severity, entry.context);
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
scope.setFingerprint([
|
|
464
|
-
entry.message
|
|
465
|
-
]);
|
|
466
|
-
const eventId = (0, import_chunk_HKBUNAUG.captureMessage)(extendedMessage);
|
|
467
|
-
this._addBreadcrumb(eventId, extendedMessage, severity, entry.context);
|
|
468
|
-
});
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
addLogBreadcrumbsTo(event) {
|
|
472
|
-
event.breadcrumbs ??= [];
|
|
473
|
-
for (const breadcrumb of this._breadcrumbs) {
|
|
474
|
-
event.breadcrumbs.push(breadcrumb);
|
|
475
|
-
}
|
|
476
|
-
event.breadcrumbs.sort((b1, b2) => {
|
|
477
|
-
if (b1.timestamp === void 0 || b2.timestamp === void 0) {
|
|
478
|
-
return b1.timestamp === b2.timestamp ? 0 : b1.timestamp === void 0 ? -1 : 1;
|
|
479
|
-
}
|
|
480
|
-
return b1.timestamp - b2.timestamp;
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
_addBreadcrumb(eventId, message, severity, context) {
|
|
484
|
-
const breadcrumb = {
|
|
485
|
-
type: "console",
|
|
486
|
-
level: severity,
|
|
487
|
-
event_id: eventId,
|
|
488
|
-
category: "log",
|
|
489
|
-
message,
|
|
490
|
-
data: context,
|
|
491
|
-
timestamp: Math.floor(Date.now() / 1e3)
|
|
492
|
-
};
|
|
493
|
-
const lastRecorded = this._breadcrumbs.getLast();
|
|
494
|
-
if (lastRecorded && lastRecorded.message === breadcrumb.message) {
|
|
495
|
-
const firstBreadcrumbData = lastRecorded.data?.firstBreadcrumbData ?? lastRecorded.data ?? {};
|
|
496
|
-
const mergedBreadcrumbCount = Number.isNaN(lastRecorded.data?.mergedBreadcrumbCount) ? 1 : Number(lastRecorded.data?.mergedBreadcrumbCount);
|
|
497
|
-
lastRecorded.data = {
|
|
498
|
-
mergedBreadcrumbCount: mergedBreadcrumbCount + 1,
|
|
499
|
-
firstBreadcrumbData,
|
|
500
|
-
lastBreadcrumbData: breadcrumb.data
|
|
501
|
-
};
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
this._breadcrumbs.push(breadcrumb);
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
var formatMessageForSentry = (entry) => {
|
|
508
|
-
let scopePrefix;
|
|
509
|
-
if (entry.meta?.S) {
|
|
510
|
-
const scope = entry.meta?.S;
|
|
511
|
-
scopePrefix = scope.name || (0, import_util2.getDebugName)(scope);
|
|
512
|
-
}
|
|
513
|
-
if (scopePrefix == null) {
|
|
514
|
-
return entry.message;
|
|
515
|
-
}
|
|
516
|
-
const workerPrefix = entry.meta?.S?.hostSessionId ? "[worker] " : "";
|
|
517
|
-
return `${workerPrefix}${scopePrefix} ${entry.message}`;
|
|
518
|
-
};
|
|
519
|
-
var convertLevel = (level) => {
|
|
520
|
-
if (level === import_log4.LogLevel.TRACE) {
|
|
521
|
-
return "debug";
|
|
522
|
-
}
|
|
523
|
-
if (level === import_log4.LogLevel.WARN) {
|
|
524
|
-
return "warning";
|
|
525
|
-
}
|
|
526
|
-
return import_log4.LogLevel[level].toLowerCase();
|
|
527
|
-
};
|
|
528
|
-
var getRelativeFilename = (filename) => {
|
|
529
|
-
const match = filename.match(/.+\/(packages\/.+\/.+)/);
|
|
530
|
-
if (match) {
|
|
531
|
-
const [, filePath] = match;
|
|
532
|
-
return filePath;
|
|
533
|
-
}
|
|
534
|
-
return filename;
|
|
535
|
-
};
|
|
536
417
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
537
418
|
var SPACE_METRICS_MIN_INTERVAL = 1e3 * 60;
|
|
538
419
|
var SPACE_TELEMETRY_MIN_INTERVAL = 1e3 * 60 * 60;
|
|
@@ -542,7 +423,7 @@ var Observability = class {
|
|
|
542
423
|
constructor({ namespace, environment, release, config, secrets, group, mode, telemetry, errorLog }) {
|
|
543
424
|
this._ctx = new import_context.Context(void 0, {
|
|
544
425
|
F: __dxlog_file3,
|
|
545
|
-
L:
|
|
426
|
+
L: 91
|
|
546
427
|
});
|
|
547
428
|
this._tags = /* @__PURE__ */ new Map();
|
|
548
429
|
this.addIPDataTelemetryTags = (ipData) => {
|
|
@@ -589,6 +470,8 @@ var Observability = class {
|
|
|
589
470
|
process.env.IPDATA_API_KEY && (mergedSecrets.IPDATA_API_KEY = process.env.IPDATA_API_KEY);
|
|
590
471
|
process.env.DATADOG_API_KEY && (mergedSecrets.DATADOG_API_KEY = process.env.DATADOG_API_KEY);
|
|
591
472
|
process.env.DATADOG_APP_KEY && (mergedSecrets.DATADOG_APP_KEY = process.env.DATADOG_APP_KEY);
|
|
473
|
+
process.env.DX_OTEL_ENDPOINT && (mergedSecrets.OTEL_ENDPOINT = process.env.DX_OTEL_ENDPOINT);
|
|
474
|
+
process.env.DX_OTEL_AUTHORIZATION && (mergedSecrets.OTEL_AUTHORIZATION = process.env.DX_OTEL_AUTHORIZATION);
|
|
592
475
|
return mergedSecrets;
|
|
593
476
|
} else {
|
|
594
477
|
(0, import_log.log)("config", {
|
|
@@ -596,7 +479,7 @@ var Observability = class {
|
|
|
596
479
|
config
|
|
597
480
|
}, {
|
|
598
481
|
F: __dxlog_file3,
|
|
599
|
-
L:
|
|
482
|
+
L: 156,
|
|
600
483
|
S: this,
|
|
601
484
|
C: (f, a) => f(...a)
|
|
602
485
|
});
|
|
@@ -608,6 +491,8 @@ var Observability = class {
|
|
|
608
491
|
IPDATA_API_KEY: config?.get("runtime.app.env.DX_IPDATA_API_KEY"),
|
|
609
492
|
DATADOG_API_KEY: config?.get("runtime.app.env.DX_DATADOG_API_KEY"),
|
|
610
493
|
DATADOG_APP_KEY: config?.get("runtime.app.env.DX_DATADOG_APP_KEY"),
|
|
494
|
+
OTEL_ENDPOINT: config?.get("runtime.app.env.DX_OTEL_ENDPOINT"),
|
|
495
|
+
OTEL_AUTHORIZATION: config?.get("runtime.app.env.DX_OTEL_AUTHORIZATION"),
|
|
611
496
|
...secrets
|
|
612
497
|
};
|
|
613
498
|
}
|
|
@@ -616,11 +501,14 @@ var Observability = class {
|
|
|
616
501
|
await this._initMetrics();
|
|
617
502
|
await this._initTelemetry();
|
|
618
503
|
await this._initErrorLogs();
|
|
504
|
+
await this._initTraces();
|
|
619
505
|
}
|
|
620
506
|
async close() {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
507
|
+
const closes = [];
|
|
508
|
+
this._telemetry && closes.push(this._telemetry.close());
|
|
509
|
+
this._otelMetrics && closes.push(this._otelMetrics.close());
|
|
510
|
+
this._otelLogs && closes.push(this._otelLogs.close());
|
|
511
|
+
await Promise.all(closes);
|
|
624
512
|
await this._ctx.dispose();
|
|
625
513
|
}
|
|
626
514
|
setMode(mode) {
|
|
@@ -645,59 +533,63 @@ var Observability = class {
|
|
|
645
533
|
return this._tags.get(key);
|
|
646
534
|
}
|
|
647
535
|
// TODO(wittjosiah): Improve privacy of telemetry identifiers. See `getTelemetryIdentifier`.
|
|
648
|
-
async setIdentityTags(
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
client.services.services.DevicesService.queryDevices().subscribe((dqr) => {
|
|
664
|
-
if (!dqr || !dqr.devices || dqr.devices.length === 0) {
|
|
665
|
-
(0, import_log.log)("empty response from device service", {
|
|
666
|
-
device: dqr
|
|
667
|
-
}, {
|
|
668
|
-
F: __dxlog_file3,
|
|
669
|
-
L: 218,
|
|
670
|
-
S: this,
|
|
671
|
-
C: (f, a) => f(...a)
|
|
672
|
-
});
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
(0, import_invariant.invariant)(dqr, "empty response from device service", {
|
|
676
|
-
F: __dxlog_file3,
|
|
677
|
-
L: 221,
|
|
678
|
-
S: this,
|
|
679
|
-
A: [
|
|
680
|
-
"dqr",
|
|
681
|
-
"'empty response from device service'"
|
|
682
|
-
]
|
|
536
|
+
async setIdentityTags(clientServices) {
|
|
537
|
+
if (clientServices.IdentityService) {
|
|
538
|
+
clientServices.IdentityService.queryIdentity().subscribe((idqr) => {
|
|
539
|
+
if (!idqr?.identity?.identityKey) {
|
|
540
|
+
(0, import_log.log)("empty response from identity service", {
|
|
541
|
+
idqr
|
|
542
|
+
}, {
|
|
543
|
+
F: __dxlog_file3,
|
|
544
|
+
L: 226,
|
|
545
|
+
S: this,
|
|
546
|
+
C: (f, a) => f(...a)
|
|
547
|
+
});
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
this.setTag("identityKey", idqr.identity.identityKey.truncate());
|
|
683
551
|
});
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
552
|
+
}
|
|
553
|
+
if (clientServices.DevicesService) {
|
|
554
|
+
clientServices.DevicesService.queryDevices().subscribe((dqr) => {
|
|
555
|
+
if (!dqr || !dqr.devices || dqr.devices.length === 0) {
|
|
556
|
+
(0, import_log.log)("empty response from device service", {
|
|
557
|
+
device: dqr
|
|
558
|
+
}, {
|
|
559
|
+
F: __dxlog_file3,
|
|
560
|
+
L: 236,
|
|
561
|
+
S: this,
|
|
562
|
+
C: (f, a) => f(...a)
|
|
563
|
+
});
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
(0, import_invariant.invariant)(dqr, "empty response from device service", {
|
|
689
567
|
F: __dxlog_file3,
|
|
690
|
-
L:
|
|
568
|
+
L: 239,
|
|
691
569
|
S: this,
|
|
692
|
-
|
|
570
|
+
A: [
|
|
571
|
+
"dqr",
|
|
572
|
+
"'empty response from device service'"
|
|
573
|
+
]
|
|
693
574
|
});
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
575
|
+
const thisDevice = dqr.devices.find((device) => device.kind === import_services.DeviceKind.CURRENT);
|
|
576
|
+
if (!thisDevice) {
|
|
577
|
+
(0, import_log.log)("no current device", {
|
|
578
|
+
device: dqr
|
|
579
|
+
}, {
|
|
580
|
+
F: __dxlog_file3,
|
|
581
|
+
L: 243,
|
|
582
|
+
S: this,
|
|
583
|
+
C: (f, a) => f(...a)
|
|
584
|
+
});
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
this.setTag("deviceKey", thisDevice.deviceKey.truncate());
|
|
588
|
+
if (thisDevice.profile?.label) {
|
|
589
|
+
this.setTag("deviceProfile", thisDevice.profile.label);
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
}
|
|
701
593
|
}
|
|
702
594
|
//
|
|
703
595
|
// Metrics
|
|
@@ -719,7 +611,35 @@ var Observability = class {
|
|
|
719
611
|
} else {
|
|
720
612
|
(0, import_log.log)("datadog disabled", void 0, {
|
|
721
613
|
F: __dxlog_file3,
|
|
722
|
-
L:
|
|
614
|
+
L: 275,
|
|
615
|
+
S: this,
|
|
616
|
+
C: (f, a) => f(...a)
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
if (this.enabled && this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION) {
|
|
620
|
+
const { OtelMetrics } = await import("./otel-TSHMOAB4.cjs");
|
|
621
|
+
this._otelMetrics = new OtelMetrics({
|
|
622
|
+
endpoint: this._secrets.OTEL_ENDPOINT,
|
|
623
|
+
authorizationHeader: this._secrets.OTEL_AUTHORIZATION,
|
|
624
|
+
serviceName: this._namespace,
|
|
625
|
+
serviceVersion: this.getTag("release")?.value ?? "0.0.0",
|
|
626
|
+
getTags: () => Object.fromEntries(Array.from(this._tags).filter(([key, value]) => {
|
|
627
|
+
return value.scope === "all" || value.scope === "metrics";
|
|
628
|
+
}).map(([key, value]) => [
|
|
629
|
+
key,
|
|
630
|
+
value.value
|
|
631
|
+
]))
|
|
632
|
+
});
|
|
633
|
+
(0, import_log.log)("otel metrics enabled", void 0, {
|
|
634
|
+
F: __dxlog_file3,
|
|
635
|
+
L: 294,
|
|
636
|
+
S: this,
|
|
637
|
+
C: (f, a) => f(...a)
|
|
638
|
+
});
|
|
639
|
+
} else {
|
|
640
|
+
(0, import_log.log)("otel metrics disabled", void 0, {
|
|
641
|
+
F: __dxlog_file3,
|
|
642
|
+
L: 296,
|
|
723
643
|
S: this,
|
|
724
644
|
C: (f, a) => f(...a)
|
|
725
645
|
});
|
|
@@ -732,14 +652,18 @@ var Observability = class {
|
|
|
732
652
|
*/
|
|
733
653
|
gauge(name, value, extraTags) {
|
|
734
654
|
this._metrics?.gauge(name, value, extraTags);
|
|
655
|
+
this._otelMetrics?.gauge(name, value, extraTags);
|
|
735
656
|
}
|
|
736
657
|
// TODO(nf): Refactor into ObservabilityExtensions.
|
|
737
|
-
startNetworkMetrics(
|
|
658
|
+
startNetworkMetrics(clientServices) {
|
|
659
|
+
if (!clientServices.NetworkService) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
738
662
|
const updateSignalMetrics = new import_async.Event().debounce(NETWORK_METRICS_MIN_INTERVAL);
|
|
739
663
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
740
664
|
(0, import_log.log)("send signal metrics", void 0, {
|
|
741
665
|
F: __dxlog_file3,
|
|
742
|
-
L:
|
|
666
|
+
L: 319,
|
|
743
667
|
S: this,
|
|
744
668
|
C: (f, a) => f(...a)
|
|
745
669
|
});
|
|
@@ -777,7 +701,7 @@ var Observability = class {
|
|
|
777
701
|
this.gauge("dxos.client.network.totalChannelBufferSize", totalChannelBufferSize);
|
|
778
702
|
});
|
|
779
703
|
});
|
|
780
|
-
|
|
704
|
+
clientServices.NetworkService.queryStatus().subscribe((networkStatus) => {
|
|
781
705
|
this._lastNetworkStatus = networkStatus;
|
|
782
706
|
updateSignalMetrics.emit();
|
|
783
707
|
});
|
|
@@ -791,7 +715,7 @@ var Observability = class {
|
|
|
791
715
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
792
716
|
(0, import_log.log)("send space metrics", void 0, {
|
|
793
717
|
F: __dxlog_file3,
|
|
794
|
-
L:
|
|
718
|
+
L: 373,
|
|
795
719
|
S: this,
|
|
796
720
|
C: (f, a) => f(...a)
|
|
797
721
|
});
|
|
@@ -816,7 +740,7 @@ var Observability = class {
|
|
|
816
740
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
817
741
|
(0, import_log.log)("send space telemetry", void 0, {
|
|
818
742
|
F: __dxlog_file3,
|
|
819
|
-
L:
|
|
743
|
+
L: 384,
|
|
820
744
|
S: this,
|
|
821
745
|
C: (f, a) => f(...a)
|
|
822
746
|
});
|
|
@@ -852,7 +776,7 @@ var Observability = class {
|
|
|
852
776
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
853
777
|
(0, import_invariant.invariant)(platform, "platform is required", {
|
|
854
778
|
F: __dxlog_file3,
|
|
855
|
-
L:
|
|
779
|
+
L: 421,
|
|
856
780
|
S: this,
|
|
857
781
|
A: [
|
|
858
782
|
"platform",
|
|
@@ -872,31 +796,25 @@ var Observability = class {
|
|
|
872
796
|
}
|
|
873
797
|
}
|
|
874
798
|
(0, import_async.scheduleTaskInterval)(this._ctx, async () => {
|
|
875
|
-
(
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
799
|
+
if (client.services.constructor.name === "WorkerClientServices") {
|
|
800
|
+
const memory = window.performance.memory;
|
|
801
|
+
if (memory) {
|
|
802
|
+
this.gauge("dxos.client.runtime.heapTotal", memory.totalJSHeapSize);
|
|
803
|
+
this.gauge("dxos.client.runtime.heapUsed", memory.usedJSHeapSize);
|
|
804
|
+
this.gauge("dxos.client.runtime.heapSizeLimit", memory.jsHeapSizeLimit);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
881
807
|
client.services.services.SystemService?.getPlatform().then((platform2) => {
|
|
882
|
-
(0, import_log.log)("platform", {
|
|
883
|
-
platform: platform2
|
|
884
|
-
}, {
|
|
885
|
-
F: __dxlog_file3,
|
|
886
|
-
L: 399,
|
|
887
|
-
S: this,
|
|
888
|
-
C: (f, a) => f(...a)
|
|
889
|
-
});
|
|
890
808
|
if (platform2.memory) {
|
|
891
|
-
this.gauge("dxos.client.runtime.rss", platform2.memory.rss);
|
|
892
|
-
this.gauge("dxos.client.runtime.heapTotal", platform2.memory.heapTotal);
|
|
893
|
-
this.gauge("dxos.client.runtime.heapUsed", platform2.memory.heapUsed);
|
|
809
|
+
this.gauge("dxos.client.services.runtime.rss", platform2.memory.rss);
|
|
810
|
+
this.gauge("dxos.client.services.runtime.heapTotal", platform2.memory.heapTotal);
|
|
811
|
+
this.gauge("dxos.client.services.runtime.heapUsed", platform2.memory.heapUsed);
|
|
894
812
|
}
|
|
895
813
|
}).catch((error) => (0, import_log.log)("platform error", {
|
|
896
814
|
error
|
|
897
815
|
}, {
|
|
898
816
|
F: __dxlog_file3,
|
|
899
|
-
L:
|
|
817
|
+
L: 456,
|
|
900
818
|
S: this,
|
|
901
819
|
C: (f, a) => f(...a)
|
|
902
820
|
}));
|
|
@@ -921,7 +839,7 @@ var Observability = class {
|
|
|
921
839
|
} else {
|
|
922
840
|
(0, import_log.log)("segment disabled", void 0, {
|
|
923
841
|
F: __dxlog_file3,
|
|
924
|
-
L:
|
|
842
|
+
L: 482,
|
|
925
843
|
S: this,
|
|
926
844
|
C: (f, a) => f(...a)
|
|
927
845
|
});
|
|
@@ -948,8 +866,9 @@ var Observability = class {
|
|
|
948
866
|
//
|
|
949
867
|
async _initErrorLogs() {
|
|
950
868
|
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
951
|
-
const { captureException
|
|
952
|
-
|
|
869
|
+
const { captureException, captureUserFeedback, init, setTag } = await import("./sentry/index.cjs");
|
|
870
|
+
const { SentryLogProcessor } = await import("./sentry-log-processor-H6FUSKZI.cjs");
|
|
871
|
+
this._captureException = captureException;
|
|
953
872
|
this._captureUserFeedback = captureUserFeedback;
|
|
954
873
|
this._setTag = setTag;
|
|
955
874
|
import_log.log.info("Initializing Sentry", {
|
|
@@ -957,18 +876,17 @@ var Observability = class {
|
|
|
957
876
|
options: this._errorReportingOptions
|
|
958
877
|
}, {
|
|
959
878
|
F: __dxlog_file3,
|
|
960
|
-
L:
|
|
879
|
+
L: 518,
|
|
961
880
|
S: this,
|
|
962
881
|
C: (f, a) => f(...a)
|
|
963
882
|
});
|
|
964
|
-
|
|
883
|
+
this._sentryLogProcessor = new SentryLogProcessor();
|
|
965
884
|
init({
|
|
966
885
|
...this._errorReportingOptions,
|
|
967
886
|
destination: this._secrets.SENTRY_DESTINATION,
|
|
968
887
|
scrubFilenames: this._mode !== "full",
|
|
969
|
-
onError: (event) =>
|
|
888
|
+
onError: (event) => this._sentryLogProcessor.addLogBreadcrumbsTo(event)
|
|
970
889
|
});
|
|
971
|
-
import_log.log.runtimeConfig.processors.push(logProcessor.logProcessor);
|
|
972
890
|
this._tags.forEach((v, k) => {
|
|
973
891
|
if (v.scope === "all" || v.scope === "errors") {
|
|
974
892
|
setTag(k, v.value);
|
|
@@ -977,10 +895,65 @@ var Observability = class {
|
|
|
977
895
|
} else {
|
|
978
896
|
(0, import_log.log)("sentry disabled", void 0, {
|
|
979
897
|
F: __dxlog_file3,
|
|
980
|
-
L:
|
|
898
|
+
L: 538,
|
|
899
|
+
S: this,
|
|
900
|
+
C: (f, a) => f(...a)
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
if (this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION && this._mode !== "disabled") {
|
|
904
|
+
const { OtelLogs } = await import("./otel-TSHMOAB4.cjs");
|
|
905
|
+
this._otelLogs = new OtelLogs({
|
|
906
|
+
endpoint: this._secrets.OTEL_ENDPOINT,
|
|
907
|
+
authorizationHeader: this._secrets.OTEL_AUTHORIZATION,
|
|
908
|
+
serviceName: this._namespace,
|
|
909
|
+
serviceVersion: this.getTag("release")?.value ?? "0.0.0",
|
|
910
|
+
getTags: () => Object.fromEntries(Array.from(this._tags).filter(([key, value]) => {
|
|
911
|
+
return value.scope === "all" || value.scope === "errors";
|
|
912
|
+
}).map(([key, value]) => [
|
|
913
|
+
key,
|
|
914
|
+
value.value
|
|
915
|
+
]))
|
|
916
|
+
});
|
|
917
|
+
(0, import_log.log)("otel logs enabled", {
|
|
918
|
+
namespace: this._namespace
|
|
919
|
+
}, {
|
|
920
|
+
F: __dxlog_file3,
|
|
921
|
+
L: 557,
|
|
981
922
|
S: this,
|
|
982
923
|
C: (f, a) => f(...a)
|
|
983
924
|
});
|
|
925
|
+
} else {
|
|
926
|
+
(0, import_log.log)("otel logs disabled", void 0, {
|
|
927
|
+
F: __dxlog_file3,
|
|
928
|
+
L: 559,
|
|
929
|
+
S: this,
|
|
930
|
+
C: (f, a) => f(...a)
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
startErrorLogs() {
|
|
935
|
+
this._sentryLogProcessor && import_log.log.runtimeConfig.processors.push(this._sentryLogProcessor.logProcessor);
|
|
936
|
+
this._otelLogs && import_log.log.runtimeConfig.processors.push(this._otelLogs.logProcessor);
|
|
937
|
+
}
|
|
938
|
+
startTraces() {
|
|
939
|
+
this._otelTraces && this._otelTraces.start();
|
|
940
|
+
}
|
|
941
|
+
// TODO(nf): refactor init based on providers and their capabilities
|
|
942
|
+
async _initTraces() {
|
|
943
|
+
if (this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION && this._mode !== "disabled") {
|
|
944
|
+
const { OtelTraces } = await import("./otel-TSHMOAB4.cjs");
|
|
945
|
+
this._otelTraces = new OtelTraces({
|
|
946
|
+
endpoint: this._secrets.OTEL_ENDPOINT,
|
|
947
|
+
authorizationHeader: this._secrets.OTEL_AUTHORIZATION,
|
|
948
|
+
serviceName: this._namespace,
|
|
949
|
+
serviceVersion: this.getTag("release")?.value ?? "0.0.0",
|
|
950
|
+
getTags: () => Object.fromEntries(Array.from(this._tags).filter(([key, value]) => {
|
|
951
|
+
return value.scope === "all" || value.scope === "metrics";
|
|
952
|
+
}).map(([key, value]) => [
|
|
953
|
+
key,
|
|
954
|
+
value.value
|
|
955
|
+
]))
|
|
956
|
+
});
|
|
984
957
|
}
|
|
985
958
|
}
|
|
986
959
|
/**
|
|
@@ -1019,4 +992,4 @@ var Observability = class {
|
|
|
1019
992
|
storeObservabilityDisabled,
|
|
1020
993
|
storeObservabilityGroup
|
|
1021
994
|
});
|
|
1022
|
-
//# sourceMappingURL=chunk-
|
|
995
|
+
//# sourceMappingURL=chunk-HBLKTDQE.cjs.map
|