@dxos/observability 0.6.3-main.e6314a6 → 0.6.3-main.fe243fc
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-2CXA7PYK.mjs → chunk-7HCG6KYK.mjs} +174 -133
- package/dist/lib/browser/chunk-7HCG6KYK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/observability-IFDZJFY2.mjs +8 -0
- package/dist/lib/node/{chunk-HBLKTDQE.cjs → chunk-63FCWS3M.cjs} +170 -136
- package/dist/lib/node/chunk-63FCWS3M.cjs.map +7 -0
- package/dist/lib/node/index.cjs +16 -15
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{observability-4R6M4JMU.cjs → observability-W7TVZP2V.cjs} +7 -6
- package/dist/lib/node/observability-W7TVZP2V.cjs.map +7 -0
- package/dist/types/src/cli-observability-secrets.json +1 -3
- package/dist/types/src/helpers/browser-observability.d.ts.map +1 -1
- package/dist/types/src/helpers/browser-observability.js +0 -1
- package/dist/types/src/helpers/browser-observability.js.map +1 -1
- package/dist/types/src/observability.d.ts +0 -9
- package/dist/types/src/observability.d.ts.map +1 -1
- package/dist/types/src/observability.js +13 -90
- package/dist/types/src/observability.js.map +1 -1
- package/package.json +20 -35
- package/src/cli-observability-secrets.json +1 -3
- package/src/helpers/browser-observability.ts +0 -1
- package/src/observability.ts +14 -107
- package/dist/lib/browser/chunk-2CXA7PYK.mjs.map +0 -7
- package/dist/lib/browser/observability-MXAPN7J6.mjs +0 -7
- package/dist/lib/browser/otel-BUKBDMAL.mjs +0 -275
- package/dist/lib/browser/otel-BUKBDMAL.mjs.map +0 -7
- package/dist/lib/browser/sentry-log-processor-DVUUOZ6G.mjs +0 -132
- package/dist/lib/browser/sentry-log-processor-DVUUOZ6G.mjs.map +0 -7
- package/dist/lib/node/chunk-HBLKTDQE.cjs.map +0 -7
- package/dist/lib/node/observability-4R6M4JMU.cjs.map +0 -7
- package/dist/lib/node/otel-TSHMOAB4.cjs +0 -276
- package/dist/lib/node/otel-TSHMOAB4.cjs.map +0 -7
- package/dist/lib/node/sentry-log-processor-H6FUSKZI.cjs +0 -150
- package/dist/lib/node/sentry-log-processor-H6FUSKZI.cjs.map +0 -7
- package/dist/types/src/otel/index.d.ts +0 -5
- package/dist/types/src/otel/index.d.ts.map +0 -1
- package/dist/types/src/otel/index.js +0 -24
- package/dist/types/src/otel/index.js.map +0 -1
- package/dist/types/src/otel/logs.d.ts +0 -11
- package/dist/types/src/otel/logs.d.ts.map +0 -1
- package/dist/types/src/otel/logs.js +0 -72
- package/dist/types/src/otel/logs.js.map +0 -1
- package/dist/types/src/otel/metrics.d.ts +0 -14
- package/dist/types/src/otel/metrics.d.ts.map +0 -1
- package/dist/types/src/otel/metrics.js +0 -91
- package/dist/types/src/otel/metrics.js.map +0 -1
- package/dist/types/src/otel/otel.d.ts +0 -12
- package/dist/types/src/otel/otel.d.ts.map +0 -1
- package/dist/types/src/otel/otel.js +0 -15
- package/dist/types/src/otel/otel.js.map +0 -1
- package/dist/types/src/otel/traces-browser.d.ts +0 -8
- package/dist/types/src/otel/traces-browser.d.ts.map +0 -1
- package/dist/types/src/otel/traces-browser.js +0 -51
- package/dist/types/src/otel/traces-browser.js.map +0 -1
- package/dist/types/src/otel/traces.d.ts +0 -8
- package/dist/types/src/otel/traces.d.ts.map +0 -1
- package/dist/types/src/otel/traces.js +0 -44
- package/dist/types/src/otel/traces.js.map +0 -1
- package/src/otel/index.ts +0 -8
- package/src/otel/logs.ts +0 -86
- package/src/otel/metrics.ts +0 -111
- package/src/otel/otel.ts +0 -21
- package/src/otel/traces-browser.ts +0 -59
- package/src/otel/traces.ts +0 -57
- /package/dist/lib/browser/{observability-MXAPN7J6.mjs.map → observability-IFDZJFY2.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_63FCWS3M_exports = {};
|
|
30
|
+
__export(chunk_63FCWS3M_exports, {
|
|
31
31
|
OBSERVABILITY_DISABLED_KEY: () => OBSERVABILITY_DISABLED_KEY,
|
|
32
32
|
OBSERVABILITY_GROUP_KEY: () => OBSERVABILITY_GROUP_KEY,
|
|
33
33
|
Observability: () => Observability,
|
|
@@ -43,7 +43,8 @@ __export(chunk_HBLKTDQE_exports, {
|
|
|
43
43
|
storeObservabilityDisabled: () => storeObservabilityDisabled,
|
|
44
44
|
storeObservabilityGroup: () => storeObservabilityGroup
|
|
45
45
|
});
|
|
46
|
-
module.exports = __toCommonJS(
|
|
46
|
+
module.exports = __toCommonJS(chunk_63FCWS3M_exports);
|
|
47
|
+
var import_chunk_HKBUNAUG = require("./chunk-HKBUNAUG.cjs");
|
|
47
48
|
var import_async = require("@dxos/async");
|
|
48
49
|
var import_context = require("@dxos/context");
|
|
49
50
|
var import_invariant = require("@dxos/invariant");
|
|
@@ -59,14 +60,15 @@ var import_promises = require("node:fs/promises");
|
|
|
59
60
|
var import_node_path = require("node:path");
|
|
60
61
|
var import_uuid = require("uuid");
|
|
61
62
|
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");
|
|
62
66
|
var cli_observability_secrets_default = {
|
|
63
67
|
SENTRY_DESTINATION: "https://2647916221e643869965e78469479aa4@o4504012000067584.ingest.sentry.io/4504012027265029",
|
|
64
68
|
TELEMETRY_API_KEY: "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
|
|
65
69
|
IPDATA_API_KEY: "73dfdecdf979c18f07d50cf841bbdd9e589f237256326ac8cca23786",
|
|
66
70
|
DATADOG_API_KEY: null,
|
|
67
|
-
DATADOG_APP_KEY: null
|
|
68
|
-
OTEL_ENDPOINT: null,
|
|
69
|
-
OTEL_AUTHORIZATION: null
|
|
71
|
+
DATADOG_APP_KEY: null
|
|
70
72
|
};
|
|
71
73
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/helpers/browser-observability.ts";
|
|
72
74
|
var OBSERVABILITY_DISABLED_KEY = "observability-disabled";
|
|
@@ -133,7 +135,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
133
135
|
const release = `${namespace}@${config.get("runtime.app.build.version")}`;
|
|
134
136
|
const environment = config.get("runtime.app.env.DX_ENVIRONMENT");
|
|
135
137
|
const observabilityDisabled = await isObservabilityDisabled(namespace);
|
|
136
|
-
const { Observability: Observability2 } = await import("./observability-
|
|
138
|
+
const { Observability: Observability2 } = await import("./observability-W7TVZP2V.cjs");
|
|
137
139
|
const observability = new Observability2({
|
|
138
140
|
namespace,
|
|
139
141
|
release,
|
|
@@ -183,7 +185,6 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
183
185
|
}
|
|
184
186
|
};
|
|
185
187
|
await observability.initialize();
|
|
186
|
-
observability.startErrorLogs();
|
|
187
188
|
const ipData = await getIPData(config);
|
|
188
189
|
ipData && observability.addIPDataTelemetryTags(ipData);
|
|
189
190
|
if (typeof navigator !== "undefined" && navigator.storage?.estimate) {
|
|
@@ -195,7 +196,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
195
196
|
} catch (error) {
|
|
196
197
|
import_log2.log.warn("Failed to run estimate()", error, {
|
|
197
198
|
F: __dxlog_file,
|
|
198
|
-
L:
|
|
199
|
+
L: 170,
|
|
199
200
|
S: void 0,
|
|
200
201
|
C: (f, a) => f(...a)
|
|
201
202
|
});
|
|
@@ -205,7 +206,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
205
206
|
} catch (err) {
|
|
206
207
|
import_log2.log.error("Failed to initialize app observability", err, {
|
|
207
208
|
F: __dxlog_file,
|
|
208
|
-
L:
|
|
209
|
+
L: 175,
|
|
209
210
|
S: void 0,
|
|
210
211
|
C: (f, a) => f(...a)
|
|
211
212
|
});
|
|
@@ -414,6 +415,124 @@ var setupTelemetryListeners = (namespace, client, observability) => {
|
|
|
414
415
|
window.removeEventListener("error", errorCallback);
|
|
415
416
|
};
|
|
416
417
|
};
|
|
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
|
+
};
|
|
417
536
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
418
537
|
var SPACE_METRICS_MIN_INTERVAL = 1e3 * 60;
|
|
419
538
|
var SPACE_TELEMETRY_MIN_INTERVAL = 1e3 * 60 * 60;
|
|
@@ -423,7 +542,7 @@ var Observability = class {
|
|
|
423
542
|
constructor({ namespace, environment, release, config, secrets, group, mode, telemetry, errorLog }) {
|
|
424
543
|
this._ctx = new import_context.Context(void 0, {
|
|
425
544
|
F: __dxlog_file3,
|
|
426
|
-
L:
|
|
545
|
+
L: 84
|
|
427
546
|
});
|
|
428
547
|
this._tags = /* @__PURE__ */ new Map();
|
|
429
548
|
this.addIPDataTelemetryTags = (ipData) => {
|
|
@@ -470,8 +589,6 @@ var Observability = class {
|
|
|
470
589
|
process.env.IPDATA_API_KEY && (mergedSecrets.IPDATA_API_KEY = process.env.IPDATA_API_KEY);
|
|
471
590
|
process.env.DATADOG_API_KEY && (mergedSecrets.DATADOG_API_KEY = process.env.DATADOG_API_KEY);
|
|
472
591
|
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);
|
|
475
592
|
return mergedSecrets;
|
|
476
593
|
} else {
|
|
477
594
|
(0, import_log.log)("config", {
|
|
@@ -479,7 +596,7 @@ var Observability = class {
|
|
|
479
596
|
config
|
|
480
597
|
}, {
|
|
481
598
|
F: __dxlog_file3,
|
|
482
|
-
L:
|
|
599
|
+
L: 146,
|
|
483
600
|
S: this,
|
|
484
601
|
C: (f, a) => f(...a)
|
|
485
602
|
});
|
|
@@ -491,8 +608,6 @@ var Observability = class {
|
|
|
491
608
|
IPDATA_API_KEY: config?.get("runtime.app.env.DX_IPDATA_API_KEY"),
|
|
492
609
|
DATADOG_API_KEY: config?.get("runtime.app.env.DX_DATADOG_API_KEY"),
|
|
493
610
|
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"),
|
|
496
611
|
...secrets
|
|
497
612
|
};
|
|
498
613
|
}
|
|
@@ -501,14 +616,11 @@ var Observability = class {
|
|
|
501
616
|
await this._initMetrics();
|
|
502
617
|
await this._initTelemetry();
|
|
503
618
|
await this._initErrorLogs();
|
|
504
|
-
await this._initTraces();
|
|
505
619
|
}
|
|
506
620
|
async close() {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
this._otelLogs && closes.push(this._otelLogs.close());
|
|
511
|
-
await Promise.all(closes);
|
|
621
|
+
if (this._telemetry) {
|
|
622
|
+
await this._telemetry.close();
|
|
623
|
+
}
|
|
512
624
|
await this._ctx.dispose();
|
|
513
625
|
}
|
|
514
626
|
setMode(mode) {
|
|
@@ -541,7 +653,7 @@ var Observability = class {
|
|
|
541
653
|
idqr
|
|
542
654
|
}, {
|
|
543
655
|
F: __dxlog_file3,
|
|
544
|
-
L:
|
|
656
|
+
L: 210,
|
|
545
657
|
S: this,
|
|
546
658
|
C: (f, a) => f(...a)
|
|
547
659
|
});
|
|
@@ -557,7 +669,7 @@ var Observability = class {
|
|
|
557
669
|
device: dqr
|
|
558
670
|
}, {
|
|
559
671
|
F: __dxlog_file3,
|
|
560
|
-
L:
|
|
672
|
+
L: 220,
|
|
561
673
|
S: this,
|
|
562
674
|
C: (f, a) => f(...a)
|
|
563
675
|
});
|
|
@@ -565,7 +677,7 @@ var Observability = class {
|
|
|
565
677
|
}
|
|
566
678
|
(0, import_invariant.invariant)(dqr, "empty response from device service", {
|
|
567
679
|
F: __dxlog_file3,
|
|
568
|
-
L:
|
|
680
|
+
L: 223,
|
|
569
681
|
S: this,
|
|
570
682
|
A: [
|
|
571
683
|
"dqr",
|
|
@@ -578,7 +690,7 @@ var Observability = class {
|
|
|
578
690
|
device: dqr
|
|
579
691
|
}, {
|
|
580
692
|
F: __dxlog_file3,
|
|
581
|
-
L:
|
|
693
|
+
L: 227,
|
|
582
694
|
S: this,
|
|
583
695
|
C: (f, a) => f(...a)
|
|
584
696
|
});
|
|
@@ -611,35 +723,7 @@ var Observability = class {
|
|
|
611
723
|
} else {
|
|
612
724
|
(0, import_log.log)("datadog disabled", void 0, {
|
|
613
725
|
F: __dxlog_file3,
|
|
614
|
-
L:
|
|
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,
|
|
726
|
+
L: 259,
|
|
643
727
|
S: this,
|
|
644
728
|
C: (f, a) => f(...a)
|
|
645
729
|
});
|
|
@@ -652,7 +736,6 @@ var Observability = class {
|
|
|
652
736
|
*/
|
|
653
737
|
gauge(name, value, extraTags) {
|
|
654
738
|
this._metrics?.gauge(name, value, extraTags);
|
|
655
|
-
this._otelMetrics?.gauge(name, value, extraTags);
|
|
656
739
|
}
|
|
657
740
|
// TODO(nf): Refactor into ObservabilityExtensions.
|
|
658
741
|
startNetworkMetrics(clientServices) {
|
|
@@ -663,7 +746,7 @@ var Observability = class {
|
|
|
663
746
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
664
747
|
(0, import_log.log)("send signal metrics", void 0, {
|
|
665
748
|
F: __dxlog_file3,
|
|
666
|
-
L:
|
|
749
|
+
L: 281,
|
|
667
750
|
S: this,
|
|
668
751
|
C: (f, a) => f(...a)
|
|
669
752
|
});
|
|
@@ -715,7 +798,7 @@ var Observability = class {
|
|
|
715
798
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
716
799
|
(0, import_log.log)("send space metrics", void 0, {
|
|
717
800
|
F: __dxlog_file3,
|
|
718
|
-
L:
|
|
801
|
+
L: 335,
|
|
719
802
|
S: this,
|
|
720
803
|
C: (f, a) => f(...a)
|
|
721
804
|
});
|
|
@@ -740,7 +823,7 @@ var Observability = class {
|
|
|
740
823
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
741
824
|
(0, import_log.log)("send space telemetry", void 0, {
|
|
742
825
|
F: __dxlog_file3,
|
|
743
|
-
L:
|
|
826
|
+
L: 346,
|
|
744
827
|
S: this,
|
|
745
828
|
C: (f, a) => f(...a)
|
|
746
829
|
});
|
|
@@ -776,7 +859,7 @@ var Observability = class {
|
|
|
776
859
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
777
860
|
(0, import_invariant.invariant)(platform, "platform is required", {
|
|
778
861
|
F: __dxlog_file3,
|
|
779
|
-
L:
|
|
862
|
+
L: 383,
|
|
780
863
|
S: this,
|
|
781
864
|
A: [
|
|
782
865
|
"platform",
|
|
@@ -796,25 +879,31 @@ var Observability = class {
|
|
|
796
879
|
}
|
|
797
880
|
}
|
|
798
881
|
(0, import_async.scheduleTaskInterval)(this._ctx, async () => {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
}
|
|
882
|
+
(0, import_log.log)("platform", void 0, {
|
|
883
|
+
F: __dxlog_file3,
|
|
884
|
+
L: 402,
|
|
885
|
+
S: this,
|
|
886
|
+
C: (f, a) => f(...a)
|
|
887
|
+
});
|
|
807
888
|
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
|
+
});
|
|
808
897
|
if (platform2.memory) {
|
|
809
|
-
this.gauge("dxos.client.
|
|
810
|
-
this.gauge("dxos.client.
|
|
811
|
-
this.gauge("dxos.client.
|
|
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);
|
|
812
901
|
}
|
|
813
902
|
}).catch((error) => (0, import_log.log)("platform error", {
|
|
814
903
|
error
|
|
815
904
|
}, {
|
|
816
905
|
F: __dxlog_file3,
|
|
817
|
-
L:
|
|
906
|
+
L: 412,
|
|
818
907
|
S: this,
|
|
819
908
|
C: (f, a) => f(...a)
|
|
820
909
|
}));
|
|
@@ -839,7 +928,7 @@ var Observability = class {
|
|
|
839
928
|
} else {
|
|
840
929
|
(0, import_log.log)("segment disabled", void 0, {
|
|
841
930
|
F: __dxlog_file3,
|
|
842
|
-
L:
|
|
931
|
+
L: 438,
|
|
843
932
|
S: this,
|
|
844
933
|
C: (f, a) => f(...a)
|
|
845
934
|
});
|
|
@@ -866,9 +955,8 @@ var Observability = class {
|
|
|
866
955
|
//
|
|
867
956
|
async _initErrorLogs() {
|
|
868
957
|
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
869
|
-
const { captureException, captureUserFeedback, init, setTag } = await import("./sentry/index.cjs");
|
|
870
|
-
|
|
871
|
-
this._captureException = captureException;
|
|
958
|
+
const { captureException: captureException2, captureUserFeedback, init, setTag } = await import("./sentry/index.cjs");
|
|
959
|
+
this._captureException = captureException2;
|
|
872
960
|
this._captureUserFeedback = captureUserFeedback;
|
|
873
961
|
this._setTag = setTag;
|
|
874
962
|
import_log.log.info("Initializing Sentry", {
|
|
@@ -876,17 +964,18 @@ var Observability = class {
|
|
|
876
964
|
options: this._errorReportingOptions
|
|
877
965
|
}, {
|
|
878
966
|
F: __dxlog_file3,
|
|
879
|
-
L:
|
|
967
|
+
L: 473,
|
|
880
968
|
S: this,
|
|
881
969
|
C: (f, a) => f(...a)
|
|
882
970
|
});
|
|
883
|
-
|
|
971
|
+
const logProcessor = new SentryLogProcessor();
|
|
884
972
|
init({
|
|
885
973
|
...this._errorReportingOptions,
|
|
886
974
|
destination: this._secrets.SENTRY_DESTINATION,
|
|
887
975
|
scrubFilenames: this._mode !== "full",
|
|
888
|
-
onError: (event) =>
|
|
976
|
+
onError: (event) => logProcessor.addLogBreadcrumbsTo(event)
|
|
889
977
|
});
|
|
978
|
+
import_log.log.runtimeConfig.processors.push(logProcessor.logProcessor);
|
|
890
979
|
this._tags.forEach((v, k) => {
|
|
891
980
|
if (v.scope === "all" || v.scope === "errors") {
|
|
892
981
|
setTag(k, v.value);
|
|
@@ -895,65 +984,10 @@ var Observability = class {
|
|
|
895
984
|
} else {
|
|
896
985
|
(0, import_log.log)("sentry disabled", void 0, {
|
|
897
986
|
F: __dxlog_file3,
|
|
898
|
-
L:
|
|
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,
|
|
987
|
+
L: 496,
|
|
922
988
|
S: this,
|
|
923
989
|
C: (f, a) => f(...a)
|
|
924
990
|
});
|
|
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
|
-
});
|
|
957
991
|
}
|
|
958
992
|
}
|
|
959
993
|
/**
|
|
@@ -992,4 +1026,4 @@ var Observability = class {
|
|
|
992
1026
|
storeObservabilityDisabled,
|
|
993
1027
|
storeObservabilityGroup
|
|
994
1028
|
});
|
|
995
|
-
//# sourceMappingURL=chunk-
|
|
1029
|
+
//# sourceMappingURL=chunk-63FCWS3M.cjs.map
|