@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
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
captureException,
|
|
3
|
-
captureMessage,
|
|
4
|
-
withScope
|
|
5
|
-
} from "./chunk-3LKCQYWD.mjs";
|
|
6
|
-
|
|
7
1
|
// packages/sdk/observability/src/observability.ts
|
|
8
2
|
import { Event, scheduleTaskInterval } from "@dxos/async";
|
|
9
3
|
import { Context } from "@dxos/context";
|
|
@@ -19,7 +13,9 @@ var cli_observability_secrets_default = {
|
|
|
19
13
|
TELEMETRY_API_KEY: "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
|
|
20
14
|
IPDATA_API_KEY: "73dfdecdf979c18f07d50cf841bbdd9e589f237256326ac8cca23786",
|
|
21
15
|
DATADOG_API_KEY: null,
|
|
22
|
-
DATADOG_APP_KEY: null
|
|
16
|
+
DATADOG_APP_KEY: null,
|
|
17
|
+
OTEL_ENDPOINT: null,
|
|
18
|
+
OTEL_AUTHORIZATION: null
|
|
23
19
|
};
|
|
24
20
|
|
|
25
21
|
// packages/sdk/observability/src/helpers/browser-observability.ts
|
|
@@ -90,7 +86,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
90
86
|
const release = `${namespace}@${config.get("runtime.app.build.version")}`;
|
|
91
87
|
const environment = config.get("runtime.app.env.DX_ENVIRONMENT");
|
|
92
88
|
const observabilityDisabled = await isObservabilityDisabled(namespace);
|
|
93
|
-
const { Observability: Observability2 } = await import("./observability-
|
|
89
|
+
const { Observability: Observability2 } = await import("./observability-MXAPN7J6.mjs");
|
|
94
90
|
const observability = new Observability2({
|
|
95
91
|
namespace,
|
|
96
92
|
release,
|
|
@@ -140,6 +136,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
140
136
|
}
|
|
141
137
|
};
|
|
142
138
|
await observability.initialize();
|
|
139
|
+
observability.startErrorLogs();
|
|
143
140
|
const ipData = await getIPData(config);
|
|
144
141
|
ipData && observability.addIPDataTelemetryTags(ipData);
|
|
145
142
|
if (typeof navigator !== "undefined" && navigator.storage?.estimate) {
|
|
@@ -151,7 +148,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
151
148
|
} catch (error) {
|
|
152
149
|
log.warn("Failed to run estimate()", error, {
|
|
153
150
|
F: __dxlog_file,
|
|
154
|
-
L:
|
|
151
|
+
L: 171,
|
|
155
152
|
S: void 0,
|
|
156
153
|
C: (f, a) => f(...a)
|
|
157
154
|
});
|
|
@@ -161,7 +158,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
161
158
|
} catch (err) {
|
|
162
159
|
log.error("Failed to initialize app observability", err, {
|
|
163
160
|
F: __dxlog_file,
|
|
164
|
-
L:
|
|
161
|
+
L: 176,
|
|
165
162
|
S: void 0,
|
|
166
163
|
C: (f, a) => f(...a)
|
|
167
164
|
});
|
|
@@ -385,129 +382,6 @@ var setupTelemetryListeners = (namespace, client, observability) => {
|
|
|
385
382
|
};
|
|
386
383
|
};
|
|
387
384
|
|
|
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
|
-
|
|
511
385
|
// packages/sdk/observability/src/observability.ts
|
|
512
386
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/observability.ts";
|
|
513
387
|
var SPACE_METRICS_MIN_INTERVAL = 1e3 * 60;
|
|
@@ -519,7 +393,7 @@ var Observability = class {
|
|
|
519
393
|
// TODO(nf): accept upstream context?
|
|
520
394
|
this._ctx = new Context(void 0, {
|
|
521
395
|
F: __dxlog_file3,
|
|
522
|
-
L:
|
|
396
|
+
L: 91
|
|
523
397
|
});
|
|
524
398
|
this._tags = /* @__PURE__ */ new Map();
|
|
525
399
|
this.addIPDataTelemetryTags = (ipData) => {
|
|
@@ -566,6 +440,8 @@ var Observability = class {
|
|
|
566
440
|
process.env.IPDATA_API_KEY && (mergedSecrets.IPDATA_API_KEY = process.env.IPDATA_API_KEY);
|
|
567
441
|
process.env.DATADOG_API_KEY && (mergedSecrets.DATADOG_API_KEY = process.env.DATADOG_API_KEY);
|
|
568
442
|
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);
|
|
569
445
|
return mergedSecrets;
|
|
570
446
|
} else {
|
|
571
447
|
log3("config", {
|
|
@@ -573,7 +449,7 @@ var Observability = class {
|
|
|
573
449
|
config
|
|
574
450
|
}, {
|
|
575
451
|
F: __dxlog_file3,
|
|
576
|
-
L:
|
|
452
|
+
L: 156,
|
|
577
453
|
S: this,
|
|
578
454
|
C: (f, a) => f(...a)
|
|
579
455
|
});
|
|
@@ -585,6 +461,8 @@ var Observability = class {
|
|
|
585
461
|
IPDATA_API_KEY: config?.get("runtime.app.env.DX_IPDATA_API_KEY"),
|
|
586
462
|
DATADOG_API_KEY: config?.get("runtime.app.env.DX_DATADOG_API_KEY"),
|
|
587
463
|
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"),
|
|
588
466
|
...secrets
|
|
589
467
|
};
|
|
590
468
|
}
|
|
@@ -593,11 +471,14 @@ var Observability = class {
|
|
|
593
471
|
await this._initMetrics();
|
|
594
472
|
await this._initTelemetry();
|
|
595
473
|
await this._initErrorLogs();
|
|
474
|
+
await this._initTraces();
|
|
596
475
|
}
|
|
597
476
|
async close() {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
477
|
+
const closes = [];
|
|
478
|
+
this._telemetry && closes.push(this._telemetry.close());
|
|
479
|
+
this._otelMetrics && closes.push(this._otelMetrics.close());
|
|
480
|
+
this._otelLogs && closes.push(this._otelLogs.close());
|
|
481
|
+
await Promise.all(closes);
|
|
601
482
|
await this._ctx.dispose();
|
|
602
483
|
}
|
|
603
484
|
setMode(mode) {
|
|
@@ -630,7 +511,7 @@ var Observability = class {
|
|
|
630
511
|
idqr
|
|
631
512
|
}, {
|
|
632
513
|
F: __dxlog_file3,
|
|
633
|
-
L:
|
|
514
|
+
L: 226,
|
|
634
515
|
S: this,
|
|
635
516
|
C: (f, a) => f(...a)
|
|
636
517
|
});
|
|
@@ -646,7 +527,7 @@ var Observability = class {
|
|
|
646
527
|
device: dqr
|
|
647
528
|
}, {
|
|
648
529
|
F: __dxlog_file3,
|
|
649
|
-
L:
|
|
530
|
+
L: 236,
|
|
650
531
|
S: this,
|
|
651
532
|
C: (f, a) => f(...a)
|
|
652
533
|
});
|
|
@@ -654,7 +535,7 @@ var Observability = class {
|
|
|
654
535
|
}
|
|
655
536
|
invariant(dqr, "empty response from device service", {
|
|
656
537
|
F: __dxlog_file3,
|
|
657
|
-
L:
|
|
538
|
+
L: 239,
|
|
658
539
|
S: this,
|
|
659
540
|
A: [
|
|
660
541
|
"dqr",
|
|
@@ -667,7 +548,7 @@ var Observability = class {
|
|
|
667
548
|
device: dqr
|
|
668
549
|
}, {
|
|
669
550
|
F: __dxlog_file3,
|
|
670
|
-
L:
|
|
551
|
+
L: 243,
|
|
671
552
|
S: this,
|
|
672
553
|
C: (f, a) => f(...a)
|
|
673
554
|
});
|
|
@@ -700,7 +581,35 @@ var Observability = class {
|
|
|
700
581
|
} else {
|
|
701
582
|
log3("datadog disabled", void 0, {
|
|
702
583
|
F: __dxlog_file3,
|
|
703
|
-
L:
|
|
584
|
+
L: 275,
|
|
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,
|
|
704
613
|
S: this,
|
|
705
614
|
C: (f, a) => f(...a)
|
|
706
615
|
});
|
|
@@ -713,6 +622,7 @@ var Observability = class {
|
|
|
713
622
|
*/
|
|
714
623
|
gauge(name, value, extraTags) {
|
|
715
624
|
this._metrics?.gauge(name, value, extraTags);
|
|
625
|
+
this._otelMetrics?.gauge(name, value, extraTags);
|
|
716
626
|
}
|
|
717
627
|
// TODO(nf): Refactor into ObservabilityExtensions.
|
|
718
628
|
startNetworkMetrics(clientServices) {
|
|
@@ -723,7 +633,7 @@ var Observability = class {
|
|
|
723
633
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
724
634
|
log3("send signal metrics", void 0, {
|
|
725
635
|
F: __dxlog_file3,
|
|
726
|
-
L:
|
|
636
|
+
L: 319,
|
|
727
637
|
S: this,
|
|
728
638
|
C: (f, a) => f(...a)
|
|
729
639
|
});
|
|
@@ -775,7 +685,7 @@ var Observability = class {
|
|
|
775
685
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
776
686
|
log3("send space metrics", void 0, {
|
|
777
687
|
F: __dxlog_file3,
|
|
778
|
-
L:
|
|
688
|
+
L: 373,
|
|
779
689
|
S: this,
|
|
780
690
|
C: (f, a) => f(...a)
|
|
781
691
|
});
|
|
@@ -800,7 +710,7 @@ var Observability = class {
|
|
|
800
710
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
801
711
|
log3("send space telemetry", void 0, {
|
|
802
712
|
F: __dxlog_file3,
|
|
803
|
-
L:
|
|
713
|
+
L: 384,
|
|
804
714
|
S: this,
|
|
805
715
|
C: (f, a) => f(...a)
|
|
806
716
|
});
|
|
@@ -836,7 +746,7 @@ var Observability = class {
|
|
|
836
746
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
837
747
|
invariant(platform, "platform is required", {
|
|
838
748
|
F: __dxlog_file3,
|
|
839
|
-
L:
|
|
749
|
+
L: 421,
|
|
840
750
|
S: this,
|
|
841
751
|
A: [
|
|
842
752
|
"platform",
|
|
@@ -856,31 +766,25 @@ var Observability = class {
|
|
|
856
766
|
}
|
|
857
767
|
}
|
|
858
768
|
scheduleTaskInterval(this._ctx, async () => {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
769
|
+
if (client.services.constructor.name === "WorkerClientServices") {
|
|
770
|
+
const memory = window.performance.memory;
|
|
771
|
+
if (memory) {
|
|
772
|
+
this.gauge("dxos.client.runtime.heapTotal", memory.totalJSHeapSize);
|
|
773
|
+
this.gauge("dxos.client.runtime.heapUsed", memory.usedJSHeapSize);
|
|
774
|
+
this.gauge("dxos.client.runtime.heapSizeLimit", memory.jsHeapSizeLimit);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
865
777
|
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
|
-
});
|
|
874
778
|
if (platform2.memory) {
|
|
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);
|
|
779
|
+
this.gauge("dxos.client.services.runtime.rss", platform2.memory.rss);
|
|
780
|
+
this.gauge("dxos.client.services.runtime.heapTotal", platform2.memory.heapTotal);
|
|
781
|
+
this.gauge("dxos.client.services.runtime.heapUsed", platform2.memory.heapUsed);
|
|
878
782
|
}
|
|
879
783
|
}).catch((error) => log3("platform error", {
|
|
880
784
|
error
|
|
881
785
|
}, {
|
|
882
786
|
F: __dxlog_file3,
|
|
883
|
-
L:
|
|
787
|
+
L: 456,
|
|
884
788
|
S: this,
|
|
885
789
|
C: (f, a) => f(...a)
|
|
886
790
|
}));
|
|
@@ -905,7 +809,7 @@ var Observability = class {
|
|
|
905
809
|
} else {
|
|
906
810
|
log3("segment disabled", void 0, {
|
|
907
811
|
F: __dxlog_file3,
|
|
908
|
-
L:
|
|
812
|
+
L: 482,
|
|
909
813
|
S: this,
|
|
910
814
|
C: (f, a) => f(...a)
|
|
911
815
|
});
|
|
@@ -932,8 +836,9 @@ var Observability = class {
|
|
|
932
836
|
//
|
|
933
837
|
async _initErrorLogs() {
|
|
934
838
|
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
935
|
-
const { captureException
|
|
936
|
-
|
|
839
|
+
const { captureException, captureUserFeedback, init, setTag } = await import("./sentry/index.mjs");
|
|
840
|
+
const { SentryLogProcessor } = await import("./sentry-log-processor-DVUUOZ6G.mjs");
|
|
841
|
+
this._captureException = captureException;
|
|
937
842
|
this._captureUserFeedback = captureUserFeedback;
|
|
938
843
|
this._setTag = setTag;
|
|
939
844
|
log3.info("Initializing Sentry", {
|
|
@@ -941,18 +846,17 @@ var Observability = class {
|
|
|
941
846
|
options: this._errorReportingOptions
|
|
942
847
|
}, {
|
|
943
848
|
F: __dxlog_file3,
|
|
944
|
-
L:
|
|
849
|
+
L: 518,
|
|
945
850
|
S: this,
|
|
946
851
|
C: (f, a) => f(...a)
|
|
947
852
|
});
|
|
948
|
-
|
|
853
|
+
this._sentryLogProcessor = new SentryLogProcessor();
|
|
949
854
|
init({
|
|
950
855
|
...this._errorReportingOptions,
|
|
951
856
|
destination: this._secrets.SENTRY_DESTINATION,
|
|
952
857
|
scrubFilenames: this._mode !== "full",
|
|
953
|
-
onError: (event) =>
|
|
858
|
+
onError: (event) => this._sentryLogProcessor.addLogBreadcrumbsTo(event)
|
|
954
859
|
});
|
|
955
|
-
log3.runtimeConfig.processors.push(logProcessor.logProcessor);
|
|
956
860
|
this._tags.forEach((v, k) => {
|
|
957
861
|
if (v.scope === "all" || v.scope === "errors") {
|
|
958
862
|
setTag(k, v.value);
|
|
@@ -961,11 +865,66 @@ var Observability = class {
|
|
|
961
865
|
} else {
|
|
962
866
|
log3("sentry disabled", void 0, {
|
|
963
867
|
F: __dxlog_file3,
|
|
964
|
-
L:
|
|
868
|
+
L: 538,
|
|
965
869
|
S: this,
|
|
966
870
|
C: (f, a) => f(...a)
|
|
967
871
|
});
|
|
968
872
|
}
|
|
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
|
+
}
|
|
969
928
|
}
|
|
970
929
|
/**
|
|
971
930
|
* Manually capture an exception.
|
|
@@ -1003,4 +962,4 @@ export {
|
|
|
1003
962
|
mapSpaces,
|
|
1004
963
|
setupTelemetryListeners
|
|
1005
964
|
};
|
|
1006
|
-
//# sourceMappingURL=chunk-
|
|
965
|
+
//# sourceMappingURL=chunk-2CXA7PYK.mjs.map
|