@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
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
captureException,
|
|
3
|
+
captureMessage,
|
|
4
|
+
withScope
|
|
5
|
+
} from "./chunk-3LKCQYWD.mjs";
|
|
6
|
+
|
|
1
7
|
// packages/sdk/observability/src/observability.ts
|
|
2
8
|
import { Event, scheduleTaskInterval } from "@dxos/async";
|
|
3
9
|
import { Context } from "@dxos/context";
|
|
@@ -13,9 +19,7 @@ var cli_observability_secrets_default = {
|
|
|
13
19
|
TELEMETRY_API_KEY: "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
|
|
14
20
|
IPDATA_API_KEY: "73dfdecdf979c18f07d50cf841bbdd9e589f237256326ac8cca23786",
|
|
15
21
|
DATADOG_API_KEY: null,
|
|
16
|
-
DATADOG_APP_KEY: null
|
|
17
|
-
OTEL_ENDPOINT: null,
|
|
18
|
-
OTEL_AUTHORIZATION: null
|
|
22
|
+
DATADOG_APP_KEY: null
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
// packages/sdk/observability/src/helpers/browser-observability.ts
|
|
@@ -86,7 +90,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
86
90
|
const release = `${namespace}@${config.get("runtime.app.build.version")}`;
|
|
87
91
|
const environment = config.get("runtime.app.env.DX_ENVIRONMENT");
|
|
88
92
|
const observabilityDisabled = await isObservabilityDisabled(namespace);
|
|
89
|
-
const { Observability: Observability2 } = await import("./observability-
|
|
93
|
+
const { Observability: Observability2 } = await import("./observability-IFDZJFY2.mjs");
|
|
90
94
|
const observability = new Observability2({
|
|
91
95
|
namespace,
|
|
92
96
|
release,
|
|
@@ -136,7 +140,6 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
136
140
|
}
|
|
137
141
|
};
|
|
138
142
|
await observability.initialize();
|
|
139
|
-
observability.startErrorLogs();
|
|
140
143
|
const ipData = await getIPData(config);
|
|
141
144
|
ipData && observability.addIPDataTelemetryTags(ipData);
|
|
142
145
|
if (typeof navigator !== "undefined" && navigator.storage?.estimate) {
|
|
@@ -148,7 +151,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
148
151
|
} catch (error) {
|
|
149
152
|
log.warn("Failed to run estimate()", error, {
|
|
150
153
|
F: __dxlog_file,
|
|
151
|
-
L:
|
|
154
|
+
L: 170,
|
|
152
155
|
S: void 0,
|
|
153
156
|
C: (f, a) => f(...a)
|
|
154
157
|
});
|
|
@@ -158,7 +161,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
158
161
|
} catch (err) {
|
|
159
162
|
log.error("Failed to initialize app observability", err, {
|
|
160
163
|
F: __dxlog_file,
|
|
161
|
-
L:
|
|
164
|
+
L: 175,
|
|
162
165
|
S: void 0,
|
|
163
166
|
C: (f, a) => f(...a)
|
|
164
167
|
});
|
|
@@ -382,6 +385,129 @@ var setupTelemetryListeners = (namespace, client, observability) => {
|
|
|
382
385
|
};
|
|
383
386
|
};
|
|
384
387
|
|
|
388
|
+
// packages/sdk/observability/src/sentry/sentry-log-processor.ts
|
|
389
|
+
import { InvariantViolation } from "@dxos/invariant";
|
|
390
|
+
import { LogLevel, shouldLog } from "@dxos/log";
|
|
391
|
+
import { CircularBuffer, getDebugName } from "@dxos/util";
|
|
392
|
+
var MAX_LOG_BREADCRUMBS = 80;
|
|
393
|
+
var SentryLogProcessor = class {
|
|
394
|
+
constructor() {
|
|
395
|
+
this._breadcrumbs = new CircularBuffer(MAX_LOG_BREADCRUMBS);
|
|
396
|
+
this.logProcessor = (config, entry) => {
|
|
397
|
+
const { level, meta, error } = entry;
|
|
398
|
+
if (!shouldLog(entry, config.captureFilters) || meta?.S?.remoteSessionId) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (entry.level !== LogLevel.WARN && entry.level !== LogLevel.ERROR) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
withScope((scope) => {
|
|
405
|
+
const severity = convertLevel(level);
|
|
406
|
+
scope.setLevel(severity);
|
|
407
|
+
scope.setContext("dxoslog", entry.context ?? null);
|
|
408
|
+
if (meta) {
|
|
409
|
+
scope.setTag("transaction", `${getRelativeFilename(meta.F)}:${meta.L}`);
|
|
410
|
+
if (meta.S?.hostSessionId) {
|
|
411
|
+
scope.setTags({
|
|
412
|
+
service_host_issue: true,
|
|
413
|
+
service_host_session: meta.S?.hostSessionId
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (!Number.isNaN(meta.S?.uptimeSeconds)) {
|
|
417
|
+
scope.setExtra("uptime_seconds", meta.S?.uptimeSeconds);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const extendedMessage = formatMessageForSentry(entry);
|
|
421
|
+
let capturedError = error;
|
|
422
|
+
if (capturedError == null && entry.level === LogLevel.ERROR) {
|
|
423
|
+
capturedError = Object.values(entry.context ?? {}).find((v) => v instanceof Error);
|
|
424
|
+
}
|
|
425
|
+
if (capturedError) {
|
|
426
|
+
if (capturedError instanceof InvariantViolation) {
|
|
427
|
+
scope.setExtra("invariant_violation", true);
|
|
428
|
+
}
|
|
429
|
+
const isMessageDifferentFromStackTrace = error == null;
|
|
430
|
+
if (isMessageDifferentFromStackTrace) {
|
|
431
|
+
scope.setExtra("message", extendedMessage);
|
|
432
|
+
}
|
|
433
|
+
const eventId2 = captureException(capturedError);
|
|
434
|
+
this._addBreadcrumb(eventId2, extendedMessage, severity, entry.context);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
scope.setFingerprint([
|
|
438
|
+
entry.message
|
|
439
|
+
]);
|
|
440
|
+
const eventId = captureMessage(extendedMessage);
|
|
441
|
+
this._addBreadcrumb(eventId, extendedMessage, severity, entry.context);
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
addLogBreadcrumbsTo(event) {
|
|
446
|
+
event.breadcrumbs ??= [];
|
|
447
|
+
for (const breadcrumb of this._breadcrumbs) {
|
|
448
|
+
event.breadcrumbs.push(breadcrumb);
|
|
449
|
+
}
|
|
450
|
+
event.breadcrumbs.sort((b1, b2) => {
|
|
451
|
+
if (b1.timestamp === void 0 || b2.timestamp === void 0) {
|
|
452
|
+
return b1.timestamp === b2.timestamp ? 0 : b1.timestamp === void 0 ? -1 : 1;
|
|
453
|
+
}
|
|
454
|
+
return b1.timestamp - b2.timestamp;
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
_addBreadcrumb(eventId, message, severity, context) {
|
|
458
|
+
const breadcrumb = {
|
|
459
|
+
type: "console",
|
|
460
|
+
level: severity,
|
|
461
|
+
event_id: eventId,
|
|
462
|
+
category: "log",
|
|
463
|
+
message,
|
|
464
|
+
data: context,
|
|
465
|
+
timestamp: Math.floor(Date.now() / 1e3)
|
|
466
|
+
};
|
|
467
|
+
const lastRecorded = this._breadcrumbs.getLast();
|
|
468
|
+
if (lastRecorded && lastRecorded.message === breadcrumb.message) {
|
|
469
|
+
const firstBreadcrumbData = lastRecorded.data?.firstBreadcrumbData ?? lastRecorded.data ?? {};
|
|
470
|
+
const mergedBreadcrumbCount = Number.isNaN(lastRecorded.data?.mergedBreadcrumbCount) ? 1 : Number(lastRecorded.data?.mergedBreadcrumbCount);
|
|
471
|
+
lastRecorded.data = {
|
|
472
|
+
mergedBreadcrumbCount: mergedBreadcrumbCount + 1,
|
|
473
|
+
firstBreadcrumbData,
|
|
474
|
+
lastBreadcrumbData: breadcrumb.data
|
|
475
|
+
};
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this._breadcrumbs.push(breadcrumb);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
var formatMessageForSentry = (entry) => {
|
|
482
|
+
let scopePrefix;
|
|
483
|
+
if (entry.meta?.S) {
|
|
484
|
+
const scope = entry.meta?.S;
|
|
485
|
+
scopePrefix = scope.name || getDebugName(scope);
|
|
486
|
+
}
|
|
487
|
+
if (scopePrefix == null) {
|
|
488
|
+
return entry.message;
|
|
489
|
+
}
|
|
490
|
+
const workerPrefix = entry.meta?.S?.hostSessionId ? "[worker] " : "";
|
|
491
|
+
return `${workerPrefix}${scopePrefix} ${entry.message}`;
|
|
492
|
+
};
|
|
493
|
+
var convertLevel = (level) => {
|
|
494
|
+
if (level === LogLevel.TRACE) {
|
|
495
|
+
return "debug";
|
|
496
|
+
}
|
|
497
|
+
if (level === LogLevel.WARN) {
|
|
498
|
+
return "warning";
|
|
499
|
+
}
|
|
500
|
+
return LogLevel[level].toLowerCase();
|
|
501
|
+
};
|
|
502
|
+
var getRelativeFilename = (filename) => {
|
|
503
|
+
const match = filename.match(/.+\/(packages\/.+\/.+)/);
|
|
504
|
+
if (match) {
|
|
505
|
+
const [, filePath] = match;
|
|
506
|
+
return filePath;
|
|
507
|
+
}
|
|
508
|
+
return filename;
|
|
509
|
+
};
|
|
510
|
+
|
|
385
511
|
// packages/sdk/observability/src/observability.ts
|
|
386
512
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
387
513
|
var SPACE_METRICS_MIN_INTERVAL = 1e3 * 60;
|
|
@@ -393,7 +519,7 @@ var Observability = class {
|
|
|
393
519
|
// TODO(nf): accept upstream context?
|
|
394
520
|
this._ctx = new Context(void 0, {
|
|
395
521
|
F: __dxlog_file3,
|
|
396
|
-
L:
|
|
522
|
+
L: 84
|
|
397
523
|
});
|
|
398
524
|
this._tags = /* @__PURE__ */ new Map();
|
|
399
525
|
this.addIPDataTelemetryTags = (ipData) => {
|
|
@@ -440,8 +566,6 @@ var Observability = class {
|
|
|
440
566
|
process.env.IPDATA_API_KEY && (mergedSecrets.IPDATA_API_KEY = process.env.IPDATA_API_KEY);
|
|
441
567
|
process.env.DATADOG_API_KEY && (mergedSecrets.DATADOG_API_KEY = process.env.DATADOG_API_KEY);
|
|
442
568
|
process.env.DATADOG_APP_KEY && (mergedSecrets.DATADOG_APP_KEY = process.env.DATADOG_APP_KEY);
|
|
443
|
-
process.env.DX_OTEL_ENDPOINT && (mergedSecrets.OTEL_ENDPOINT = process.env.DX_OTEL_ENDPOINT);
|
|
444
|
-
process.env.DX_OTEL_AUTHORIZATION && (mergedSecrets.OTEL_AUTHORIZATION = process.env.DX_OTEL_AUTHORIZATION);
|
|
445
569
|
return mergedSecrets;
|
|
446
570
|
} else {
|
|
447
571
|
log3("config", {
|
|
@@ -449,7 +573,7 @@ var Observability = class {
|
|
|
449
573
|
config
|
|
450
574
|
}, {
|
|
451
575
|
F: __dxlog_file3,
|
|
452
|
-
L:
|
|
576
|
+
L: 146,
|
|
453
577
|
S: this,
|
|
454
578
|
C: (f, a) => f(...a)
|
|
455
579
|
});
|
|
@@ -461,8 +585,6 @@ var Observability = class {
|
|
|
461
585
|
IPDATA_API_KEY: config?.get("runtime.app.env.DX_IPDATA_API_KEY"),
|
|
462
586
|
DATADOG_API_KEY: config?.get("runtime.app.env.DX_DATADOG_API_KEY"),
|
|
463
587
|
DATADOG_APP_KEY: config?.get("runtime.app.env.DX_DATADOG_APP_KEY"),
|
|
464
|
-
OTEL_ENDPOINT: config?.get("runtime.app.env.DX_OTEL_ENDPOINT"),
|
|
465
|
-
OTEL_AUTHORIZATION: config?.get("runtime.app.env.DX_OTEL_AUTHORIZATION"),
|
|
466
588
|
...secrets
|
|
467
589
|
};
|
|
468
590
|
}
|
|
@@ -471,14 +593,11 @@ var Observability = class {
|
|
|
471
593
|
await this._initMetrics();
|
|
472
594
|
await this._initTelemetry();
|
|
473
595
|
await this._initErrorLogs();
|
|
474
|
-
await this._initTraces();
|
|
475
596
|
}
|
|
476
597
|
async close() {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
this._otelLogs && closes.push(this._otelLogs.close());
|
|
481
|
-
await Promise.all(closes);
|
|
598
|
+
if (this._telemetry) {
|
|
599
|
+
await this._telemetry.close();
|
|
600
|
+
}
|
|
482
601
|
await this._ctx.dispose();
|
|
483
602
|
}
|
|
484
603
|
setMode(mode) {
|
|
@@ -511,7 +630,7 @@ var Observability = class {
|
|
|
511
630
|
idqr
|
|
512
631
|
}, {
|
|
513
632
|
F: __dxlog_file3,
|
|
514
|
-
L:
|
|
633
|
+
L: 210,
|
|
515
634
|
S: this,
|
|
516
635
|
C: (f, a) => f(...a)
|
|
517
636
|
});
|
|
@@ -527,7 +646,7 @@ var Observability = class {
|
|
|
527
646
|
device: dqr
|
|
528
647
|
}, {
|
|
529
648
|
F: __dxlog_file3,
|
|
530
|
-
L:
|
|
649
|
+
L: 220,
|
|
531
650
|
S: this,
|
|
532
651
|
C: (f, a) => f(...a)
|
|
533
652
|
});
|
|
@@ -535,7 +654,7 @@ var Observability = class {
|
|
|
535
654
|
}
|
|
536
655
|
invariant(dqr, "empty response from device service", {
|
|
537
656
|
F: __dxlog_file3,
|
|
538
|
-
L:
|
|
657
|
+
L: 223,
|
|
539
658
|
S: this,
|
|
540
659
|
A: [
|
|
541
660
|
"dqr",
|
|
@@ -548,7 +667,7 @@ var Observability = class {
|
|
|
548
667
|
device: dqr
|
|
549
668
|
}, {
|
|
550
669
|
F: __dxlog_file3,
|
|
551
|
-
L:
|
|
670
|
+
L: 227,
|
|
552
671
|
S: this,
|
|
553
672
|
C: (f, a) => f(...a)
|
|
554
673
|
});
|
|
@@ -581,35 +700,7 @@ var Observability = class {
|
|
|
581
700
|
} else {
|
|
582
701
|
log3("datadog disabled", void 0, {
|
|
583
702
|
F: __dxlog_file3,
|
|
584
|
-
L:
|
|
585
|
-
S: this,
|
|
586
|
-
C: (f, a) => f(...a)
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
if (this.enabled && this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION) {
|
|
590
|
-
const { OtelMetrics } = await import("./otel-BUKBDMAL.mjs");
|
|
591
|
-
this._otelMetrics = new OtelMetrics({
|
|
592
|
-
endpoint: this._secrets.OTEL_ENDPOINT,
|
|
593
|
-
authorizationHeader: this._secrets.OTEL_AUTHORIZATION,
|
|
594
|
-
serviceName: this._namespace,
|
|
595
|
-
serviceVersion: this.getTag("release")?.value ?? "0.0.0",
|
|
596
|
-
getTags: () => Object.fromEntries(Array.from(this._tags).filter(([key, value]) => {
|
|
597
|
-
return value.scope === "all" || value.scope === "metrics";
|
|
598
|
-
}).map(([key, value]) => [
|
|
599
|
-
key,
|
|
600
|
-
value.value
|
|
601
|
-
]))
|
|
602
|
-
});
|
|
603
|
-
log3("otel metrics enabled", void 0, {
|
|
604
|
-
F: __dxlog_file3,
|
|
605
|
-
L: 294,
|
|
606
|
-
S: this,
|
|
607
|
-
C: (f, a) => f(...a)
|
|
608
|
-
});
|
|
609
|
-
} else {
|
|
610
|
-
log3("otel metrics disabled", void 0, {
|
|
611
|
-
F: __dxlog_file3,
|
|
612
|
-
L: 296,
|
|
703
|
+
L: 259,
|
|
613
704
|
S: this,
|
|
614
705
|
C: (f, a) => f(...a)
|
|
615
706
|
});
|
|
@@ -622,7 +713,6 @@ var Observability = class {
|
|
|
622
713
|
*/
|
|
623
714
|
gauge(name, value, extraTags) {
|
|
624
715
|
this._metrics?.gauge(name, value, extraTags);
|
|
625
|
-
this._otelMetrics?.gauge(name, value, extraTags);
|
|
626
716
|
}
|
|
627
717
|
// TODO(nf): Refactor into ObservabilityExtensions.
|
|
628
718
|
startNetworkMetrics(clientServices) {
|
|
@@ -633,7 +723,7 @@ var Observability = class {
|
|
|
633
723
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
634
724
|
log3("send signal metrics", void 0, {
|
|
635
725
|
F: __dxlog_file3,
|
|
636
|
-
L:
|
|
726
|
+
L: 281,
|
|
637
727
|
S: this,
|
|
638
728
|
C: (f, a) => f(...a)
|
|
639
729
|
});
|
|
@@ -685,7 +775,7 @@ var Observability = class {
|
|
|
685
775
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
686
776
|
log3("send space metrics", void 0, {
|
|
687
777
|
F: __dxlog_file3,
|
|
688
|
-
L:
|
|
778
|
+
L: 335,
|
|
689
779
|
S: this,
|
|
690
780
|
C: (f, a) => f(...a)
|
|
691
781
|
});
|
|
@@ -710,7 +800,7 @@ var Observability = class {
|
|
|
710
800
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
711
801
|
log3("send space telemetry", void 0, {
|
|
712
802
|
F: __dxlog_file3,
|
|
713
|
-
L:
|
|
803
|
+
L: 346,
|
|
714
804
|
S: this,
|
|
715
805
|
C: (f, a) => f(...a)
|
|
716
806
|
});
|
|
@@ -746,7 +836,7 @@ var Observability = class {
|
|
|
746
836
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
747
837
|
invariant(platform, "platform is required", {
|
|
748
838
|
F: __dxlog_file3,
|
|
749
|
-
L:
|
|
839
|
+
L: 383,
|
|
750
840
|
S: this,
|
|
751
841
|
A: [
|
|
752
842
|
"platform",
|
|
@@ -766,25 +856,31 @@ var Observability = class {
|
|
|
766
856
|
}
|
|
767
857
|
}
|
|
768
858
|
scheduleTaskInterval(this._ctx, async () => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
}
|
|
859
|
+
log3("platform", void 0, {
|
|
860
|
+
F: __dxlog_file3,
|
|
861
|
+
L: 402,
|
|
862
|
+
S: this,
|
|
863
|
+
C: (f, a) => f(...a)
|
|
864
|
+
});
|
|
777
865
|
client.services.services.SystemService?.getPlatform().then((platform2) => {
|
|
866
|
+
log3("platform", {
|
|
867
|
+
platform: platform2
|
|
868
|
+
}, {
|
|
869
|
+
F: __dxlog_file3,
|
|
870
|
+
L: 405,
|
|
871
|
+
S: this,
|
|
872
|
+
C: (f, a) => f(...a)
|
|
873
|
+
});
|
|
778
874
|
if (platform2.memory) {
|
|
779
|
-
this.gauge("dxos.client.
|
|
780
|
-
this.gauge("dxos.client.
|
|
781
|
-
this.gauge("dxos.client.
|
|
875
|
+
this.gauge("dxos.client.runtime.rss", platform2.memory.rss);
|
|
876
|
+
this.gauge("dxos.client.runtime.heapTotal", platform2.memory.heapTotal);
|
|
877
|
+
this.gauge("dxos.client.runtime.heapUsed", platform2.memory.heapUsed);
|
|
782
878
|
}
|
|
783
879
|
}).catch((error) => log3("platform error", {
|
|
784
880
|
error
|
|
785
881
|
}, {
|
|
786
882
|
F: __dxlog_file3,
|
|
787
|
-
L:
|
|
883
|
+
L: 412,
|
|
788
884
|
S: this,
|
|
789
885
|
C: (f, a) => f(...a)
|
|
790
886
|
}));
|
|
@@ -809,7 +905,7 @@ var Observability = class {
|
|
|
809
905
|
} else {
|
|
810
906
|
log3("segment disabled", void 0, {
|
|
811
907
|
F: __dxlog_file3,
|
|
812
|
-
L:
|
|
908
|
+
L: 438,
|
|
813
909
|
S: this,
|
|
814
910
|
C: (f, a) => f(...a)
|
|
815
911
|
});
|
|
@@ -836,9 +932,8 @@ var Observability = class {
|
|
|
836
932
|
//
|
|
837
933
|
async _initErrorLogs() {
|
|
838
934
|
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
839
|
-
const { captureException, captureUserFeedback, init, setTag } = await import("./sentry/index.mjs");
|
|
840
|
-
|
|
841
|
-
this._captureException = captureException;
|
|
935
|
+
const { captureException: captureException2, captureUserFeedback, init, setTag } = await import("./sentry/index.mjs");
|
|
936
|
+
this._captureException = captureException2;
|
|
842
937
|
this._captureUserFeedback = captureUserFeedback;
|
|
843
938
|
this._setTag = setTag;
|
|
844
939
|
log3.info("Initializing Sentry", {
|
|
@@ -846,17 +941,18 @@ var Observability = class {
|
|
|
846
941
|
options: this._errorReportingOptions
|
|
847
942
|
}, {
|
|
848
943
|
F: __dxlog_file3,
|
|
849
|
-
L:
|
|
944
|
+
L: 473,
|
|
850
945
|
S: this,
|
|
851
946
|
C: (f, a) => f(...a)
|
|
852
947
|
});
|
|
853
|
-
|
|
948
|
+
const logProcessor = new SentryLogProcessor();
|
|
854
949
|
init({
|
|
855
950
|
...this._errorReportingOptions,
|
|
856
951
|
destination: this._secrets.SENTRY_DESTINATION,
|
|
857
952
|
scrubFilenames: this._mode !== "full",
|
|
858
|
-
onError: (event) =>
|
|
953
|
+
onError: (event) => logProcessor.addLogBreadcrumbsTo(event)
|
|
859
954
|
});
|
|
955
|
+
log3.runtimeConfig.processors.push(logProcessor.logProcessor);
|
|
860
956
|
this._tags.forEach((v, k) => {
|
|
861
957
|
if (v.scope === "all" || v.scope === "errors") {
|
|
862
958
|
setTag(k, v.value);
|
|
@@ -865,66 +961,11 @@ var Observability = class {
|
|
|
865
961
|
} else {
|
|
866
962
|
log3("sentry disabled", void 0, {
|
|
867
963
|
F: __dxlog_file3,
|
|
868
|
-
L:
|
|
964
|
+
L: 496,
|
|
869
965
|
S: this,
|
|
870
966
|
C: (f, a) => f(...a)
|
|
871
967
|
});
|
|
872
968
|
}
|
|
873
|
-
if (this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION && this._mode !== "disabled") {
|
|
874
|
-
const { OtelLogs } = await import("./otel-BUKBDMAL.mjs");
|
|
875
|
-
this._otelLogs = new OtelLogs({
|
|
876
|
-
endpoint: this._secrets.OTEL_ENDPOINT,
|
|
877
|
-
authorizationHeader: this._secrets.OTEL_AUTHORIZATION,
|
|
878
|
-
serviceName: this._namespace,
|
|
879
|
-
serviceVersion: this.getTag("release")?.value ?? "0.0.0",
|
|
880
|
-
getTags: () => Object.fromEntries(Array.from(this._tags).filter(([key, value]) => {
|
|
881
|
-
return value.scope === "all" || value.scope === "errors";
|
|
882
|
-
}).map(([key, value]) => [
|
|
883
|
-
key,
|
|
884
|
-
value.value
|
|
885
|
-
]))
|
|
886
|
-
});
|
|
887
|
-
log3("otel logs enabled", {
|
|
888
|
-
namespace: this._namespace
|
|
889
|
-
}, {
|
|
890
|
-
F: __dxlog_file3,
|
|
891
|
-
L: 557,
|
|
892
|
-
S: this,
|
|
893
|
-
C: (f, a) => f(...a)
|
|
894
|
-
});
|
|
895
|
-
} else {
|
|
896
|
-
log3("otel logs disabled", void 0, {
|
|
897
|
-
F: __dxlog_file3,
|
|
898
|
-
L: 559,
|
|
899
|
-
S: this,
|
|
900
|
-
C: (f, a) => f(...a)
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
startErrorLogs() {
|
|
905
|
-
this._sentryLogProcessor && log3.runtimeConfig.processors.push(this._sentryLogProcessor.logProcessor);
|
|
906
|
-
this._otelLogs && log3.runtimeConfig.processors.push(this._otelLogs.logProcessor);
|
|
907
|
-
}
|
|
908
|
-
startTraces() {
|
|
909
|
-
this._otelTraces && this._otelTraces.start();
|
|
910
|
-
}
|
|
911
|
-
// TODO(nf): refactor init based on providers and their capabilities
|
|
912
|
-
async _initTraces() {
|
|
913
|
-
if (this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION && this._mode !== "disabled") {
|
|
914
|
-
const { OtelTraces } = await import("./otel-BUKBDMAL.mjs");
|
|
915
|
-
this._otelTraces = new OtelTraces({
|
|
916
|
-
endpoint: this._secrets.OTEL_ENDPOINT,
|
|
917
|
-
authorizationHeader: this._secrets.OTEL_AUTHORIZATION,
|
|
918
|
-
serviceName: this._namespace,
|
|
919
|
-
serviceVersion: this.getTag("release")?.value ?? "0.0.0",
|
|
920
|
-
getTags: () => Object.fromEntries(Array.from(this._tags).filter(([key, value]) => {
|
|
921
|
-
return value.scope === "all" || value.scope === "metrics";
|
|
922
|
-
}).map(([key, value]) => [
|
|
923
|
-
key,
|
|
924
|
-
value.value
|
|
925
|
-
]))
|
|
926
|
-
});
|
|
927
|
-
}
|
|
928
969
|
}
|
|
929
970
|
/**
|
|
930
971
|
* Manually capture an exception.
|
|
@@ -962,4 +1003,4 @@ export {
|
|
|
962
1003
|
mapSpaces,
|
|
963
1004
|
setupTelemetryListeners
|
|
964
1005
|
};
|
|
965
|
-
//# sourceMappingURL=chunk-
|
|
1006
|
+
//# sourceMappingURL=chunk-7HCG6KYK.mjs.map
|