@dxos/observability 0.6.3-main.cc41ccb → 0.6.3-main.d76104f
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-7HCG6KYK.mjs → chunk-2CXA7PYK.mjs} +133 -174
- 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-63FCWS3M.cjs → chunk-HBLKTDQE.cjs} +136 -170
- 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-W7TVZP2V.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 +9 -0
- package/dist/types/src/observability.d.ts.map +1 -1
- package/dist/types/src/observability.js +90 -13
- 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 +107 -14
- 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-7HCG6KYK.mjs.map +0 -7
- package/dist/lib/browser/observability-IFDZJFY2.mjs +0 -8
- package/dist/lib/node/chunk-63FCWS3M.cjs.map +0 -7
- package/dist/lib/node/observability-W7TVZP2V.cjs.map +0 -7
- /package/dist/lib/browser/{observability-IFDZJFY2.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_63FCWS3M_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) {
|
|
@@ -653,7 +541,7 @@ var Observability = class {
|
|
|
653
541
|
idqr
|
|
654
542
|
}, {
|
|
655
543
|
F: __dxlog_file3,
|
|
656
|
-
L:
|
|
544
|
+
L: 226,
|
|
657
545
|
S: this,
|
|
658
546
|
C: (f, a) => f(...a)
|
|
659
547
|
});
|
|
@@ -669,7 +557,7 @@ var Observability = class {
|
|
|
669
557
|
device: dqr
|
|
670
558
|
}, {
|
|
671
559
|
F: __dxlog_file3,
|
|
672
|
-
L:
|
|
560
|
+
L: 236,
|
|
673
561
|
S: this,
|
|
674
562
|
C: (f, a) => f(...a)
|
|
675
563
|
});
|
|
@@ -677,7 +565,7 @@ var Observability = class {
|
|
|
677
565
|
}
|
|
678
566
|
(0, import_invariant.invariant)(dqr, "empty response from device service", {
|
|
679
567
|
F: __dxlog_file3,
|
|
680
|
-
L:
|
|
568
|
+
L: 239,
|
|
681
569
|
S: this,
|
|
682
570
|
A: [
|
|
683
571
|
"dqr",
|
|
@@ -690,7 +578,7 @@ var Observability = class {
|
|
|
690
578
|
device: dqr
|
|
691
579
|
}, {
|
|
692
580
|
F: __dxlog_file3,
|
|
693
|
-
L:
|
|
581
|
+
L: 243,
|
|
694
582
|
S: this,
|
|
695
583
|
C: (f, a) => f(...a)
|
|
696
584
|
});
|
|
@@ -723,7 +611,35 @@ var Observability = class {
|
|
|
723
611
|
} else {
|
|
724
612
|
(0, import_log.log)("datadog disabled", void 0, {
|
|
725
613
|
F: __dxlog_file3,
|
|
726
|
-
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,
|
|
727
643
|
S: this,
|
|
728
644
|
C: (f, a) => f(...a)
|
|
729
645
|
});
|
|
@@ -736,6 +652,7 @@ var Observability = class {
|
|
|
736
652
|
*/
|
|
737
653
|
gauge(name, value, extraTags) {
|
|
738
654
|
this._metrics?.gauge(name, value, extraTags);
|
|
655
|
+
this._otelMetrics?.gauge(name, value, extraTags);
|
|
739
656
|
}
|
|
740
657
|
// TODO(nf): Refactor into ObservabilityExtensions.
|
|
741
658
|
startNetworkMetrics(clientServices) {
|
|
@@ -746,7 +663,7 @@ var Observability = class {
|
|
|
746
663
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
747
664
|
(0, import_log.log)("send signal metrics", void 0, {
|
|
748
665
|
F: __dxlog_file3,
|
|
749
|
-
L:
|
|
666
|
+
L: 319,
|
|
750
667
|
S: this,
|
|
751
668
|
C: (f, a) => f(...a)
|
|
752
669
|
});
|
|
@@ -798,7 +715,7 @@ var Observability = class {
|
|
|
798
715
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
799
716
|
(0, import_log.log)("send space metrics", void 0, {
|
|
800
717
|
F: __dxlog_file3,
|
|
801
|
-
L:
|
|
718
|
+
L: 373,
|
|
802
719
|
S: this,
|
|
803
720
|
C: (f, a) => f(...a)
|
|
804
721
|
});
|
|
@@ -823,7 +740,7 @@ var Observability = class {
|
|
|
823
740
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
824
741
|
(0, import_log.log)("send space telemetry", void 0, {
|
|
825
742
|
F: __dxlog_file3,
|
|
826
|
-
L:
|
|
743
|
+
L: 384,
|
|
827
744
|
S: this,
|
|
828
745
|
C: (f, a) => f(...a)
|
|
829
746
|
});
|
|
@@ -859,7 +776,7 @@ var Observability = class {
|
|
|
859
776
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
860
777
|
(0, import_invariant.invariant)(platform, "platform is required", {
|
|
861
778
|
F: __dxlog_file3,
|
|
862
|
-
L:
|
|
779
|
+
L: 421,
|
|
863
780
|
S: this,
|
|
864
781
|
A: [
|
|
865
782
|
"platform",
|
|
@@ -879,31 +796,25 @@ var Observability = class {
|
|
|
879
796
|
}
|
|
880
797
|
}
|
|
881
798
|
(0, import_async.scheduleTaskInterval)(this._ctx, async () => {
|
|
882
|
-
(
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
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
|
+
}
|
|
888
807
|
client.services.services.SystemService?.getPlatform().then((platform2) => {
|
|
889
|
-
(0, import_log.log)("platform", {
|
|
890
|
-
platform: platform2
|
|
891
|
-
}, {
|
|
892
|
-
F: __dxlog_file3,
|
|
893
|
-
L: 405,
|
|
894
|
-
S: this,
|
|
895
|
-
C: (f, a) => f(...a)
|
|
896
|
-
});
|
|
897
808
|
if (platform2.memory) {
|
|
898
|
-
this.gauge("dxos.client.runtime.rss", platform2.memory.rss);
|
|
899
|
-
this.gauge("dxos.client.runtime.heapTotal", platform2.memory.heapTotal);
|
|
900
|
-
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);
|
|
901
812
|
}
|
|
902
813
|
}).catch((error) => (0, import_log.log)("platform error", {
|
|
903
814
|
error
|
|
904
815
|
}, {
|
|
905
816
|
F: __dxlog_file3,
|
|
906
|
-
L:
|
|
817
|
+
L: 456,
|
|
907
818
|
S: this,
|
|
908
819
|
C: (f, a) => f(...a)
|
|
909
820
|
}));
|
|
@@ -928,7 +839,7 @@ var Observability = class {
|
|
|
928
839
|
} else {
|
|
929
840
|
(0, import_log.log)("segment disabled", void 0, {
|
|
930
841
|
F: __dxlog_file3,
|
|
931
|
-
L:
|
|
842
|
+
L: 482,
|
|
932
843
|
S: this,
|
|
933
844
|
C: (f, a) => f(...a)
|
|
934
845
|
});
|
|
@@ -955,8 +866,9 @@ var Observability = class {
|
|
|
955
866
|
//
|
|
956
867
|
async _initErrorLogs() {
|
|
957
868
|
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
958
|
-
const { captureException
|
|
959
|
-
|
|
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;
|
|
960
872
|
this._captureUserFeedback = captureUserFeedback;
|
|
961
873
|
this._setTag = setTag;
|
|
962
874
|
import_log.log.info("Initializing Sentry", {
|
|
@@ -964,18 +876,17 @@ var Observability = class {
|
|
|
964
876
|
options: this._errorReportingOptions
|
|
965
877
|
}, {
|
|
966
878
|
F: __dxlog_file3,
|
|
967
|
-
L:
|
|
879
|
+
L: 518,
|
|
968
880
|
S: this,
|
|
969
881
|
C: (f, a) => f(...a)
|
|
970
882
|
});
|
|
971
|
-
|
|
883
|
+
this._sentryLogProcessor = new SentryLogProcessor();
|
|
972
884
|
init({
|
|
973
885
|
...this._errorReportingOptions,
|
|
974
886
|
destination: this._secrets.SENTRY_DESTINATION,
|
|
975
887
|
scrubFilenames: this._mode !== "full",
|
|
976
|
-
onError: (event) =>
|
|
888
|
+
onError: (event) => this._sentryLogProcessor.addLogBreadcrumbsTo(event)
|
|
977
889
|
});
|
|
978
|
-
import_log.log.runtimeConfig.processors.push(logProcessor.logProcessor);
|
|
979
890
|
this._tags.forEach((v, k) => {
|
|
980
891
|
if (v.scope === "all" || v.scope === "errors") {
|
|
981
892
|
setTag(k, v.value);
|
|
@@ -984,10 +895,65 @@ var Observability = class {
|
|
|
984
895
|
} else {
|
|
985
896
|
(0, import_log.log)("sentry disabled", void 0, {
|
|
986
897
|
F: __dxlog_file3,
|
|
987
|
-
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,
|
|
988
922
|
S: this,
|
|
989
923
|
C: (f, a) => f(...a)
|
|
990
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
|
+
});
|
|
991
957
|
}
|
|
992
958
|
}
|
|
993
959
|
/**
|
|
@@ -1026,4 +992,4 @@ var Observability = class {
|
|
|
1026
992
|
storeObservabilityDisabled,
|
|
1027
993
|
storeObservabilityGroup
|
|
1028
994
|
});
|
|
1029
|
-
//# sourceMappingURL=chunk-
|
|
995
|
+
//# sourceMappingURL=chunk-HBLKTDQE.cjs.map
|