@dxos/observability 0.8.1-main.ba2dec9 → 0.8.1-staging.31c3ee1
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-JV7HV5M3.mjs +147 -0
- package/dist/lib/browser/chunk-JV7HV5M3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RWIBODSU.mjs → chunk-LCUEUKOU.mjs} +155 -107
- package/dist/lib/browser/chunk-LCUEUKOU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-3LKCQYWD.mjs → chunk-WTIK6YHB.mjs} +2 -4
- package/dist/lib/browser/{chunk-3LKCQYWD.mjs.map → chunk-WTIK6YHB.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +6 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/observability-ZJBNR5EC.mjs +10 -0
- package/dist/lib/browser/segment/index.mjs +7 -81
- package/dist/lib/browser/segment/index.mjs.map +4 -4
- package/dist/lib/browser/sentry/index.mjs +1 -1
- package/dist/lib/browser/{sentry-log-processor-2KNHVHXL.mjs → sentry-log-processor-DVY46HFR.mjs} +2 -2
- package/dist/lib/browser/{sentry-log-processor-2KNHVHXL.mjs.map → sentry-log-processor-DVY46HFR.mjs.map} +2 -2
- package/dist/lib/node/{chunk-X2D2I2IE.cjs → chunk-TZZPITFA.cjs} +156 -109
- package/dist/lib/node/chunk-TZZPITFA.cjs.map +7 -0
- package/dist/lib/node/{chunk-HKBUNAUG.cjs → chunk-VJYGUKWI.cjs} +6 -6
- package/dist/lib/node/{chunk-HKBUNAUG.cjs.map → chunk-VJYGUKWI.cjs.map} +3 -3
- package/dist/lib/node/chunk-XIE7NKDF.cjs +213 -0
- package/dist/lib/node/chunk-XIE7NKDF.cjs.map +7 -0
- package/dist/lib/node/index.cjs +20 -15
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{observability-MM62IY7P.cjs → observability-LQYGR6H5.cjs} +9 -6
- package/dist/lib/node/observability-LQYGR6H5.cjs.map +7 -0
- package/dist/lib/node/segment/index.cjs +6 -136
- package/dist/lib/node/segment/index.cjs.map +4 -4
- package/dist/lib/node/sentry/index.cjs +10 -10
- package/dist/lib/node/sentry/index.cjs.map +1 -1
- package/dist/lib/node/{sentry-log-processor-SJZRJ7IS.cjs → sentry-log-processor-XWB4ECU6.cjs} +8 -8
- package/dist/lib/node/{sentry-log-processor-SJZRJ7IS.cjs.map → sentry-log-processor-XWB4ECU6.cjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-CMDADTM3.mjs → chunk-ANXHKE36.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-CMDADTM3.mjs.map → chunk-ANXHKE36.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-S7JHPCWW.mjs → chunk-HMGFYMJF.mjs} +154 -107
- package/dist/lib/node-esm/chunk-HMGFYMJF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-IKCDMDT3.mjs +202 -0
- package/dist/lib/node-esm/chunk-IKCDMDT3.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +6 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/observability-KDS7YGCQ.mjs +11 -0
- package/dist/lib/node-esm/segment/index.mjs +7 -139
- package/dist/lib/node-esm/segment/index.mjs.map +4 -4
- package/dist/lib/node-esm/sentry/index.mjs +1 -1
- package/dist/lib/node-esm/{sentry-log-processor-BVINGAOV.mjs → sentry-log-processor-FO6MIWBC.mjs} +2 -2
- package/dist/lib/node-esm/{sentry-log-processor-BVINGAOV.mjs.map → sentry-log-processor-FO6MIWBC.mjs.map} +2 -2
- package/dist/types/src/helpers/browser-observability.d.ts.map +1 -1
- package/dist/types/src/helpers/browser-observability.js +15 -14
- package/dist/types/src/helpers/browser-observability.js.map +1 -1
- package/dist/types/src/helpers/common.d.ts +3 -1
- package/dist/types/src/helpers/common.d.ts.map +1 -1
- package/dist/types/src/helpers/common.js +4 -0
- package/dist/types/src/helpers/common.js.map +1 -1
- package/dist/types/src/helpers/node-observability.d.ts.map +1 -1
- package/dist/types/src/helpers/node-observability.js +2 -2
- package/dist/types/src/helpers/node-observability.js.map +1 -1
- package/dist/types/src/helpers/setup-telemetry-listeners.d.ts +1 -1
- package/dist/types/src/helpers/setup-telemetry-listeners.d.ts.map +1 -1
- package/dist/types/src/helpers/setup-telemetry-listeners.js +38 -36
- package/dist/types/src/helpers/setup-telemetry-listeners.js.map +1 -1
- package/dist/types/src/observability.d.ts +30 -25
- package/dist/types/src/observability.d.ts.map +1 -1
- package/dist/types/src/observability.js +61 -39
- package/dist/types/src/observability.js.map +1 -1
- package/dist/types/src/segment/base.d.ts +15 -0
- package/dist/types/src/segment/base.d.ts.map +1 -0
- package/dist/types/src/segment/base.js +50 -0
- package/dist/types/src/segment/base.js.map +1 -0
- package/dist/types/src/segment/browser.d.ts +10 -5
- package/dist/types/src/segment/browser.d.ts.map +1 -1
- package/dist/types/src/segment/browser.js +27 -25
- package/dist/types/src/segment/browser.js.map +1 -1
- package/dist/types/src/segment/node.d.ts +10 -14
- package/dist/types/src/segment/node.d.ts.map +1 -1
- package/dist/types/src/segment/node.js +26 -29
- package/dist/types/src/segment/node.js.map +1 -1
- package/dist/types/src/segment/types.d.ts +39 -11
- package/dist/types/src/segment/types.d.ts.map +1 -1
- package/dist/types/src/segment/types.js +14 -0
- package/dist/types/src/segment/types.js.map +1 -1
- package/dist/types/src/sentry/browser.d.ts +1 -1
- package/dist/types/src/sentry/browser.d.ts.map +1 -1
- package/dist/types/src/sentry/browser.js +2 -2
- package/dist/types/src/sentry/browser.js.map +1 -1
- package/dist/types/src/sentry/node.d.ts +1 -1
- package/dist/types/src/sentry/node.d.ts.map +1 -1
- package/dist/types/src/sentry/node.js +2 -2
- package/dist/types/src/sentry/node.js.map +1 -1
- package/dist/types/src/sentry/sentry-log-processor.d.ts.map +1 -1
- package/dist/types/src/sentry/sentry-log-processor.js.map +1 -1
- package/package.json +15 -15
- package/src/helpers/browser-observability.ts +13 -17
- package/src/helpers/common.ts +15 -2
- package/src/helpers/node-observability.ts +3 -2
- package/src/helpers/setup-telemetry-listeners.ts +39 -41
- package/src/observability.ts +101 -64
- package/src/segment/base.ts +69 -0
- package/src/segment/browser.ts +28 -29
- package/src/segment/node.ts +30 -33
- package/src/segment/types.ts +39 -9
- package/src/sentry/browser.ts +2 -2
- package/src/sentry/node.ts +2 -2
- package/src/sentry/sentry-log-processor.ts +3 -0
- package/dist/lib/browser/chunk-RWIBODSU.mjs.map +0 -7
- package/dist/lib/browser/observability-VEOITBLM.mjs +0 -7
- package/dist/lib/node/chunk-X2D2I2IE.cjs.map +0 -7
- package/dist/lib/node/observability-MM62IY7P.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-S7JHPCWW.mjs.map +0 -7
- package/dist/lib/node-esm/observability-OLS7SWZT.mjs +0 -8
- /package/dist/lib/browser/{observability-VEOITBLM.mjs.map → observability-ZJBNR5EC.mjs.map} +0 -0
- /package/dist/lib/node-esm/{observability-OLS7SWZT.mjs.map → observability-KDS7YGCQ.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/sentry/sentry-log-processor.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Breadcrumb, SeverityLevel, Event } from '@sentry/types';\n\nimport { InvariantViolation } from '@dxos/invariant';\nimport { type LogConfig, type LogEntry, LogLevel, type LogProcessor, shouldLog } from '@dxos/log';\nimport { CircularBuffer, getDebugName } from '@dxos/util';\n\nimport { withScope, captureException, captureMessage } from './node';\n\nconst MAX_LOG_BREADCRUMBS = 150;\n\nexport class SentryLogProcessor {\n private _breadcrumbs = new CircularBuffer<Breadcrumb>(MAX_LOG_BREADCRUMBS);\n\n public readonly logProcessor: LogProcessor = (config: LogConfig, entry: LogEntry) => {\n const { level, meta, error } = entry;\n // Don't forward logs from remote sessions.\n if (!shouldLog(entry, config.captureFilters) || meta?.S?.remoteSessionId) {\n if (entry.level > LogLevel.DEBUG) {\n this._addBreadcrumb(undefined, entry.message, convertLevel(entry.level), undefined);\n }\n return;\n }\n if (entry.level !== LogLevel.WARN && entry.level !== LogLevel.ERROR) {\n return;\n }\n // TODO(nf): add rate limiting to avoid spamming Sentry/consuming excessive quota.\n withScope((scope) => {\n const severity = convertLevel(level);\n scope.setLevel(severity);\n scope.setContext('dxoslog', entry.context ?? null);\n if (meta) {\n scope.setTag('transaction', `${getRelativeFilename(meta.F)}:${meta.L}`);\n\n if (meta.S?.hostSessionId) {\n scope.setTags({\n service_host_issue: true,\n service_host_session: meta.S?.hostSessionId,\n });\n }\n\n if (!Number.isNaN(meta.S?.uptimeSeconds)) {\n scope.setExtra('uptime_seconds', meta.S?.uptimeSeconds);\n }\n }\n\n const extendedMessage = formatMessageForSentry(entry);\n let capturedError = error;\n if (capturedError == null && entry.level === LogLevel.ERROR) {\n capturedError = Object.values(entry.context ?? {}).find((v): v is Error => v instanceof Error);\n }\n if (capturedError) {\n if (capturedError instanceof InvariantViolation) {\n scope.setExtra('invariant_violation', true);\n }\n const isMessageDifferentFromStackTrace = error == null;\n if (isMessageDifferentFromStackTrace) {\n scope.setExtra('message', extendedMessage);\n }\n const eventId = captureException(capturedError);\n this._addBreadcrumb(eventId, extendedMessage, severity, entry.context);\n return;\n }\n\n scope.setFingerprint([entry.message]);\n const eventId = captureMessage(extendedMessage);\n this._addBreadcrumb(eventId, extendedMessage, severity, entry.context);\n });\n };\n\n public addLogBreadcrumbsTo(event: Event) {\n event.breadcrumbs ??= [];\n for (const breadcrumb of this._breadcrumbs) {\n event.breadcrumbs.push(breadcrumb);\n }\n event.breadcrumbs.sort((b1, b2) => {\n if (b1.timestamp === undefined || b2.timestamp === undefined) {\n return b1.timestamp === b2.timestamp ? 0 : b1.timestamp === undefined ? -1 : 1;\n }\n return b1.timestamp - b2.timestamp;\n });\n }\n\n private _addBreadcrumb(\n eventId: string | undefined,\n message: string,\n severity: SeverityLevel,\n context: { [key: string]: any } | undefined,\n ): void {\n const breadcrumb: Breadcrumb = {\n type: 'console',\n level: severity,\n event_id: eventId,\n category: 'log',\n message,\n data: context,\n timestamp: Math.floor(Date.now() / 1000),\n };\n const lastRecorded = this._breadcrumbs.getLast();\n if (lastRecorded && lastRecorded.message === breadcrumb.message) {\n const firstBreadcrumbData = lastRecorded.data?.firstBreadcrumbData ?? lastRecorded.data ?? {};\n const mergedBreadcrumbCount = Number.isNaN(lastRecorded.data?.mergedBreadcrumbCount)\n ? 1\n : Number(lastRecorded.data?.mergedBreadcrumbCount);\n lastRecorded.data = {\n mergedBreadcrumbCount: mergedBreadcrumbCount + 1,\n firstBreadcrumbData,\n lastBreadcrumbData: breadcrumb.data,\n };\n return;\n }\n this._breadcrumbs.push(breadcrumb);\n }\n}\n\nconst formatMessageForSentry = (entry: LogEntry) => {\n let scopePrefix: string | undefined;\n if (entry.meta?.S) {\n const scope = entry.meta?.S;\n scopePrefix = scope.name || getDebugName(scope);\n }\n if (scopePrefix == null) {\n return entry.message;\n }\n const workerPrefix = entry.meta?.S?.hostSessionId ? '[worker] ' : '';\n return `${workerPrefix}${scopePrefix} ${entry.message}`;\n};\n\nconst convertLevel = (level: LogLevel): SeverityLevel => {\n if (level === LogLevel.TRACE) {\n return 'debug';\n }\n if (level === LogLevel.WARN) {\n return 'warning';\n }\n return LogLevel[level].toLowerCase() as SeverityLevel;\n};\n\nconst getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAMA,SAASA,0BAA0B;AACnC,SAAwCC,UAA6BC,iBAAiB;AACtF,SAASC,gBAAgBC,oBAAoB;AAI7C,IAAMC,sBAAsB;AAErB,IAAMC,qBAAN,MAAMA;EAAN;AACGC,wBAAe,IAAIC,eAA2BH,mBAAAA;AAEtCI,wBAA6B,CAACC,QAAmBC,UAAAA;AAC/D,YAAM,EAAEC,OAAOC,MAAMC,MAAK,IAAKH;AAE/B,UAAI,CAACI,UAAUJ,OAAOD,OAAOM,cAAc,KAAKH,MAAMI,GAAGC,iBAAiB;AACxE,YAAIP,MAAMC,QAAQO,SAASC,OAAO;AAChC,eAAKC,eAAeC,QAAWX,MAAMY,SAASC,aAAab,MAAMC,KAAK,GAAGU,MAAAA;QAC3E;AACA;MACF;AACA,UAAIX,MAAMC,UAAUO,SAASM,QAAQd,MAAMC,UAAUO,SAASO,OAAO;AACnE;MACF;
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Breadcrumb, SeverityLevel, Event } from '@sentry/types';\n\nimport { InvariantViolation } from '@dxos/invariant';\nimport { type LogConfig, type LogEntry, LogLevel, type LogProcessor, shouldLog } from '@dxos/log';\nimport { CircularBuffer, getDebugName } from '@dxos/util';\n\nimport { withScope, captureException, captureMessage } from './node';\n\nconst MAX_LOG_BREADCRUMBS = 150;\n\nexport class SentryLogProcessor {\n private _breadcrumbs = new CircularBuffer<Breadcrumb>(MAX_LOG_BREADCRUMBS);\n\n public readonly logProcessor: LogProcessor = (config: LogConfig, entry: LogEntry) => {\n const { level, meta, error } = entry;\n // Don't forward logs from remote sessions.\n if (!shouldLog(entry, config.captureFilters) || meta?.S?.remoteSessionId) {\n if (entry.level > LogLevel.DEBUG) {\n this._addBreadcrumb(undefined, entry.message, convertLevel(entry.level), undefined);\n }\n return;\n }\n if (entry.level !== LogLevel.WARN && entry.level !== LogLevel.ERROR) {\n return;\n }\n\n // TODO(nf): add rate limiting to avoid spamming Sentry/consuming excessive quota.\n withScope((scope) => {\n const severity = convertLevel(level);\n scope.setLevel(severity);\n scope.setContext('dxoslog', entry.context ?? null);\n if (meta) {\n scope.setTag('transaction', `${getRelativeFilename(meta.F)}:${meta.L}`);\n\n if (meta.S?.hostSessionId) {\n scope.setTags({\n service_host_issue: true,\n service_host_session: meta.S?.hostSessionId,\n });\n }\n\n if (!Number.isNaN(meta.S?.uptimeSeconds)) {\n scope.setExtra('uptime_seconds', meta.S?.uptimeSeconds);\n }\n }\n\n const extendedMessage = formatMessageForSentry(entry);\n let capturedError = error;\n if (capturedError == null && entry.level === LogLevel.ERROR) {\n capturedError = Object.values(entry.context ?? {}).find((v): v is Error => v instanceof Error);\n }\n if (capturedError) {\n if (capturedError instanceof InvariantViolation) {\n scope.setExtra('invariant_violation', true);\n }\n const isMessageDifferentFromStackTrace = error == null;\n if (isMessageDifferentFromStackTrace) {\n scope.setExtra('message', extendedMessage);\n }\n const eventId = captureException(capturedError);\n this._addBreadcrumb(eventId, extendedMessage, severity, entry.context);\n return;\n }\n\n scope.setFingerprint([entry.message]);\n const eventId = captureMessage(extendedMessage);\n this._addBreadcrumb(eventId, extendedMessage, severity, entry.context);\n });\n };\n\n public addLogBreadcrumbsTo(event: Event) {\n event.breadcrumbs ??= [];\n for (const breadcrumb of this._breadcrumbs) {\n event.breadcrumbs.push(breadcrumb);\n }\n event.breadcrumbs.sort((b1, b2) => {\n if (b1.timestamp === undefined || b2.timestamp === undefined) {\n return b1.timestamp === b2.timestamp ? 0 : b1.timestamp === undefined ? -1 : 1;\n }\n return b1.timestamp - b2.timestamp;\n });\n }\n\n private _addBreadcrumb(\n eventId: string | undefined,\n message: string,\n severity: SeverityLevel,\n context: { [key: string]: any } | undefined,\n ): void {\n const breadcrumb: Breadcrumb = {\n type: 'console',\n level: severity,\n event_id: eventId,\n category: 'log',\n message,\n data: context,\n timestamp: Math.floor(Date.now() / 1000),\n };\n const lastRecorded = this._breadcrumbs.getLast();\n if (lastRecorded && lastRecorded.message === breadcrumb.message) {\n const firstBreadcrumbData = lastRecorded.data?.firstBreadcrumbData ?? lastRecorded.data ?? {};\n const mergedBreadcrumbCount = Number.isNaN(lastRecorded.data?.mergedBreadcrumbCount)\n ? 1\n : Number(lastRecorded.data?.mergedBreadcrumbCount);\n lastRecorded.data = {\n mergedBreadcrumbCount: mergedBreadcrumbCount + 1,\n firstBreadcrumbData,\n lastBreadcrumbData: breadcrumb.data,\n };\n return;\n }\n this._breadcrumbs.push(breadcrumb);\n }\n}\n\nconst formatMessageForSentry = (entry: LogEntry) => {\n let scopePrefix: string | undefined;\n if (entry.meta?.S) {\n const scope = entry.meta?.S;\n scopePrefix = scope.name || getDebugName(scope);\n }\n if (scopePrefix == null) {\n return entry.message;\n }\n\n const workerPrefix = entry.meta?.S?.hostSessionId ? '[worker] ' : '';\n return `${workerPrefix}${scopePrefix} ${entry.message}`;\n};\n\nconst convertLevel = (level: LogLevel): SeverityLevel => {\n if (level === LogLevel.TRACE) {\n return 'debug';\n }\n if (level === LogLevel.WARN) {\n return 'warning';\n }\n\n return LogLevel[level].toLowerCase() as SeverityLevel;\n};\n\nconst getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["InvariantViolation", "LogLevel", "shouldLog", "CircularBuffer", "getDebugName", "MAX_LOG_BREADCRUMBS", "SentryLogProcessor", "_breadcrumbs", "CircularBuffer", "logProcessor", "config", "entry", "level", "meta", "error", "shouldLog", "captureFilters", "S", "remoteSessionId", "LogLevel", "DEBUG", "_addBreadcrumb", "undefined", "message", "convertLevel", "WARN", "ERROR", "withScope", "scope", "severity", "setLevel", "setContext", "context", "setTag", "getRelativeFilename", "F", "L", "hostSessionId", "setTags", "service_host_issue", "service_host_session", "Number", "isNaN", "uptimeSeconds", "setExtra", "extendedMessage", "formatMessageForSentry", "capturedError", "Object", "values", "find", "v", "Error", "InvariantViolation", "isMessageDifferentFromStackTrace", "eventId", "captureException", "setFingerprint", "captureMessage", "addLogBreadcrumbsTo", "event", "breadcrumbs", "breadcrumb", "push", "sort", "b1", "b2", "timestamp", "type", "event_id", "category", "data", "Math", "floor", "Date", "now", "lastRecorded", "getLast", "firstBreadcrumbData", "mergedBreadcrumbCount", "lastBreadcrumbData", "scopePrefix", "name", "getDebugName", "workerPrefix", "TRACE", "toLowerCase", "filename", "match", "filePath"]
|
|
7
7
|
}
|
|
@@ -26,14 +26,15 @@ 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_TZZPITFA_exports = {};
|
|
30
|
+
__export(chunk_TZZPITFA_exports, {
|
|
31
31
|
OBSERVABILITY_DISABLED_KEY: () => OBSERVABILITY_DISABLED_KEY,
|
|
32
32
|
OBSERVABILITY_GROUP_KEY: () => OBSERVABILITY_GROUP_KEY,
|
|
33
33
|
Observability: () => Observability,
|
|
34
34
|
getObservabilityGroup: () => getObservabilityGroup,
|
|
35
35
|
getObservabilityState: () => getObservabilityState,
|
|
36
36
|
getTelemetryIdentifier: () => getTelemetryIdentifier,
|
|
37
|
+
getTelemetryIdentity: () => getTelemetryIdentity,
|
|
37
38
|
initializeAppObservability: () => initializeAppObservability,
|
|
38
39
|
initializeNodeObservability: () => initializeNodeObservability,
|
|
39
40
|
isObservabilityDisabled: () => isObservabilityDisabled,
|
|
@@ -43,7 +44,8 @@ __export(chunk_X2D2I2IE_exports, {
|
|
|
43
44
|
storeObservabilityDisabled: () => storeObservabilityDisabled,
|
|
44
45
|
storeObservabilityGroup: () => storeObservabilityGroup
|
|
45
46
|
});
|
|
46
|
-
module.exports = __toCommonJS(
|
|
47
|
+
module.exports = __toCommonJS(chunk_TZZPITFA_exports);
|
|
48
|
+
var import_chunk_XIE7NKDF = require("./chunk-XIE7NKDF.cjs");
|
|
47
49
|
var import_async = require("@dxos/async");
|
|
48
50
|
var import_client = require("@dxos/client");
|
|
49
51
|
var import_context = require("@dxos/context");
|
|
@@ -119,20 +121,26 @@ var storeObservabilityGroup = async (namespace, value) => {
|
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
123
|
};
|
|
122
|
-
var initializeAppObservability = async ({
|
|
124
|
+
var initializeAppObservability = async ({
|
|
125
|
+
namespace,
|
|
126
|
+
config,
|
|
127
|
+
// TODO(nf): Configure mode.
|
|
128
|
+
mode = "basic",
|
|
129
|
+
tracingEnable = false,
|
|
130
|
+
replayEnable = false
|
|
131
|
+
}) => {
|
|
123
132
|
(0, import_log2.log)("initializeAppObservability", {
|
|
124
133
|
config
|
|
125
134
|
}, {
|
|
126
135
|
F: __dxlog_file,
|
|
127
|
-
L:
|
|
136
|
+
L: 73,
|
|
128
137
|
S: void 0,
|
|
129
138
|
C: (f, a) => f(...a)
|
|
130
139
|
});
|
|
131
140
|
const group = await getObservabilityGroup(namespace) ?? void 0;
|
|
132
141
|
const release = `${namespace}@${config.get("runtime.app.build.version")}`;
|
|
133
142
|
const environment = config.get("runtime.app.env.DX_ENVIRONMENT");
|
|
134
|
-
const
|
|
135
|
-
const { Observability: Observability2 } = await import("./observability-MM62IY7P.cjs");
|
|
143
|
+
const { Observability: Observability2 } = await import("./observability-LQYGR6H5.cjs");
|
|
136
144
|
const observability = new Observability2({
|
|
137
145
|
namespace,
|
|
138
146
|
release,
|
|
@@ -147,18 +155,20 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
147
155
|
tracing: tracingEnable,
|
|
148
156
|
replay: replayEnable,
|
|
149
157
|
// TODO(wittjosiah): Configure these.
|
|
158
|
+
// Consider using a sampling function to dynamically configure these values.
|
|
159
|
+
// https://docs.sentry.io/platforms/javascript/configuration/sampling/#setting-a-sampling-function
|
|
150
160
|
sampleRate: 1,
|
|
151
|
-
// TODO(mykola): Lower this to 0.1.
|
|
152
161
|
replaySampleRate: 1,
|
|
153
162
|
replaySampleRateOnError: 1
|
|
154
163
|
}
|
|
155
164
|
}
|
|
156
165
|
});
|
|
166
|
+
const observabilityDisabled = await isObservabilityDisabled(namespace);
|
|
157
167
|
if (observabilityDisabled) {
|
|
158
168
|
observability.setMode("disabled");
|
|
159
169
|
import_log2.log.info("observability disabled", void 0, {
|
|
160
170
|
F: __dxlog_file,
|
|
161
|
-
L:
|
|
171
|
+
L: 113,
|
|
162
172
|
S: void 0,
|
|
163
173
|
C: (f, a) => f(...a)
|
|
164
174
|
});
|
|
@@ -185,7 +195,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
185
195
|
await observability.initialize();
|
|
186
196
|
observability.startErrorLogs();
|
|
187
197
|
const ipData = await getIPData(config);
|
|
188
|
-
ipData && observability.
|
|
198
|
+
ipData && observability.setIPDataTelemetryTags(ipData);
|
|
189
199
|
if (typeof navigator !== "undefined" && navigator.storage?.estimate) {
|
|
190
200
|
setInterval(async () => {
|
|
191
201
|
try {
|
|
@@ -195,7 +205,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
195
205
|
} catch (error) {
|
|
196
206
|
import_log2.log.warn("Failed to run estimate()", error, {
|
|
197
207
|
F: __dxlog_file,
|
|
198
|
-
L:
|
|
208
|
+
L: 168,
|
|
199
209
|
S: void 0,
|
|
200
210
|
C: (f, a) => f(...a)
|
|
201
211
|
});
|
|
@@ -205,7 +215,7 @@ var initializeAppObservability = async ({ namespace, config, mode = "basic", tra
|
|
|
205
215
|
} catch (err) {
|
|
206
216
|
import_log2.log.error("Failed to initialize app observability", err, {
|
|
207
217
|
F: __dxlog_file,
|
|
208
|
-
L:
|
|
218
|
+
L: 173,
|
|
209
219
|
S: void 0,
|
|
210
220
|
C: (f, a) => f(...a)
|
|
211
221
|
});
|
|
@@ -222,6 +232,12 @@ var getTelemetryIdentifier = (client) => {
|
|
|
222
232
|
}
|
|
223
233
|
return void 0;
|
|
224
234
|
};
|
|
235
|
+
var getTelemetryIdentity = (client) => {
|
|
236
|
+
const did = getTelemetryIdentifier(client);
|
|
237
|
+
return {
|
|
238
|
+
did
|
|
239
|
+
};
|
|
240
|
+
};
|
|
225
241
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/observability/src/helpers/node-observability.ts";
|
|
226
242
|
var showObservabilityBanner = async (configDir, bannercb) => {
|
|
227
243
|
const path = (0, import_node_path.join)(configDir, ".observability-banner-printed");
|
|
@@ -281,11 +297,11 @@ var initializeNodeObservability = async ({ namespace, version, config, installat
|
|
|
281
297
|
const release = `${namespace}@${version}`;
|
|
282
298
|
const environment = process.env.DX_ENVIRONMENT ?? "unknown";
|
|
283
299
|
const observability = new Observability({
|
|
300
|
+
mode,
|
|
284
301
|
namespace,
|
|
285
302
|
release,
|
|
286
303
|
environment,
|
|
287
304
|
group,
|
|
288
|
-
mode,
|
|
289
305
|
errorLog: {
|
|
290
306
|
sentryInitOptions: {
|
|
291
307
|
environment,
|
|
@@ -300,7 +316,7 @@ var initializeNodeObservability = async ({ namespace, version, config, installat
|
|
|
300
316
|
try {
|
|
301
317
|
const res = await fetch(`https://api.ipdata.co/?api-key=${IPDATA_API_KEY}`);
|
|
302
318
|
const ipData = await res.json();
|
|
303
|
-
ipData && observability.
|
|
319
|
+
ipData && observability.setIPDataTelemetryTags(ipData);
|
|
304
320
|
} catch (err) {
|
|
305
321
|
observability?.captureException(err);
|
|
306
322
|
}
|
|
@@ -343,63 +359,69 @@ var setupTelemetryListeners = (namespace, client, observability) => {
|
|
|
343
359
|
if (!id) {
|
|
344
360
|
return;
|
|
345
361
|
}
|
|
346
|
-
setTimeout(() =>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
362
|
+
setTimeout(() => {
|
|
363
|
+
observability.track({
|
|
364
|
+
...getTelemetryIdentity(client),
|
|
365
|
+
action: "window.click",
|
|
366
|
+
properties: {
|
|
367
|
+
id: event.target?.id,
|
|
368
|
+
path: event.composedPath().filter((el) => Boolean(el.tagName)).map((el) => `${el.tagName.toLowerCase()}${el.id ? `#${el.id}` : ""}`).reverse().join(">")
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
});
|
|
355
372
|
};
|
|
356
373
|
const focusCallback = () => {
|
|
357
374
|
const now = /* @__PURE__ */ new Date();
|
|
358
|
-
setTimeout(() =>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
375
|
+
setTimeout(() => {
|
|
376
|
+
observability.track({
|
|
377
|
+
...getTelemetryIdentity(client),
|
|
378
|
+
action: "window.focus",
|
|
379
|
+
properties: {
|
|
380
|
+
timeAway: now.getTime() - lastFocusEvent.getTime()
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
366
384
|
lastFocusEvent = now;
|
|
367
385
|
};
|
|
368
386
|
const blurCallback = () => {
|
|
369
387
|
const now = /* @__PURE__ */ new Date();
|
|
370
|
-
const
|
|
371
|
-
setTimeout(() =>
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
388
|
+
const duration = now.getTime() - lastFocusEvent.getTime();
|
|
389
|
+
setTimeout(() => {
|
|
390
|
+
observability.track({
|
|
391
|
+
...getTelemetryIdentity(client),
|
|
392
|
+
action: "window.blur",
|
|
393
|
+
properties: {
|
|
394
|
+
duration
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
});
|
|
379
398
|
lastFocusEvent = now;
|
|
380
|
-
totalTime = totalTime +
|
|
399
|
+
totalTime = totalTime + duration;
|
|
381
400
|
};
|
|
382
401
|
const unloadCallback = () => {
|
|
383
|
-
setTimeout(() =>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
402
|
+
setTimeout(() => {
|
|
403
|
+
observability.track({
|
|
404
|
+
...getTelemetryIdentity(client),
|
|
405
|
+
action: "page.unload",
|
|
406
|
+
properties: {
|
|
407
|
+
duration: totalTime
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
});
|
|
391
411
|
};
|
|
392
412
|
const errorCallback = (event) => {
|
|
393
|
-
setTimeout(() =>
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
413
|
+
setTimeout(() => {
|
|
414
|
+
observability.track({
|
|
415
|
+
...getTelemetryIdentity(client),
|
|
416
|
+
action: "window.error",
|
|
417
|
+
properties: {
|
|
418
|
+
message: event.message,
|
|
419
|
+
filename: event.filename,
|
|
420
|
+
stack: event.error?.stack,
|
|
421
|
+
cause: event.error?.cause
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
});
|
|
403
425
|
};
|
|
404
426
|
window.addEventListener("click", clickCallback, true);
|
|
405
427
|
window.addEventListener("focus", focusCallback);
|
|
@@ -420,34 +442,32 @@ var SPACE_TELEMETRY_MIN_INTERVAL = 1e3 * 60 * 60;
|
|
|
420
442
|
var NETWORK_METRICS_MIN_INTERVAL = 1e3 * 60 * 5;
|
|
421
443
|
var Observability = class {
|
|
422
444
|
// TODO(nf): make platform a required extension?
|
|
423
|
-
constructor({ namespace, environment, release, config,
|
|
445
|
+
constructor({ mode, namespace, environment, release, config, group, secrets, telemetry, errorLog }) {
|
|
446
|
+
this._tags = /* @__PURE__ */ new Map();
|
|
424
447
|
this._ctx = new import_context.Context(void 0, {
|
|
425
448
|
F: __dxlog_file3,
|
|
426
|
-
L:
|
|
449
|
+
L: 115
|
|
427
450
|
});
|
|
428
|
-
this.
|
|
429
|
-
this.addIPDataTelemetryTags = (ipData) => {
|
|
451
|
+
this.setIPDataTelemetryTags = (ipData) => {
|
|
430
452
|
this.setTag("city", ipData.city, "telemetry");
|
|
431
453
|
this.setTag("region", ipData.region, "telemetry");
|
|
432
454
|
this.setTag("country", ipData.country, "telemetry");
|
|
433
455
|
ipData.latitude && this.setTag("latitude", ipData.latitude.toString(), "telemetry");
|
|
434
456
|
ipData.longitude && this.setTag("longitude", ipData.longitude.toString(), "telemetry");
|
|
435
457
|
};
|
|
436
|
-
this._namespace = namespace;
|
|
437
458
|
this._mode = mode;
|
|
459
|
+
this._namespace = namespace;
|
|
438
460
|
this._config = config;
|
|
439
461
|
this._group = group;
|
|
440
462
|
this._secrets = this._loadSecrets(config, secrets);
|
|
441
463
|
this._telemetryBatchSize = telemetry?.batchSize ?? 30;
|
|
442
464
|
this._errorReportingOptions = errorLog?.sentryInitOptions;
|
|
443
|
-
if (this._group) {
|
|
444
|
-
this.setTag("group", this._group);
|
|
445
|
-
}
|
|
446
|
-
this.setTag("namespace", this._namespace);
|
|
447
|
-
environment && this.setTag("environment", environment);
|
|
448
|
-
release && this.setTag("release", release);
|
|
449
465
|
this.setTag("mode", this._mode);
|
|
466
|
+
this.setTag("namespace", this._namespace);
|
|
467
|
+
this.setTag("environment", environment);
|
|
468
|
+
this.setTag("release", release);
|
|
450
469
|
this.setTag("session", import_client.PublicKey.random().toHex());
|
|
470
|
+
this.setTag("group", this._group);
|
|
451
471
|
}
|
|
452
472
|
get mode() {
|
|
453
473
|
return this._mode;
|
|
@@ -478,7 +498,7 @@ var Observability = class {
|
|
|
478
498
|
config
|
|
479
499
|
}, {
|
|
480
500
|
F: __dxlog_file3,
|
|
481
|
-
L:
|
|
501
|
+
L: 176,
|
|
482
502
|
S: this,
|
|
483
503
|
C: (f, a) => f(...a)
|
|
484
504
|
});
|
|
@@ -495,6 +515,12 @@ var Observability = class {
|
|
|
495
515
|
}
|
|
496
516
|
}
|
|
497
517
|
async initialize() {
|
|
518
|
+
(0, import_log.log)("initializing...", void 0, {
|
|
519
|
+
F: __dxlog_file3,
|
|
520
|
+
L: 191,
|
|
521
|
+
S: this,
|
|
522
|
+
C: (f, a) => f(...a)
|
|
523
|
+
});
|
|
498
524
|
await this._initLogs();
|
|
499
525
|
await this._initMetrics();
|
|
500
526
|
await this._initTelemetry();
|
|
@@ -502,6 +528,12 @@ var Observability = class {
|
|
|
502
528
|
await this._initTraces();
|
|
503
529
|
}
|
|
504
530
|
async close() {
|
|
531
|
+
(0, import_log.log)("closing...", void 0, {
|
|
532
|
+
F: __dxlog_file3,
|
|
533
|
+
L: 200,
|
|
534
|
+
S: this,
|
|
535
|
+
C: (f, a) => f(...a)
|
|
536
|
+
});
|
|
505
537
|
const closes = [];
|
|
506
538
|
this._telemetry && closes.push(this._telemetry.close());
|
|
507
539
|
this._otelMetrics && closes.push(this._otelMetrics.close());
|
|
@@ -512,10 +544,13 @@ var Observability = class {
|
|
|
512
544
|
setMode(mode) {
|
|
513
545
|
this._mode = mode;
|
|
514
546
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
547
|
+
/**
|
|
548
|
+
* camelCase keys are converted to snake_case in Segment.
|
|
549
|
+
*/
|
|
518
550
|
setTag(key, value, scope) {
|
|
551
|
+
if (value === void 0) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
519
554
|
if (this.enabled && (scope === void 0 || scope === "all" || scope === "errors")) {
|
|
520
555
|
this._setTag?.(key, value);
|
|
521
556
|
}
|
|
@@ -539,13 +574,16 @@ var Observability = class {
|
|
|
539
574
|
idqr
|
|
540
575
|
}, {
|
|
541
576
|
F: __dxlog_file3,
|
|
542
|
-
L:
|
|
577
|
+
L: 247,
|
|
543
578
|
S: this,
|
|
544
579
|
C: (f, a) => f(...a)
|
|
545
580
|
});
|
|
546
581
|
return;
|
|
547
582
|
}
|
|
548
583
|
this.setTag("did", idqr.identity.did);
|
|
584
|
+
this._telemetry?.identify({
|
|
585
|
+
userId: idqr.identity.did
|
|
586
|
+
});
|
|
549
587
|
});
|
|
550
588
|
}
|
|
551
589
|
if (clientServices.DevicesService) {
|
|
@@ -555,7 +593,7 @@ var Observability = class {
|
|
|
555
593
|
device: dqr
|
|
556
594
|
}, {
|
|
557
595
|
F: __dxlog_file3,
|
|
558
|
-
L:
|
|
596
|
+
L: 259,
|
|
559
597
|
S: this,
|
|
560
598
|
C: (f, a) => f(...a)
|
|
561
599
|
});
|
|
@@ -563,7 +601,7 @@ var Observability = class {
|
|
|
563
601
|
}
|
|
564
602
|
(0, import_invariant.invariant)(dqr, "empty response from device service", {
|
|
565
603
|
F: __dxlog_file3,
|
|
566
|
-
L:
|
|
604
|
+
L: 263,
|
|
567
605
|
S: this,
|
|
568
606
|
A: [
|
|
569
607
|
"dqr",
|
|
@@ -576,7 +614,7 @@ var Observability = class {
|
|
|
576
614
|
device: dqr
|
|
577
615
|
}, {
|
|
578
616
|
F: __dxlog_file3,
|
|
579
|
-
L:
|
|
617
|
+
L: 266,
|
|
580
618
|
S: this,
|
|
581
619
|
C: (f, a) => f(...a)
|
|
582
620
|
});
|
|
@@ -614,14 +652,14 @@ var Observability = class {
|
|
|
614
652
|
namespace: this._namespace
|
|
615
653
|
}, {
|
|
616
654
|
F: __dxlog_file3,
|
|
617
|
-
L:
|
|
655
|
+
L: 310,
|
|
618
656
|
S: this,
|
|
619
657
|
C: (f, a) => f(...a)
|
|
620
658
|
});
|
|
621
659
|
} else {
|
|
622
660
|
(0, import_log.log)("otel logs disabled", void 0, {
|
|
623
661
|
F: __dxlog_file3,
|
|
624
|
-
L:
|
|
662
|
+
L: 312,
|
|
625
663
|
S: this,
|
|
626
664
|
C: (f, a) => f(...a)
|
|
627
665
|
});
|
|
@@ -647,14 +685,14 @@ var Observability = class {
|
|
|
647
685
|
});
|
|
648
686
|
(0, import_log.log)("otel metrics enabled", void 0, {
|
|
649
687
|
F: __dxlog_file3,
|
|
650
|
-
L:
|
|
688
|
+
L: 337,
|
|
651
689
|
S: this,
|
|
652
690
|
C: (f, a) => f(...a)
|
|
653
691
|
});
|
|
654
692
|
} else {
|
|
655
693
|
(0, import_log.log)("otel metrics disabled", void 0, {
|
|
656
694
|
F: __dxlog_file3,
|
|
657
|
-
L:
|
|
695
|
+
L: 339,
|
|
658
696
|
S: this,
|
|
659
697
|
C: (f, a) => f(...a)
|
|
660
698
|
});
|
|
@@ -677,7 +715,7 @@ var Observability = class {
|
|
|
677
715
|
updateSignalMetrics.on(this._ctx, async () => {
|
|
678
716
|
(0, import_log.log)("send signal metrics", void 0, {
|
|
679
717
|
F: __dxlog_file3,
|
|
680
|
-
L:
|
|
718
|
+
L: 361,
|
|
681
719
|
S: this,
|
|
682
720
|
C: (f, a) => f(...a)
|
|
683
721
|
});
|
|
@@ -729,7 +767,7 @@ var Observability = class {
|
|
|
729
767
|
updateSpaceMetrics.on(this._ctx, async () => {
|
|
730
768
|
(0, import_log.log)("send space metrics", void 0, {
|
|
731
769
|
F: __dxlog_file3,
|
|
732
|
-
L:
|
|
770
|
+
L: 414,
|
|
733
771
|
S: this,
|
|
734
772
|
C: (f, a) => f(...a)
|
|
735
773
|
});
|
|
@@ -754,16 +792,17 @@ var Observability = class {
|
|
|
754
792
|
updateSpaceTelemetry.on(this._ctx, async () => {
|
|
755
793
|
(0, import_log.log)("send space telemetry", void 0, {
|
|
756
794
|
F: __dxlog_file3,
|
|
757
|
-
L:
|
|
795
|
+
L: 425,
|
|
758
796
|
S: this,
|
|
759
797
|
C: (f, a) => f(...a)
|
|
760
798
|
});
|
|
761
799
|
for (const data of mapSpaces(spaces, {
|
|
762
800
|
truncateKeys: true
|
|
763
801
|
})) {
|
|
764
|
-
this.
|
|
765
|
-
|
|
766
|
-
|
|
802
|
+
this.track({
|
|
803
|
+
...getTelemetryIdentity(client),
|
|
804
|
+
event: import_chunk_XIE7NKDF.TelemetryEvent.METRICS,
|
|
805
|
+
action: "space.update",
|
|
767
806
|
properties: data
|
|
768
807
|
});
|
|
769
808
|
}
|
|
@@ -790,14 +829,14 @@ var Observability = class {
|
|
|
790
829
|
const platform = await client.services.services.SystemService?.getPlatform();
|
|
791
830
|
(0, import_invariant.invariant)(platform, "platform is required", {
|
|
792
831
|
F: __dxlog_file3,
|
|
793
|
-
L:
|
|
832
|
+
L: 463,
|
|
794
833
|
S: this,
|
|
795
834
|
A: [
|
|
796
835
|
"platform",
|
|
797
836
|
"'platform is required'"
|
|
798
837
|
]
|
|
799
838
|
});
|
|
800
|
-
this.setTag("
|
|
839
|
+
this.setTag("platformType", import_services.Platform.PLATFORM_TYPE[platform.type].toLowerCase());
|
|
801
840
|
if (this._mode === "full") {
|
|
802
841
|
if (platform.platform) {
|
|
803
842
|
this.setTag("platform", platform.platform);
|
|
@@ -828,7 +867,7 @@ var Observability = class {
|
|
|
828
867
|
error
|
|
829
868
|
}, {
|
|
830
869
|
F: __dxlog_file3,
|
|
831
|
-
L:
|
|
870
|
+
L: 497,
|
|
832
871
|
S: this,
|
|
833
872
|
C: (f, a) => f(...a)
|
|
834
873
|
}));
|
|
@@ -853,27 +892,25 @@ var Observability = class {
|
|
|
853
892
|
} else {
|
|
854
893
|
(0, import_log.log)("segment disabled", void 0, {
|
|
855
894
|
F: __dxlog_file3,
|
|
856
|
-
L:
|
|
895
|
+
L: 523,
|
|
857
896
|
S: this,
|
|
858
897
|
C: (f, a) => f(...a)
|
|
859
898
|
});
|
|
860
899
|
}
|
|
861
900
|
}
|
|
862
901
|
/**
|
|
863
|
-
*
|
|
864
|
-
*
|
|
902
|
+
* Submit telemetry page view.
|
|
865
903
|
* The default implementation uses Segment.
|
|
866
904
|
*/
|
|
867
|
-
|
|
868
|
-
this._telemetry?.
|
|
905
|
+
page(options) {
|
|
906
|
+
this._telemetry?.page(options);
|
|
869
907
|
}
|
|
870
908
|
/**
|
|
871
|
-
*
|
|
872
|
-
*
|
|
909
|
+
* Submit telemetry user action.
|
|
873
910
|
* The default implementation uses Segment.
|
|
874
911
|
*/
|
|
875
|
-
|
|
876
|
-
this._telemetry?.
|
|
912
|
+
track(options) {
|
|
913
|
+
this._telemetry?.track(options);
|
|
877
914
|
}
|
|
878
915
|
//
|
|
879
916
|
// Error Logs
|
|
@@ -881,7 +918,7 @@ var Observability = class {
|
|
|
881
918
|
async _initErrorLogs() {
|
|
882
919
|
if (this._secrets.SENTRY_DESTINATION && this._mode !== "disabled") {
|
|
883
920
|
const { captureException, captureUserFeedback, init, setTag } = await import("./sentry/index.cjs");
|
|
884
|
-
const { SentryLogProcessor } = await import("./sentry-log-processor-
|
|
921
|
+
const { SentryLogProcessor } = await import("./sentry-log-processor-XWB4ECU6.cjs");
|
|
885
922
|
this._captureException = captureException;
|
|
886
923
|
this._captureUserFeedback = captureUserFeedback;
|
|
887
924
|
this._setTag = setTag;
|
|
@@ -890,7 +927,7 @@ var Observability = class {
|
|
|
890
927
|
options: this._errorReportingOptions
|
|
891
928
|
}, {
|
|
892
929
|
F: __dxlog_file3,
|
|
893
|
-
L:
|
|
930
|
+
L: 556,
|
|
894
931
|
S: this,
|
|
895
932
|
C: (f, a) => f(...a)
|
|
896
933
|
});
|
|
@@ -909,7 +946,7 @@ var Observability = class {
|
|
|
909
946
|
} else {
|
|
910
947
|
(0, import_log.log)("sentry disabled", void 0, {
|
|
911
948
|
F: __dxlog_file3,
|
|
912
|
-
L:
|
|
949
|
+
L: 576,
|
|
913
950
|
S: this,
|
|
914
951
|
C: (f, a) => f(...a)
|
|
915
952
|
});
|
|
@@ -921,7 +958,7 @@ var Observability = class {
|
|
|
921
958
|
startTraces() {
|
|
922
959
|
this._otelTraces && this._otelTraces.start();
|
|
923
960
|
}
|
|
924
|
-
// TODO(nf):
|
|
961
|
+
// TODO(nf): Refactor init based on providers and their capabilities.
|
|
925
962
|
async _initTraces() {
|
|
926
963
|
if (this._secrets.OTEL_ENDPOINT && this._secrets.OTEL_AUTHORIZATION && this._mode !== "disabled") {
|
|
927
964
|
const { OtelTraces } = await import("./otel-PN3H25QV.cjs");
|
|
@@ -941,7 +978,6 @@ var Observability = class {
|
|
|
941
978
|
}
|
|
942
979
|
/**
|
|
943
980
|
* Manually capture an exception.
|
|
944
|
-
*
|
|
945
981
|
* The default implementation uses Sentry.
|
|
946
982
|
*/
|
|
947
983
|
captureException(err) {
|
|
@@ -951,11 +987,21 @@ var Observability = class {
|
|
|
951
987
|
}
|
|
952
988
|
/**
|
|
953
989
|
* Manually capture user feedback.
|
|
954
|
-
*
|
|
955
990
|
* The default implementation uses Sentry.
|
|
956
991
|
*/
|
|
957
|
-
captureUserFeedback(
|
|
958
|
-
|
|
992
|
+
captureUserFeedback(message) {
|
|
993
|
+
if (!this._secrets.SENTRY_DESTINATION) {
|
|
994
|
+
import_log.log.info("Feedback submitted without Sentry destination", {
|
|
995
|
+
message
|
|
996
|
+
}, {
|
|
997
|
+
F: __dxlog_file3,
|
|
998
|
+
L: 625,
|
|
999
|
+
S: this,
|
|
1000
|
+
C: (f, a) => f(...a)
|
|
1001
|
+
});
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
void this._captureUserFeedback?.(message);
|
|
959
1005
|
}
|
|
960
1006
|
};
|
|
961
1007
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -966,6 +1012,7 @@ var Observability = class {
|
|
|
966
1012
|
getObservabilityGroup,
|
|
967
1013
|
getObservabilityState,
|
|
968
1014
|
getTelemetryIdentifier,
|
|
1015
|
+
getTelemetryIdentity,
|
|
969
1016
|
initializeAppObservability,
|
|
970
1017
|
initializeNodeObservability,
|
|
971
1018
|
isObservabilityDisabled,
|
|
@@ -975,4 +1022,4 @@ var Observability = class {
|
|
|
975
1022
|
storeObservabilityDisabled,
|
|
976
1023
|
storeObservabilityGroup
|
|
977
1024
|
});
|
|
978
|
-
//# sourceMappingURL=chunk-
|
|
1025
|
+
//# sourceMappingURL=chunk-TZZPITFA.cjs.map
|