@sentry/browser 9.10.0 → 9.11.0
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/build/npm/cjs/client.js +30 -3
- package/build/npm/cjs/client.js.map +1 -1
- package/build/npm/cjs/index.js +1 -0
- package/build/npm/cjs/index.js.map +1 -1
- package/build/npm/cjs/integrations/linkederrors.js +0 -1
- package/build/npm/cjs/integrations/linkederrors.js.map +1 -1
- package/build/npm/cjs/log.js +1 -55
- package/build/npm/cjs/log.js.map +1 -1
- package/build/npm/cjs/tracing/previousTrace.js +18 -3
- package/build/npm/cjs/tracing/previousTrace.js.map +1 -1
- package/build/npm/esm/client.js +31 -4
- package/build/npm/esm/client.js.map +1 -1
- package/build/npm/esm/index.js +1 -1
- package/build/npm/esm/integrations/linkederrors.js +0 -1
- package/build/npm/esm/integrations/linkederrors.js.map +1 -1
- package/build/npm/esm/log.js +2 -56
- package/build/npm/esm/log.js.map +1 -1
- package/build/npm/esm/package.json +1 -1
- package/build/npm/esm/tracing/previousTrace.js +18 -4
- package/build/npm/esm/tracing/previousTrace.js.map +1 -1
- package/build/npm/types/client.d.ts +1 -0
- package/build/npm/types/client.d.ts.map +1 -1
- package/build/npm/types/index.d.ts +1 -1
- package/build/npm/types/index.d.ts.map +1 -1
- package/build/npm/types/integrations/linkederrors.d.ts.map +1 -1
- package/build/npm/types/log.d.ts.map +1 -1
- package/build/npm/types/tracing/previousTrace.d.ts +1 -0
- package/build/npm/types/tracing/previousTrace.d.ts.map +1 -1
- package/build/npm/types-ts3.8/client.d.ts +1 -0
- package/build/npm/types-ts3.8/index.d.ts +1 -1
- package/build/npm/types-ts3.8/tracing/previousTrace.d.ts +1 -0
- package/package.json +8 -7
package/build/npm/cjs/client.js
CHANGED
|
@@ -4,6 +4,8 @@ const core = require('@sentry/core');
|
|
|
4
4
|
const eventbuilder = require('./eventbuilder.js');
|
|
5
5
|
const helpers = require('./helpers.js');
|
|
6
6
|
|
|
7
|
+
const DEFAULT_FLUSH_INTERVAL = 5000;
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Configuration options for the Sentry Browser SDK.
|
|
9
11
|
* @see @sentry/core Options for more information.
|
|
@@ -16,6 +18,7 @@ const helpers = require('./helpers.js');
|
|
|
16
18
|
* @see SentryClient for usage documentation.
|
|
17
19
|
*/
|
|
18
20
|
class BrowserClient extends core.Client {
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Creates a new Browser SDK instance.
|
|
21
24
|
*
|
|
@@ -32,17 +35,41 @@ class BrowserClient extends core.Client {
|
|
|
32
35
|
|
|
33
36
|
super(opts);
|
|
34
37
|
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
39
|
+
const client = this;
|
|
40
|
+
const { sendDefaultPii, _experiments } = client._options;
|
|
41
|
+
const enableLogs = _experiments?.enableLogs;
|
|
42
|
+
|
|
35
43
|
if (opts.sendClientReports && helpers.WINDOW.document) {
|
|
36
44
|
helpers.WINDOW.document.addEventListener('visibilitychange', () => {
|
|
37
45
|
if (helpers.WINDOW.document.visibilityState === 'hidden') {
|
|
38
46
|
this._flushOutcomes();
|
|
47
|
+
if (enableLogs) {
|
|
48
|
+
core._INTERNAL_flushLogsBuffer(client);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (enableLogs) {
|
|
55
|
+
client.on('flush', () => {
|
|
56
|
+
core._INTERNAL_flushLogsBuffer(client);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
client.on('afterCaptureLog', () => {
|
|
60
|
+
if (client._logFlushIdleTimeout) {
|
|
61
|
+
clearTimeout(client._logFlushIdleTimeout);
|
|
39
62
|
}
|
|
63
|
+
|
|
64
|
+
client._logFlushIdleTimeout = setTimeout(() => {
|
|
65
|
+
core._INTERNAL_flushLogsBuffer(client);
|
|
66
|
+
}, DEFAULT_FLUSH_INTERVAL);
|
|
40
67
|
});
|
|
41
68
|
}
|
|
42
69
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
if (sendDefaultPii) {
|
|
71
|
+
client.on('postprocessEvent', core.addAutoIpAddressToUser);
|
|
72
|
+
client.on('beforeSendSession', core.addAutoIpAddressToSession);
|
|
46
73
|
}
|
|
47
74
|
}
|
|
48
75
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../../src/client.ts"],"sourcesContent":["import type {\n BrowserClientProfilingOptions,\n BrowserClientReplayOptions,\n ClientOptions,\n Event,\n EventHint,\n Options,\n ParameterizedString,\n Scope,\n SeverityLevel,\n} from '@sentry/core';\nimport {\n Client,\n addAutoIpAddressToSession,\n addAutoIpAddressToUser,\n applySdkMetadata,\n getSDKSource,\n} from '@sentry/core';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/core Options for more information.\n */\nexport type BrowserOptions = Options<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /**\n * Important: Only set this option if you know what you are doing!\n *\n * By default, the SDK will check if `Sentry.init` is called in a browser extension.\n * In case it is, it will stop initialization and log a warning\n * because browser extensions require a different Sentry initialization process:\n * https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/\n *\n * Setting up the SDK in a browser extension with global error monitoring is not recommended\n * and will likely flood you with errors from other web sites or extensions. This can heavily\n * impact your quota and cause interference with your and other Sentry SDKs in shared environments.\n *\n * If this check wrongfully flags your setup as a browser extension, you can set this\n * option to `true` to skip the check.\n *\n * @default false\n */\n skipBrowserExtensionCheck?: boolean;\n };\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /** If configured, this URL will be used as base URL for lazy loading integration. */\n cdnBaseUrl?: string;\n };\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends Client<BrowserClientOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserClientOptions) {\n const opts = {\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...options,\n };\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n if (opts.sendClientReports && WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n }\n });\n }\n\n if (
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../../../src/client.ts"],"sourcesContent":["import type {\n BrowserClientProfilingOptions,\n BrowserClientReplayOptions,\n ClientOptions,\n Event,\n EventHint,\n Options,\n ParameterizedString,\n Scope,\n SeverityLevel,\n} from '@sentry/core';\nimport {\n Client,\n addAutoIpAddressToSession,\n addAutoIpAddressToUser,\n applySdkMetadata,\n getSDKSource,\n _INTERNAL_flushLogsBuffer,\n} from '@sentry/core';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/core Options for more information.\n */\nexport type BrowserOptions = Options<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /**\n * Important: Only set this option if you know what you are doing!\n *\n * By default, the SDK will check if `Sentry.init` is called in a browser extension.\n * In case it is, it will stop initialization and log a warning\n * because browser extensions require a different Sentry initialization process:\n * https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/\n *\n * Setting up the SDK in a browser extension with global error monitoring is not recommended\n * and will likely flood you with errors from other web sites or extensions. This can heavily\n * impact your quota and cause interference with your and other Sentry SDKs in shared environments.\n *\n * If this check wrongfully flags your setup as a browser extension, you can set this\n * option to `true` to skip the check.\n *\n * @default false\n */\n skipBrowserExtensionCheck?: boolean;\n };\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /** If configured, this URL will be used as base URL for lazy loading integration. */\n cdnBaseUrl?: string;\n };\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends Client<BrowserClientOptions> {\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserClientOptions) {\n const opts = {\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...options,\n };\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const client = this;\n const { sendDefaultPii, _experiments } = client._options;\n const enableLogs = _experiments?.enableLogs;\n\n if (opts.sendClientReports && WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n if (enableLogs) {\n _INTERNAL_flushLogsBuffer(client);\n }\n }\n });\n }\n\n if (enableLogs) {\n client.on('flush', () => {\n _INTERNAL_flushLogsBuffer(client);\n });\n\n client.on('afterCaptureLog', () => {\n if (client._logFlushIdleTimeout) {\n clearTimeout(client._logFlushIdleTimeout);\n }\n\n client._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(client);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n\n if (sendDefaultPii) {\n client.on('postprocessEvent', addAutoIpAddressToUser);\n client.on('beforeSendSession', addAutoIpAddressToSession);\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(\n message: ParameterizedString,\n level: SeverityLevel = 'info',\n hint?: EventHint,\n ): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n\n return super._prepareEvent(event, hint, currentScope, isolationScope);\n }\n}\n"],"names":["Client","WINDOW","getSDKSource","applySdkMetadata","_INTERNAL_flushLogsBuffer","addAutoIpAddressToUser","addAutoIpAddressToSession","eventFromException","eventFromMessage"],"mappings":";;;;;;AAuBA,MAAM,sBAAA,GAAyB,IAAI;;AAEnC;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAA,SAAsBA,WAAM,CAAuB;;AAEhE;AACA;AACA;AACA;AACA;AACA,GAAS,WAAW,CAAC,OAAO,EAAwB;AACpD,IAAI,MAAM,OAAO;AACjB;AACA,MAAM,0BAA0B,EAAE,IAAI;AACtC,MAAM,GAAG,OAAO;AAChB,KAAK;AACL,IAAI,MAAM,YAAYC,cAAM,CAAC,iBAAkB,IAAGC,iBAAY,EAAE;AAChE,IAAIC,qBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;;AAE7D,IAAI,KAAK,CAAC,IAAI,CAAC;;AAEf;AACA,IAAI,MAAM,MAAO,GAAE,IAAI;AACvB,IAAI,MAAM,EAA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AAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;AACzG;;AAEA;AACA;AACA;AACA,GAAS,gBAAgB;AACzB,IAAI,OAAO;AACX,IAAI,KAAK,GAAkB,MAAM;AACjC,IAAI,IAAI;AACR,IAAwB;AACxB,IAAI,OAAOC,6BAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;AAC5G;;AAEA;AACA;AACA;AACA,GAAY,aAAa;AACzB,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAA+B;AAC/B,IAAI,KAAK,CAAC,QAAS,GAAE,KAAK,CAAC,QAAA,IAAY,YAAY;;AAEnD,IAAI,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC;AACzE;AACA;;;;"}
|
package/build/npm/cjs/index.js
CHANGED
|
@@ -55,6 +55,7 @@ exports.captureFeedback = core.captureFeedback;
|
|
|
55
55
|
exports.captureMessage = core.captureMessage;
|
|
56
56
|
exports.captureSession = core.captureSession;
|
|
57
57
|
exports.close = core.close;
|
|
58
|
+
exports.consoleLoggingIntegration = core.consoleLoggingIntegration;
|
|
58
59
|
exports.continueTrace = core.continueTrace;
|
|
59
60
|
exports.createTransport = core.createTransport;
|
|
60
61
|
exports.dedupeIntegration = core.dedupeIntegration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -21,7 +21,6 @@ const _linkedErrorsIntegration = ((options = {}) => {
|
|
|
21
21
|
// This differs from the LinkedErrors integration in core by using a different exceptionFromError function
|
|
22
22
|
eventbuilder.exceptionFromError,
|
|
23
23
|
options.stackParser,
|
|
24
|
-
options.maxValueLength,
|
|
25
24
|
key,
|
|
26
25
|
limit,
|
|
27
26
|
event,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkederrors.js","sources":["../../../../src/integrations/linkederrors.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { applyAggregateErrorsToEvent, defineIntegration } from '@sentry/core';\nimport { exceptionFromError } from '../eventbuilder';\n\ninterface LinkedErrorsOptions {\n key?: string;\n limit?: number;\n}\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors';\n\nconst _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError,\n options.stackParser,\n
|
|
1
|
+
{"version":3,"file":"linkederrors.js","sources":["../../../../src/integrations/linkederrors.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { applyAggregateErrorsToEvent, defineIntegration } from '@sentry/core';\nimport { exceptionFromError } from '../eventbuilder';\n\ninterface LinkedErrorsOptions {\n key?: string;\n limit?: number;\n}\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors';\n\nconst _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError,\n options.stackParser,\n key,\n limit,\n event,\n hint,\n );\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Aggregrate linked errors in an event.\n */\nexport const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n"],"names":["applyAggregateErrorsToEvent","exceptionFromError","defineIntegration"],"mappings":";;;;;AASA,MAAM,WAAA,GAAc,OAAO;AAC3B,MAAM,aAAA,GAAgB,CAAC;;AAEvB,MAAM,gBAAA,GAAmB,cAAc;;AAEvC,MAAM,wBAAA,IAA4B,CAAC,OAAO,GAAwB,EAAE,KAAK;AACzE,EAAE,MAAM,KAAM,GAAE,OAAO,CAAC,KAAA,IAAS,aAAa;AAC9C,EAAE,MAAM,GAAI,GAAE,OAAO,CAAC,GAAA,IAAO,WAAW;;AAExC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;AACzC,MAAM,MAAM,OAAQ,GAAE,MAAM,CAAC,UAAU,EAAE;;AAEzC,MAAMA,gCAA2B;AACjC;AACA,QAAQC,+BAAkB;AAC1B,QAAQ,OAAO,CAAC,WAAW;AAC3B,QAAQ,GAAG;AACX,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,IAAI;AACZ,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;MACa,uBAAwB,GAAEC,sBAAiB,CAAC,wBAAwB;;;;"}
|
package/build/npm/cjs/log.js
CHANGED
|
@@ -1,53 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
|
-
const helpers = require('./helpers.js');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* TODO: Make this configurable
|
|
8
|
-
*/
|
|
9
|
-
const DEFAULT_FLUSH_INTERVAL = 5000;
|
|
10
|
-
|
|
11
|
-
let timeout;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* This is a global timeout that is used to flush the logs buffer.
|
|
15
|
-
* It is used to ensure that logs are flushed even if the client is not flushed.
|
|
16
|
-
*/
|
|
17
|
-
function startFlushTimeout(client) {
|
|
18
|
-
if (timeout) {
|
|
19
|
-
clearTimeout(timeout);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
timeout = setTimeout(() => {
|
|
23
|
-
core._INTERNAL_flushLogsBuffer(client);
|
|
24
|
-
}, DEFAULT_FLUSH_INTERVAL);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let isClientListenerAdded = false;
|
|
28
|
-
/**
|
|
29
|
-
* This is a function that is used to add a flush listener to the client.
|
|
30
|
-
* It is used to ensure that the logger buffer is flushed when the client is flushed.
|
|
31
|
-
*/
|
|
32
|
-
function addFlushingListeners(client) {
|
|
33
|
-
if (isClientListenerAdded || !client.getOptions()._experiments?.enableLogs) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
isClientListenerAdded = true;
|
|
38
|
-
|
|
39
|
-
if (helpers.WINDOW.document) {
|
|
40
|
-
helpers.WINDOW.document.addEventListener('visibilitychange', () => {
|
|
41
|
-
if (helpers.WINDOW.document.visibilityState === 'hidden') {
|
|
42
|
-
core._INTERNAL_flushLogsBuffer(client);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
client.on('flush', () => {
|
|
48
|
-
core._INTERNAL_flushLogsBuffer(client);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
4
|
|
|
52
5
|
/**
|
|
53
6
|
* Capture a log with the given level.
|
|
@@ -63,14 +16,7 @@ function captureLog(
|
|
|
63
16
|
attributes,
|
|
64
17
|
severityNumber,
|
|
65
18
|
) {
|
|
66
|
-
|
|
67
|
-
if (client) {
|
|
68
|
-
addFlushingListeners(client);
|
|
69
|
-
|
|
70
|
-
startFlushTimeout(client);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
core._INTERNAL_captureLog({ level, message, attributes, severityNumber }, client, undefined);
|
|
19
|
+
core._INTERNAL_captureLog({ level, message, attributes, severityNumber });
|
|
74
20
|
}
|
|
75
21
|
|
|
76
22
|
/**
|
package/build/npm/cjs/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sources":["../../../src/log.ts"],"sourcesContent":["import type { LogSeverityLevel, Log, Client, ParameterizedString } from '@sentry/core';\nimport { getClient, _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer } from '@sentry/core';\n\nimport { WINDOW } from './helpers';\n\n/**\n * TODO: Make this configurable\n */\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\nlet timeout: ReturnType<typeof setTimeout> | undefined;\n\n/**\n * This is a global timeout that is used to flush the logs buffer.\n * It is used to ensure that logs are flushed even if the client is not flushed.\n */\nfunction startFlushTimeout(client: Client): void {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(client);\n }, DEFAULT_FLUSH_INTERVAL);\n}\n\nlet isClientListenerAdded = false;\n/**\n * This is a function that is used to add a flush listener to the client.\n * It is used to ensure that the logger buffer is flushed when the client is flushed.\n */\nfunction addFlushingListeners(client: Client): void {\n if (isClientListenerAdded || !client.getOptions()._experiments?.enableLogs) {\n return;\n }\n\n isClientListenerAdded = true;\n\n if (WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n _INTERNAL_flushLogsBuffer(client);\n }\n });\n }\n\n client.on('flush', () => {\n _INTERNAL_flushLogsBuffer(client);\n });\n}\n\n/**\n * Capture a log with the given level.\n *\n * @param level - The level of the log.\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.\n * @param severityNumber - The severity number of the log.\n */\nfunction captureLog(\n level: LogSeverityLevel,\n message: ParameterizedString,\n attributes?: Log['attributes'],\n severityNumber?: Log['severityNumber'],\n): void {\n const client = getClient();\n if (client) {\n addFlushingListeners(client);\n\n startFlushTimeout(client);\n }\n\n _INTERNAL_captureLog({ level, message, attributes, severityNumber }, client, undefined);\n}\n\n/**\n * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.trace('User clicked submit button', {\n * buttonId: 'submit-form',\n * formId: 'user-profile',\n * timestamp: Date.now()\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.trace(Sentry.logger.fmt`User ${user} navigated to ${page}`, {\n * userId: '123',\n * sessionId: 'abc-xyz'\n * });\n * ```\n */\nexport function trace(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('trace', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.debug('Component mounted', {\n * component: 'UserProfile',\n * props: { userId: 123 },\n * renderTime: 150\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.debug(Sentry.logger.fmt`API request to ${endpoint} failed`, {\n * statusCode: 404,\n * requestId: 'req-123',\n * duration: 250\n * });\n * ```\n */\nexport function debug(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('debug', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.info('User completed checkout', {\n * orderId: 'order-123',\n * amount: 99.99,\n * paymentMethod: 'credit_card'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.info(Sentry.logger.fmt`User ${user} updated profile picture`, {\n * userId: 'user-123',\n * imageSize: '2.5MB',\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function info(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('info', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.warn('Browser compatibility issue detected', {\n * browser: 'Safari',\n * version: '14.0',\n * feature: 'WebRTC',\n * fallback: 'enabled'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.warn(Sentry.logger.fmt`API endpoint ${endpoint} is deprecated`, {\n * recommendedEndpoint: '/api/v2/users',\n * sunsetDate: '2024-12-31',\n * clientVersion: '1.2.3'\n * });\n * ```\n */\nexport function warn(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('warn', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.error('Failed to load user data', {\n * error: 'NetworkError',\n * url: '/api/users/123',\n * statusCode: 500,\n * retryCount: 3\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.error(Sentry.logger.fmt`Payment processing failed for order ${orderId}`, {\n * error: 'InsufficientFunds',\n * amount: 100.00,\n * currency: 'USD',\n * userId: 'user-456'\n * });\n * ```\n */\nexport function error(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('error', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.fatal('Application state corrupted', {\n * lastKnownState: 'authenticated',\n * sessionId: 'session-123',\n * timestamp: Date.now(),\n * recoveryAttempted: true\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.fatal(Sentry.logger.fmt`Critical system failure in ${service}`, {\n * service: 'payment-processor',\n * errorCode: 'CRITICAL_FAILURE',\n * affectedUsers: 150,\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function fatal(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('fatal', message, attributes);\n}\n\nexport { fmt } from '@sentry/core';\n"],"names":["_INTERNAL_flushLogsBuffer","WINDOW","getClient","_INTERNAL_captureLog"],"mappings":";;;;;AAKA;AACA;AACA;AACA,MAAM,sBAAA,GAAyB,IAAI;;AAEnC,IAAI,OAAO;;AAEX;AACA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,MAAM,EAAgB;AACjD,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,YAAY,CAAC,OAAO,CAAC;AACzB;;AAEA,EAAE,UAAU,UAAU,CAAC,MAAM;AAC7B,IAAIA,8BAAyB,CAAC,MAAM,CAAC;AACrC,GAAG,EAAE,sBAAsB,CAAC;AAC5B;;AAEA,IAAI,qBAAA,GAAwB,KAAK;AACjC;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,MAAM,EAAgB;AACpD,EAAE,IAAI,qBAAsB,IAAG,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE;AAC9E,IAAI;AACJ;;AAEA,EAAE,qBAAA,GAAwB,IAAI;;AAE9B,EAAE,IAAIC,cAAM,CAAC,QAAQ,EAAE;AACvB,I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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"log.js","sources":["../../../src/log.ts"],"sourcesContent":["import type { LogSeverityLevel, Log, ParameterizedString } from '@sentry/core';\nimport { _INTERNAL_captureLog } from '@sentry/core';\n\n/**\n * Capture a log with the given level.\n *\n * @param level - The level of the log.\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.\n * @param severityNumber - The severity number of the log.\n */\nfunction captureLog(\n level: LogSeverityLevel,\n message: ParameterizedString,\n attributes?: Log['attributes'],\n severityNumber?: Log['severityNumber'],\n): void {\n _INTERNAL_captureLog({ level, message, attributes, severityNumber });\n}\n\n/**\n * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.trace('User clicked submit button', {\n * buttonId: 'submit-form',\n * formId: 'user-profile',\n * timestamp: Date.now()\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.trace(Sentry.logger.fmt`User ${user} navigated to ${page}`, {\n * userId: '123',\n * sessionId: 'abc-xyz'\n * });\n * ```\n */\nexport function trace(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('trace', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.debug('Component mounted', {\n * component: 'UserProfile',\n * props: { userId: 123 },\n * renderTime: 150\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.debug(Sentry.logger.fmt`API request to ${endpoint} failed`, {\n * statusCode: 404,\n * requestId: 'req-123',\n * duration: 250\n * });\n * ```\n */\nexport function debug(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('debug', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.info('User completed checkout', {\n * orderId: 'order-123',\n * amount: 99.99,\n * paymentMethod: 'credit_card'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.info(Sentry.logger.fmt`User ${user} updated profile picture`, {\n * userId: 'user-123',\n * imageSize: '2.5MB',\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function info(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('info', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.warn('Browser compatibility issue detected', {\n * browser: 'Safari',\n * version: '14.0',\n * feature: 'WebRTC',\n * fallback: 'enabled'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.warn(Sentry.logger.fmt`API endpoint ${endpoint} is deprecated`, {\n * recommendedEndpoint: '/api/v2/users',\n * sunsetDate: '2024-12-31',\n * clientVersion: '1.2.3'\n * });\n * ```\n */\nexport function warn(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('warn', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.error('Failed to load user data', {\n * error: 'NetworkError',\n * url: '/api/users/123',\n * statusCode: 500,\n * retryCount: 3\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.error(Sentry.logger.fmt`Payment processing failed for order ${orderId}`, {\n * error: 'InsufficientFunds',\n * amount: 100.00,\n * currency: 'USD',\n * userId: 'user-456'\n * });\n * ```\n */\nexport function error(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('error', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.fatal('Application state corrupted', {\n * lastKnownState: 'authenticated',\n * sessionId: 'session-123',\n * timestamp: Date.now(),\n * recoveryAttempted: true\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.fatal(Sentry.logger.fmt`Critical system failure in ${service}`, {\n * service: 'payment-processor',\n * errorCode: 'CRITICAL_FAILURE',\n * affectedUsers: 150,\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function fatal(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('fatal', message, attributes);\n}\n\nexport { fmt } from '@sentry/core';\n"],"names":["_INTERNAL_captureLog"],"mappings":";;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU;AACnB,EAAE,KAAK;AACP,EAAE,OAAO;AACT,EAAE,UAAU;AACZ,EAAE,cAAc;AAChB,EAAQ;AACR,EAAEA,yBAAoB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,cAAe,EAAC,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;;;;;;;;;"}
|
|
@@ -18,6 +18,8 @@ const PREVIOUS_TRACE_MAX_DURATION = 3600;
|
|
|
18
18
|
// session storage key
|
|
19
19
|
const PREVIOUS_TRACE_KEY = 'sentry_previous_trace';
|
|
20
20
|
|
|
21
|
+
const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = 'sentry.previous_trace';
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* Adds a previous_trace span link to the passed span if the passed
|
|
23
25
|
* previousTraceInfo is still valid.
|
|
@@ -38,7 +40,8 @@ function addPreviousTraceSpanLink(
|
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
const previousTraceSpanCtx = previousTraceInfo.spanContext;
|
|
44
|
+
if (previousTraceSpanCtx.traceId === spanJson.trace_id) {
|
|
42
45
|
// This means, we're still in the same trace so let's not update the previous trace info
|
|
43
46
|
// or add a link to the current span.
|
|
44
47
|
// Once we move away from the long-lived, route-based trace model, we can remove this cases
|
|
@@ -53,7 +56,7 @@ function addPreviousTraceSpanLink(
|
|
|
53
56
|
if (Date.now() / 1000 - previousTraceInfo.startTimestamp <= PREVIOUS_TRACE_MAX_DURATION) {
|
|
54
57
|
if (debugBuild.DEBUG_BUILD) {
|
|
55
58
|
core.logger.info(
|
|
56
|
-
`Adding previous_trace ${
|
|
59
|
+
`Adding previous_trace ${previousTraceSpanCtx} link to span ${{
|
|
57
60
|
op: spanJson.op,
|
|
58
61
|
...span.spanContext(),
|
|
59
62
|
}}`,
|
|
@@ -61,11 +64,22 @@ function addPreviousTraceSpanLink(
|
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
span.addLink({
|
|
64
|
-
context:
|
|
67
|
+
context: previousTraceSpanCtx,
|
|
65
68
|
attributes: {
|
|
66
69
|
[core.SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE]: 'previous_trace',
|
|
67
70
|
},
|
|
68
71
|
});
|
|
72
|
+
|
|
73
|
+
// TODO: Remove this once EAP can store span links. We currently only set this attribute so that we
|
|
74
|
+
// can obtain the previous trace information from the EAP store. Long-term, EAP will handle
|
|
75
|
+
// span links and then we should remove this again. Also throwing in a TODO(v10), to remind us
|
|
76
|
+
// to check this at v10 time :)
|
|
77
|
+
span.setAttribute(
|
|
78
|
+
PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE,
|
|
79
|
+
`${previousTraceSpanCtx.traceId}-${previousTraceSpanCtx.spanId}-${
|
|
80
|
+
previousTraceSpanCtx.traceFlags === 0x1 ? 1 : 0
|
|
81
|
+
}`,
|
|
82
|
+
);
|
|
69
83
|
}
|
|
70
84
|
|
|
71
85
|
return {
|
|
@@ -101,6 +115,7 @@ function getPreviousTraceFromSessionStorage() {
|
|
|
101
115
|
|
|
102
116
|
exports.PREVIOUS_TRACE_KEY = PREVIOUS_TRACE_KEY;
|
|
103
117
|
exports.PREVIOUS_TRACE_MAX_DURATION = PREVIOUS_TRACE_MAX_DURATION;
|
|
118
|
+
exports.PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE;
|
|
104
119
|
exports.addPreviousTraceSpanLink = addPreviousTraceSpanLink;
|
|
105
120
|
exports.getPreviousTraceFromSessionStorage = getPreviousTraceFromSessionStorage;
|
|
106
121
|
exports.storePreviousTraceInSessionStorage = storePreviousTraceInSessionStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previousTrace.js","sources":["../../../../src/tracing/previousTrace.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { logger, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE, spanToJSON, type SpanContextData } from '@sentry/core';\nimport { WINDOW } from '../exports';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport interface PreviousTraceInfo {\n /**\n * Span context of the previous trace's local root span\n */\n spanContext: SpanContextData;\n\n /**\n * Timestamp in seconds when the previous trace was started\n */\n startTimestamp: number;\n}\n\n// 1h in seconds\nexport const PREVIOUS_TRACE_MAX_DURATION = 3600;\n\n// session storage key\nexport const PREVIOUS_TRACE_KEY = 'sentry_previous_trace';\n\n/**\n * Adds a previous_trace span link to the passed span if the passed\n * previousTraceInfo is still valid.\n *\n * @returns the updated previous trace info (based on the current span/trace) to\n * be used on the next call\n */\nexport function addPreviousTraceSpanLink(\n previousTraceInfo: PreviousTraceInfo | undefined,\n span: Span,\n): PreviousTraceInfo {\n const spanJson = spanToJSON(span);\n\n if (!previousTraceInfo) {\n return {\n spanContext: span.spanContext(),\n startTimestamp: spanJson.start_timestamp,\n };\n }\n\n
|
|
1
|
+
{"version":3,"file":"previousTrace.js","sources":["../../../../src/tracing/previousTrace.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { logger, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE, spanToJSON, type SpanContextData } from '@sentry/core';\nimport { WINDOW } from '../exports';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport interface PreviousTraceInfo {\n /**\n * Span context of the previous trace's local root span\n */\n spanContext: SpanContextData;\n\n /**\n * Timestamp in seconds when the previous trace was started\n */\n startTimestamp: number;\n}\n\n// 1h in seconds\nexport const PREVIOUS_TRACE_MAX_DURATION = 3600;\n\n// session storage key\nexport const PREVIOUS_TRACE_KEY = 'sentry_previous_trace';\n\nexport const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = 'sentry.previous_trace';\n\n/**\n * Adds a previous_trace span link to the passed span if the passed\n * previousTraceInfo is still valid.\n *\n * @returns the updated previous trace info (based on the current span/trace) to\n * be used on the next call\n */\nexport function addPreviousTraceSpanLink(\n previousTraceInfo: PreviousTraceInfo | undefined,\n span: Span,\n): PreviousTraceInfo {\n const spanJson = spanToJSON(span);\n\n if (!previousTraceInfo) {\n return {\n spanContext: span.spanContext(),\n startTimestamp: spanJson.start_timestamp,\n };\n }\n\n const previousTraceSpanCtx = previousTraceInfo.spanContext;\n if (previousTraceSpanCtx.traceId === spanJson.trace_id) {\n // This means, we're still in the same trace so let's not update the previous trace info\n // or add a link to the current span.\n // Once we move away from the long-lived, route-based trace model, we can remove this cases\n return previousTraceInfo;\n }\n\n // Only add the link if the startTimeStamp of the previous trace's root span is within\n // PREVIOUS_TRACE_MAX_DURATION (1h) of the current root span's startTimestamp\n // This is done to\n // - avoid adding links to \"stale\" traces\n // - enable more efficient querying for previous/next traces in Sentry\n if (Date.now() / 1000 - previousTraceInfo.startTimestamp <= PREVIOUS_TRACE_MAX_DURATION) {\n if (DEBUG_BUILD) {\n logger.info(\n `Adding previous_trace ${previousTraceSpanCtx} link to span ${{\n op: spanJson.op,\n ...span.spanContext(),\n }}`,\n );\n }\n\n span.addLink({\n context: previousTraceSpanCtx,\n attributes: {\n [SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE]: 'previous_trace',\n },\n });\n\n // TODO: Remove this once EAP can store span links. We currently only set this attribute so that we\n // can obtain the previous trace information from the EAP store. Long-term, EAP will handle\n // span links and then we should remove this again. Also throwing in a TODO(v10), to remind us\n // to check this at v10 time :)\n span.setAttribute(\n PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE,\n `${previousTraceSpanCtx.traceId}-${previousTraceSpanCtx.spanId}-${\n previousTraceSpanCtx.traceFlags === 0x1 ? 1 : 0\n }`,\n );\n }\n\n return {\n spanContext: span.spanContext(),\n startTimestamp: spanToJSON(span).start_timestamp,\n };\n}\n\n/**\n * Stores @param previousTraceInfo in sessionStorage.\n */\nexport function storePreviousTraceInSessionStorage(previousTraceInfo: PreviousTraceInfo): void {\n try {\n WINDOW.sessionStorage.setItem(PREVIOUS_TRACE_KEY, JSON.stringify(previousTraceInfo));\n } catch (e) {\n // Ignore potential errors (e.g. if sessionStorage is not available)\n DEBUG_BUILD && logger.warn('Could not store previous trace in sessionStorage', e);\n }\n}\n\n/**\n * Retrieves the previous trace from sessionStorage if available.\n */\nexport function getPreviousTraceFromSessionStorage(): PreviousTraceInfo | undefined {\n try {\n const previousTraceInfo = WINDOW.sessionStorage?.getItem(PREVIOUS_TRACE_KEY);\n // @ts-expect-error - intentionally risking JSON.parse throwing when previousTraceInfo is null to save bundle size\n return JSON.parse(previousTraceInfo);\n } catch (e) {\n return undefined;\n }\n}\n"],"names":["spanToJSON","DEBUG_BUILD","logger","SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE","WINDOW"],"mappings":";;;;;;;;;;;;;;AAiBA;AACO,MAAM,2BAA4B,GAAE;;AAE3C;AACO,MAAM,kBAA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;AACA,QAAA,oBAAA,CAAA,UAAA,KAAA,GAAA,GAAA,CAAA,GAAA;AACA,OAAA,CAAA;AACA,KAAA;AACA;;AAEA,EAAA,OAAA;AACA,IAAA,WAAA,EAAA,IAAA,CAAA,WAAA,EAAA;AACA,IAAA,cAAA,EAAAH,eAAA,CAAA,IAAA,CAAA,CAAA,eAAA;AACA,GAAA;AACA;;AAEA;AACA;AACA;AACA,SAAA,kCAAA,CAAA,iBAAA,EAAA;AACA,EAAA,IAAA;AACA,IAAAI,cAAA,CAAA,cAAA,CAAA,OAAA,CAAA,kBAAA,EAAA,IAAA,CAAA,SAAA,CAAA,iBAAA,CAAA,CAAA;AACA,GAAA,CAAA,OAAA,CAAA,EAAA;AACA;AACA,IAAAH,sBAAA,IAAAC,WAAA,CAAA,IAAA,CAAA,kDAAA,EAAA,CAAA,CAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAA,kCAAA,GAAA;AACA,EAAA,IAAA;AACA,IAAA,MAAA,iBAAA,GAAAE,cAAA,CAAA,cAAA,EAAA,OAAA,CAAA,kBAAA,CAAA;AACA;AACA,IAAA,OAAA,IAAA,CAAA,KAAA,CAAA,iBAAA,CAAA;AACA,GAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA;AACA;;;;;;;;;"}
|
package/build/npm/esm/client.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Client, getSDKSource, applySdkMetadata, addAutoIpAddressToUser, addAutoIpAddressToSession } from '@sentry/core';
|
|
1
|
+
import { Client, getSDKSource, applySdkMetadata, _INTERNAL_flushLogsBuffer, addAutoIpAddressToUser, addAutoIpAddressToSession } from '@sentry/core';
|
|
2
2
|
import { eventFromException, eventFromMessage } from './eventbuilder.js';
|
|
3
3
|
import { WINDOW } from './helpers.js';
|
|
4
4
|
|
|
5
|
+
const DEFAULT_FLUSH_INTERVAL = 5000;
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Configuration options for the Sentry Browser SDK.
|
|
7
9
|
* @see @sentry/core Options for more information.
|
|
@@ -14,6 +16,7 @@ import { WINDOW } from './helpers.js';
|
|
|
14
16
|
* @see SentryClient for usage documentation.
|
|
15
17
|
*/
|
|
16
18
|
class BrowserClient extends Client {
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Creates a new Browser SDK instance.
|
|
19
22
|
*
|
|
@@ -30,17 +33,41 @@ class BrowserClient extends Client {
|
|
|
30
33
|
|
|
31
34
|
super(opts);
|
|
32
35
|
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
37
|
+
const client = this;
|
|
38
|
+
const { sendDefaultPii, _experiments } = client._options;
|
|
39
|
+
const enableLogs = _experiments?.enableLogs;
|
|
40
|
+
|
|
33
41
|
if (opts.sendClientReports && WINDOW.document) {
|
|
34
42
|
WINDOW.document.addEventListener('visibilitychange', () => {
|
|
35
43
|
if (WINDOW.document.visibilityState === 'hidden') {
|
|
36
44
|
this._flushOutcomes();
|
|
45
|
+
if (enableLogs) {
|
|
46
|
+
_INTERNAL_flushLogsBuffer(client);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (enableLogs) {
|
|
53
|
+
client.on('flush', () => {
|
|
54
|
+
_INTERNAL_flushLogsBuffer(client);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
client.on('afterCaptureLog', () => {
|
|
58
|
+
if (client._logFlushIdleTimeout) {
|
|
59
|
+
clearTimeout(client._logFlushIdleTimeout);
|
|
37
60
|
}
|
|
61
|
+
|
|
62
|
+
client._logFlushIdleTimeout = setTimeout(() => {
|
|
63
|
+
_INTERNAL_flushLogsBuffer(client);
|
|
64
|
+
}, DEFAULT_FLUSH_INTERVAL);
|
|
38
65
|
});
|
|
39
66
|
}
|
|
40
67
|
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
68
|
+
if (sendDefaultPii) {
|
|
69
|
+
client.on('postprocessEvent', addAutoIpAddressToUser);
|
|
70
|
+
client.on('beforeSendSession', addAutoIpAddressToSession);
|
|
44
71
|
}
|
|
45
72
|
}
|
|
46
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../../src/client.ts"],"sourcesContent":["import type {\n BrowserClientProfilingOptions,\n BrowserClientReplayOptions,\n ClientOptions,\n Event,\n EventHint,\n Options,\n ParameterizedString,\n Scope,\n SeverityLevel,\n} from '@sentry/core';\nimport {\n Client,\n addAutoIpAddressToSession,\n addAutoIpAddressToUser,\n applySdkMetadata,\n getSDKSource,\n} from '@sentry/core';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/core Options for more information.\n */\nexport type BrowserOptions = Options<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /**\n * Important: Only set this option if you know what you are doing!\n *\n * By default, the SDK will check if `Sentry.init` is called in a browser extension.\n * In case it is, it will stop initialization and log a warning\n * because browser extensions require a different Sentry initialization process:\n * https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/\n *\n * Setting up the SDK in a browser extension with global error monitoring is not recommended\n * and will likely flood you with errors from other web sites or extensions. This can heavily\n * impact your quota and cause interference with your and other Sentry SDKs in shared environments.\n *\n * If this check wrongfully flags your setup as a browser extension, you can set this\n * option to `true` to skip the check.\n *\n * @default false\n */\n skipBrowserExtensionCheck?: boolean;\n };\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /** If configured, this URL will be used as base URL for lazy loading integration. */\n cdnBaseUrl?: string;\n };\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends Client<BrowserClientOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserClientOptions) {\n const opts = {\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...options,\n };\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n if (opts.sendClientReports && WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n }\n });\n }\n\n if (
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../../../src/client.ts"],"sourcesContent":["import type {\n BrowserClientProfilingOptions,\n BrowserClientReplayOptions,\n ClientOptions,\n Event,\n EventHint,\n Options,\n ParameterizedString,\n Scope,\n SeverityLevel,\n} from '@sentry/core';\nimport {\n Client,\n addAutoIpAddressToSession,\n addAutoIpAddressToUser,\n applySdkMetadata,\n getSDKSource,\n _INTERNAL_flushLogsBuffer,\n} from '@sentry/core';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/core Options for more information.\n */\nexport type BrowserOptions = Options<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /**\n * Important: Only set this option if you know what you are doing!\n *\n * By default, the SDK will check if `Sentry.init` is called in a browser extension.\n * In case it is, it will stop initialization and log a warning\n * because browser extensions require a different Sentry initialization process:\n * https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/\n *\n * Setting up the SDK in a browser extension with global error monitoring is not recommended\n * and will likely flood you with errors from other web sites or extensions. This can heavily\n * impact your quota and cause interference with your and other Sentry SDKs in shared environments.\n *\n * If this check wrongfully flags your setup as a browser extension, you can set this\n * option to `true` to skip the check.\n *\n * @default false\n */\n skipBrowserExtensionCheck?: boolean;\n };\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions<BrowserTransportOptions> &\n BrowserClientReplayOptions &\n BrowserClientProfilingOptions & {\n /** If configured, this URL will be used as base URL for lazy loading integration. */\n cdnBaseUrl?: string;\n };\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends Client<BrowserClientOptions> {\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserClientOptions) {\n const opts = {\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...options,\n };\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const client = this;\n const { sendDefaultPii, _experiments } = client._options;\n const enableLogs = _experiments?.enableLogs;\n\n if (opts.sendClientReports && WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n if (enableLogs) {\n _INTERNAL_flushLogsBuffer(client);\n }\n }\n });\n }\n\n if (enableLogs) {\n client.on('flush', () => {\n _INTERNAL_flushLogsBuffer(client);\n });\n\n client.on('afterCaptureLog', () => {\n if (client._logFlushIdleTimeout) {\n clearTimeout(client._logFlushIdleTimeout);\n }\n\n client._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(client);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n\n if (sendDefaultPii) {\n client.on('postprocessEvent', addAutoIpAddressToUser);\n client.on('beforeSendSession', addAutoIpAddressToSession);\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(\n message: ParameterizedString,\n level: SeverityLevel = 'info',\n hint?: EventHint,\n ): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n\n return super._prepareEvent(event, hint, currentScope, isolationScope);\n }\n}\n"],"names":[],"mappings":";;;;AAuBA,MAAM,sBAAA,GAAyB,IAAI;;AAEnC;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAA,SAAsB,MAAM,CAAuB;;AAEhE;AACA;AACA;AACA;AACA;AACA,GAAS,WAAW,CAAC,OAAO,EAAwB;AACpD,IAAI,MAAM,OAAO;AACjB;AACA,MAAM,0BAA0B,EAAE,IAAI;AACtC,MAAM,GAAG,OAAO;AAChB,KAAK;AACL,IAAI,MAAM,YAAY,MAAM,CAAC,iBAAkB,IAAG,YAAY,EAAE;AAChE,IAAI,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;;AAE7D,IAAI,KAAK,CAAC,IAAI,CAAC;;AAEf;AACA,IAAI,MAAM,MAAO,GAAE,IAAI;AACvB,IAAI,MAAM,EAAE,cAAc,EAAE,cAAe,GAAE,MAAM,CAAC,QAAQ;AAC5D,IAAI,MAAM,UAAA,GAAa,YAAY,EAAE,UAAU;;AAE/C,IAAI,IAAI,IAAI,CAAC,qBAAqB,MAAM,CAAC,QAAQ,EAAE;AACnD,MAAM,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,kBAAk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CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;AAC5G;;AAEA;AACA;AACA;AACA,GAAY,aAAa;AACzB,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAA+B;AAC/B,IAAI,KAAK,CAAC,QAAS,GAAE,KAAK,CAAC,QAAA,IAAY,YAAY;;AAEnD,IAAI,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC;AACzE;AACA;;;;"}
|
package/build/npm/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, captureConsoleIntegration, captureEvent, captureException, captureFeedback, captureMessage, captureSession, close, continueTrace, createTransport, dedupeIntegration, endSession, eventFiltersIntegration, extraErrorDataIntegration, flush, functionToStringIntegration, getActiveSpan, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSpanDescendants, getSpanStatusFromHttpCode, inboundFiltersIntegration, isInitialized, lastEventId, makeMultiplexedTransport, moduleMetadataIntegration, parameterize, registerSpanErrorInstrumentation, rewriteFramesIntegration, setContext, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, spanToBaggageHeader, spanToJSON, spanToTraceHeader, startInactiveSpan, startNewTrace, startSession, startSpan, startSpanManual, suppressTracing, thirdPartyErrorFilterIntegration, updateSpanName, withActiveSpan, withIsolationScope, withScope, zodErrorsIntegration } from '@sentry/core';
|
|
1
|
+
export { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, Scope, addBreadcrumb, addEventProcessor, addIntegration, captureConsoleIntegration, captureEvent, captureException, captureFeedback, captureMessage, captureSession, close, consoleLoggingIntegration, continueTrace, createTransport, dedupeIntegration, endSession, eventFiltersIntegration, extraErrorDataIntegration, flush, functionToStringIntegration, getActiveSpan, getClient, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, getSpanDescendants, getSpanStatusFromHttpCode, inboundFiltersIntegration, isInitialized, lastEventId, makeMultiplexedTransport, moduleMetadataIntegration, parameterize, registerSpanErrorInstrumentation, rewriteFramesIntegration, setContext, setCurrentClient, setExtra, setExtras, setHttpStatus, setMeasurement, setTag, setTags, setUser, spanToBaggageHeader, spanToJSON, spanToTraceHeader, startInactiveSpan, startNewTrace, startSession, startSpan, startSpanManual, suppressTracing, thirdPartyErrorFilterIntegration, updateSpanName, withActiveSpan, withIsolationScope, withScope, zodErrorsIntegration } from '@sentry/core';
|
|
2
2
|
export { WINDOW } from './helpers.js';
|
|
3
3
|
export { BrowserClient } from './client.js';
|
|
4
4
|
export { makeFetchTransport } from './transports/fetch.js';
|
|
@@ -19,7 +19,6 @@ const _linkedErrorsIntegration = ((options = {}) => {
|
|
|
19
19
|
// This differs from the LinkedErrors integration in core by using a different exceptionFromError function
|
|
20
20
|
exceptionFromError,
|
|
21
21
|
options.stackParser,
|
|
22
|
-
options.maxValueLength,
|
|
23
22
|
key,
|
|
24
23
|
limit,
|
|
25
24
|
event,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkederrors.js","sources":["../../../../src/integrations/linkederrors.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { applyAggregateErrorsToEvent, defineIntegration } from '@sentry/core';\nimport { exceptionFromError } from '../eventbuilder';\n\ninterface LinkedErrorsOptions {\n key?: string;\n limit?: number;\n}\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors';\n\nconst _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError,\n options.stackParser,\n
|
|
1
|
+
{"version":3,"file":"linkederrors.js","sources":["../../../../src/integrations/linkederrors.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { applyAggregateErrorsToEvent, defineIntegration } from '@sentry/core';\nimport { exceptionFromError } from '../eventbuilder';\n\ninterface LinkedErrorsOptions {\n key?: string;\n limit?: number;\n}\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors';\n\nconst _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError,\n options.stackParser,\n key,\n limit,\n event,\n hint,\n );\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Aggregrate linked errors in an event.\n */\nexport const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n"],"names":[],"mappings":";;;AASA,MAAM,WAAA,GAAc,OAAO;AAC3B,MAAM,aAAA,GAAgB,CAAC;;AAEvB,MAAM,gBAAA,GAAmB,cAAc;;AAEvC,MAAM,wBAAA,IAA4B,CAAC,OAAO,GAAwB,EAAE,KAAK;AACzE,EAAE,MAAM,KAAM,GAAE,OAAO,CAAC,KAAA,IAAS,aAAa;AAC9C,EAAE,MAAM,GAAI,GAAE,OAAO,CAAC,GAAA,IAAO,WAAW;;AAExC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;AACzC,MAAM,MAAM,OAAQ,GAAE,MAAM,CAAC,UAAU,EAAE;;AAEzC,MAAM,2BAA2B;AACjC;AACA,QAAQ,kBAAkB;AAC1B,QAAQ,OAAO,CAAC,WAAW;AAC3B,QAAQ,GAAG;AACX,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,IAAI;AACZ,OAAO;AACP,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;MACa,uBAAwB,GAAE,iBAAiB,CAAC,wBAAwB;;;;"}
|
package/build/npm/esm/log.js
CHANGED
|
@@ -1,52 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _INTERNAL_captureLog } from '@sentry/core';
|
|
2
2
|
export { fmt } from '@sentry/core';
|
|
3
|
-
import { WINDOW } from './helpers.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* TODO: Make this configurable
|
|
7
|
-
*/
|
|
8
|
-
const DEFAULT_FLUSH_INTERVAL = 5000;
|
|
9
|
-
|
|
10
|
-
let timeout;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* This is a global timeout that is used to flush the logs buffer.
|
|
14
|
-
* It is used to ensure that logs are flushed even if the client is not flushed.
|
|
15
|
-
*/
|
|
16
|
-
function startFlushTimeout(client) {
|
|
17
|
-
if (timeout) {
|
|
18
|
-
clearTimeout(timeout);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
timeout = setTimeout(() => {
|
|
22
|
-
_INTERNAL_flushLogsBuffer(client);
|
|
23
|
-
}, DEFAULT_FLUSH_INTERVAL);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let isClientListenerAdded = false;
|
|
27
|
-
/**
|
|
28
|
-
* This is a function that is used to add a flush listener to the client.
|
|
29
|
-
* It is used to ensure that the logger buffer is flushed when the client is flushed.
|
|
30
|
-
*/
|
|
31
|
-
function addFlushingListeners(client) {
|
|
32
|
-
if (isClientListenerAdded || !client.getOptions()._experiments?.enableLogs) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
isClientListenerAdded = true;
|
|
37
|
-
|
|
38
|
-
if (WINDOW.document) {
|
|
39
|
-
WINDOW.document.addEventListener('visibilitychange', () => {
|
|
40
|
-
if (WINDOW.document.visibilityState === 'hidden') {
|
|
41
|
-
_INTERNAL_flushLogsBuffer(client);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
client.on('flush', () => {
|
|
47
|
-
_INTERNAL_flushLogsBuffer(client);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
3
|
|
|
51
4
|
/**
|
|
52
5
|
* Capture a log with the given level.
|
|
@@ -62,14 +15,7 @@ function captureLog(
|
|
|
62
15
|
attributes,
|
|
63
16
|
severityNumber,
|
|
64
17
|
) {
|
|
65
|
-
|
|
66
|
-
if (client) {
|
|
67
|
-
addFlushingListeners(client);
|
|
68
|
-
|
|
69
|
-
startFlushTimeout(client);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
_INTERNAL_captureLog({ level, message, attributes, severityNumber }, client, undefined);
|
|
18
|
+
_INTERNAL_captureLog({ level, message, attributes, severityNumber });
|
|
73
19
|
}
|
|
74
20
|
|
|
75
21
|
/**
|
package/build/npm/esm/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sources":["../../../src/log.ts"],"sourcesContent":["import type { LogSeverityLevel, Log, Client, ParameterizedString } from '@sentry/core';\nimport { getClient, _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer } from '@sentry/core';\n\nimport { WINDOW } from './helpers';\n\n/**\n * TODO: Make this configurable\n */\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\nlet timeout: ReturnType<typeof setTimeout> | undefined;\n\n/**\n * This is a global timeout that is used to flush the logs buffer.\n * It is used to ensure that logs are flushed even if the client is not flushed.\n */\nfunction startFlushTimeout(client: Client): void {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(client);\n }, DEFAULT_FLUSH_INTERVAL);\n}\n\nlet isClientListenerAdded = false;\n/**\n * This is a function that is used to add a flush listener to the client.\n * It is used to ensure that the logger buffer is flushed when the client is flushed.\n */\nfunction addFlushingListeners(client: Client): void {\n if (isClientListenerAdded || !client.getOptions()._experiments?.enableLogs) {\n return;\n }\n\n isClientListenerAdded = true;\n\n if (WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n _INTERNAL_flushLogsBuffer(client);\n }\n });\n }\n\n client.on('flush', () => {\n _INTERNAL_flushLogsBuffer(client);\n });\n}\n\n/**\n * Capture a log with the given level.\n *\n * @param level - The level of the log.\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.\n * @param severityNumber - The severity number of the log.\n */\nfunction captureLog(\n level: LogSeverityLevel,\n message: ParameterizedString,\n attributes?: Log['attributes'],\n severityNumber?: Log['severityNumber'],\n): void {\n const client = getClient();\n if (client) {\n addFlushingListeners(client);\n\n startFlushTimeout(client);\n }\n\n _INTERNAL_captureLog({ level, message, attributes, severityNumber }, client, undefined);\n}\n\n/**\n * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.trace('User clicked submit button', {\n * buttonId: 'submit-form',\n * formId: 'user-profile',\n * timestamp: Date.now()\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.trace(Sentry.logger.fmt`User ${user} navigated to ${page}`, {\n * userId: '123',\n * sessionId: 'abc-xyz'\n * });\n * ```\n */\nexport function trace(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('trace', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.debug('Component mounted', {\n * component: 'UserProfile',\n * props: { userId: 123 },\n * renderTime: 150\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.debug(Sentry.logger.fmt`API request to ${endpoint} failed`, {\n * statusCode: 404,\n * requestId: 'req-123',\n * duration: 250\n * });\n * ```\n */\nexport function debug(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('debug', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.info('User completed checkout', {\n * orderId: 'order-123',\n * amount: 99.99,\n * paymentMethod: 'credit_card'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.info(Sentry.logger.fmt`User ${user} updated profile picture`, {\n * userId: 'user-123',\n * imageSize: '2.5MB',\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function info(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('info', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.warn('Browser compatibility issue detected', {\n * browser: 'Safari',\n * version: '14.0',\n * feature: 'WebRTC',\n * fallback: 'enabled'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.warn(Sentry.logger.fmt`API endpoint ${endpoint} is deprecated`, {\n * recommendedEndpoint: '/api/v2/users',\n * sunsetDate: '2024-12-31',\n * clientVersion: '1.2.3'\n * });\n * ```\n */\nexport function warn(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('warn', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.error('Failed to load user data', {\n * error: 'NetworkError',\n * url: '/api/users/123',\n * statusCode: 500,\n * retryCount: 3\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.error(Sentry.logger.fmt`Payment processing failed for order ${orderId}`, {\n * error: 'InsufficientFunds',\n * amount: 100.00,\n * currency: 'USD',\n * userId: 'user-456'\n * });\n * ```\n */\nexport function error(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('error', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.fatal('Application state corrupted', {\n * lastKnownState: 'authenticated',\n * sessionId: 'session-123',\n * timestamp: Date.now(),\n * recoveryAttempted: true\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.fatal(Sentry.logger.fmt`Critical system failure in ${service}`, {\n * service: 'payment-processor',\n * errorCode: 'CRITICAL_FAILURE',\n * affectedUsers: 150,\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function fatal(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('fatal', message, attributes);\n}\n\nexport { fmt } from '@sentry/core';\n"],"names":[],"mappings":";;;;AAKA;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E,oBAAoB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,CAAC;AACzF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;;;"}
|
|
1
|
+
{"version":3,"file":"log.js","sources":["../../../src/log.ts"],"sourcesContent":["import type { LogSeverityLevel, Log, ParameterizedString } from '@sentry/core';\nimport { _INTERNAL_captureLog } from '@sentry/core';\n\n/**\n * Capture a log with the given level.\n *\n * @param level - The level of the log.\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., userId: 100.\n * @param severityNumber - The severity number of the log.\n */\nfunction captureLog(\n level: LogSeverityLevel,\n message: ParameterizedString,\n attributes?: Log['attributes'],\n severityNumber?: Log['severityNumber'],\n): void {\n _INTERNAL_captureLog({ level, message, attributes, severityNumber });\n}\n\n/**\n * @summary Capture a log with the `trace` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { userId: 100, route: '/dashboard' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.trace('User clicked submit button', {\n * buttonId: 'submit-form',\n * formId: 'user-profile',\n * timestamp: Date.now()\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.trace(Sentry.logger.fmt`User ${user} navigated to ${page}`, {\n * userId: '123',\n * sessionId: 'abc-xyz'\n * });\n * ```\n */\nexport function trace(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('trace', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `debug` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { component: 'Header', state: 'loading' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.debug('Component mounted', {\n * component: 'UserProfile',\n * props: { userId: 123 },\n * renderTime: 150\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.debug(Sentry.logger.fmt`API request to ${endpoint} failed`, {\n * statusCode: 404,\n * requestId: 'req-123',\n * duration: 250\n * });\n * ```\n */\nexport function debug(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('debug', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `info` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { feature: 'checkout', status: 'completed' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.info('User completed checkout', {\n * orderId: 'order-123',\n * amount: 99.99,\n * paymentMethod: 'credit_card'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.info(Sentry.logger.fmt`User ${user} updated profile picture`, {\n * userId: 'user-123',\n * imageSize: '2.5MB',\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function info(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('info', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `warn` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { browser: 'Chrome', version: '91.0' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.warn('Browser compatibility issue detected', {\n * browser: 'Safari',\n * version: '14.0',\n * feature: 'WebRTC',\n * fallback: 'enabled'\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.warn(Sentry.logger.fmt`API endpoint ${endpoint} is deprecated`, {\n * recommendedEndpoint: '/api/v2/users',\n * sunsetDate: '2024-12-31',\n * clientVersion: '1.2.3'\n * });\n * ```\n */\nexport function warn(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('warn', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `error` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { error: 'NetworkError', url: '/api/data' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.error('Failed to load user data', {\n * error: 'NetworkError',\n * url: '/api/users/123',\n * statusCode: 500,\n * retryCount: 3\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.error(Sentry.logger.fmt`Payment processing failed for order ${orderId}`, {\n * error: 'InsufficientFunds',\n * amount: 100.00,\n * currency: 'USD',\n * userId: 'user-456'\n * });\n * ```\n */\nexport function error(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('error', message, attributes);\n}\n\n/**\n * @summary Capture a log with the `fatal` level. Requires `_experiments.enableLogs` to be enabled.\n *\n * @param message - The message to log.\n * @param attributes - Arbitrary structured data that stores information about the log - e.g., { appState: 'corrupted', sessionId: 'abc-123' }.\n *\n * @example\n *\n * ```\n * Sentry.logger.fatal('Application state corrupted', {\n * lastKnownState: 'authenticated',\n * sessionId: 'session-123',\n * timestamp: Date.now(),\n * recoveryAttempted: true\n * });\n * ```\n *\n * @example With template strings\n *\n * ```\n * Sentry.logger.fatal(Sentry.logger.fmt`Critical system failure in ${service}`, {\n * service: 'payment-processor',\n * errorCode: 'CRITICAL_FAILURE',\n * affectedUsers: 150,\n * timestamp: Date.now()\n * });\n * ```\n */\nexport function fatal(message: ParameterizedString, attributes?: Log['attributes']): void {\n captureLog('fatal', message, attributes);\n}\n\nexport { fmt } from '@sentry/core';\n"],"names":[],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU;AACnB,EAAE,KAAK;AACP,EAAE,OAAO;AACT,EAAE,UAAU;AACZ,EAAE,cAAc;AAChB,EAAQ;AACR,EAAE,oBAAoB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,cAAe,EAAC,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB,UAAU,EAA4B;AACzF,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,KAAK,CAAC,OAAO,EAAuB,UAAU,EAA4B;AAC1F,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;AAC1C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"9.
|
|
1
|
+
{"type":"module","version":"9.11.0","sideEffects":false}
|
|
@@ -16,6 +16,8 @@ const PREVIOUS_TRACE_MAX_DURATION = 3600;
|
|
|
16
16
|
// session storage key
|
|
17
17
|
const PREVIOUS_TRACE_KEY = 'sentry_previous_trace';
|
|
18
18
|
|
|
19
|
+
const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = 'sentry.previous_trace';
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* Adds a previous_trace span link to the passed span if the passed
|
|
21
23
|
* previousTraceInfo is still valid.
|
|
@@ -36,7 +38,8 @@ function addPreviousTraceSpanLink(
|
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
const previousTraceSpanCtx = previousTraceInfo.spanContext;
|
|
42
|
+
if (previousTraceSpanCtx.traceId === spanJson.trace_id) {
|
|
40
43
|
// This means, we're still in the same trace so let's not update the previous trace info
|
|
41
44
|
// or add a link to the current span.
|
|
42
45
|
// Once we move away from the long-lived, route-based trace model, we can remove this cases
|
|
@@ -51,7 +54,7 @@ function addPreviousTraceSpanLink(
|
|
|
51
54
|
if (Date.now() / 1000 - previousTraceInfo.startTimestamp <= PREVIOUS_TRACE_MAX_DURATION) {
|
|
52
55
|
if (DEBUG_BUILD) {
|
|
53
56
|
logger.info(
|
|
54
|
-
`Adding previous_trace ${
|
|
57
|
+
`Adding previous_trace ${previousTraceSpanCtx} link to span ${{
|
|
55
58
|
op: spanJson.op,
|
|
56
59
|
...span.spanContext(),
|
|
57
60
|
}}`,
|
|
@@ -59,11 +62,22 @@ function addPreviousTraceSpanLink(
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
span.addLink({
|
|
62
|
-
context:
|
|
65
|
+
context: previousTraceSpanCtx,
|
|
63
66
|
attributes: {
|
|
64
67
|
[SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE]: 'previous_trace',
|
|
65
68
|
},
|
|
66
69
|
});
|
|
70
|
+
|
|
71
|
+
// TODO: Remove this once EAP can store span links. We currently only set this attribute so that we
|
|
72
|
+
// can obtain the previous trace information from the EAP store. Long-term, EAP will handle
|
|
73
|
+
// span links and then we should remove this again. Also throwing in a TODO(v10), to remind us
|
|
74
|
+
// to check this at v10 time :)
|
|
75
|
+
span.setAttribute(
|
|
76
|
+
PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE,
|
|
77
|
+
`${previousTraceSpanCtx.traceId}-${previousTraceSpanCtx.spanId}-${
|
|
78
|
+
previousTraceSpanCtx.traceFlags === 0x1 ? 1 : 0
|
|
79
|
+
}`,
|
|
80
|
+
);
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
return {
|
|
@@ -97,5 +111,5 @@ function getPreviousTraceFromSessionStorage() {
|
|
|
97
111
|
}
|
|
98
112
|
}
|
|
99
113
|
|
|
100
|
-
export { PREVIOUS_TRACE_KEY, PREVIOUS_TRACE_MAX_DURATION, addPreviousTraceSpanLink, getPreviousTraceFromSessionStorage, storePreviousTraceInSessionStorage };
|
|
114
|
+
export { PREVIOUS_TRACE_KEY, PREVIOUS_TRACE_MAX_DURATION, PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE, addPreviousTraceSpanLink, getPreviousTraceFromSessionStorage, storePreviousTraceInSessionStorage };
|
|
101
115
|
//# sourceMappingURL=previousTrace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previousTrace.js","sources":["../../../../src/tracing/previousTrace.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { logger, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE, spanToJSON, type SpanContextData } from '@sentry/core';\nimport { WINDOW } from '../exports';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport interface PreviousTraceInfo {\n /**\n * Span context of the previous trace's local root span\n */\n spanContext: SpanContextData;\n\n /**\n * Timestamp in seconds when the previous trace was started\n */\n startTimestamp: number;\n}\n\n// 1h in seconds\nexport const PREVIOUS_TRACE_MAX_DURATION = 3600;\n\n// session storage key\nexport const PREVIOUS_TRACE_KEY = 'sentry_previous_trace';\n\n/**\n * Adds a previous_trace span link to the passed span if the passed\n * previousTraceInfo is still valid.\n *\n * @returns the updated previous trace info (based on the current span/trace) to\n * be used on the next call\n */\nexport function addPreviousTraceSpanLink(\n previousTraceInfo: PreviousTraceInfo | undefined,\n span: Span,\n): PreviousTraceInfo {\n const spanJson = spanToJSON(span);\n\n if (!previousTraceInfo) {\n return {\n spanContext: span.spanContext(),\n startTimestamp: spanJson.start_timestamp,\n };\n }\n\n
|
|
1
|
+
{"version":3,"file":"previousTrace.js","sources":["../../../../src/tracing/previousTrace.ts"],"sourcesContent":["import type { Span } from '@sentry/core';\nimport { logger, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE, spanToJSON, type SpanContextData } from '@sentry/core';\nimport { WINDOW } from '../exports';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport interface PreviousTraceInfo {\n /**\n * Span context of the previous trace's local root span\n */\n spanContext: SpanContextData;\n\n /**\n * Timestamp in seconds when the previous trace was started\n */\n startTimestamp: number;\n}\n\n// 1h in seconds\nexport const PREVIOUS_TRACE_MAX_DURATION = 3600;\n\n// session storage key\nexport const PREVIOUS_TRACE_KEY = 'sentry_previous_trace';\n\nexport const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = 'sentry.previous_trace';\n\n/**\n * Adds a previous_trace span link to the passed span if the passed\n * previousTraceInfo is still valid.\n *\n * @returns the updated previous trace info (based on the current span/trace) to\n * be used on the next call\n */\nexport function addPreviousTraceSpanLink(\n previousTraceInfo: PreviousTraceInfo | undefined,\n span: Span,\n): PreviousTraceInfo {\n const spanJson = spanToJSON(span);\n\n if (!previousTraceInfo) {\n return {\n spanContext: span.spanContext(),\n startTimestamp: spanJson.start_timestamp,\n };\n }\n\n const previousTraceSpanCtx = previousTraceInfo.spanContext;\n if (previousTraceSpanCtx.traceId === spanJson.trace_id) {\n // This means, we're still in the same trace so let's not update the previous trace info\n // or add a link to the current span.\n // Once we move away from the long-lived, route-based trace model, we can remove this cases\n return previousTraceInfo;\n }\n\n // Only add the link if the startTimeStamp of the previous trace's root span is within\n // PREVIOUS_TRACE_MAX_DURATION (1h) of the current root span's startTimestamp\n // This is done to\n // - avoid adding links to \"stale\" traces\n // - enable more efficient querying for previous/next traces in Sentry\n if (Date.now() / 1000 - previousTraceInfo.startTimestamp <= PREVIOUS_TRACE_MAX_DURATION) {\n if (DEBUG_BUILD) {\n logger.info(\n `Adding previous_trace ${previousTraceSpanCtx} link to span ${{\n op: spanJson.op,\n ...span.spanContext(),\n }}`,\n );\n }\n\n span.addLink({\n context: previousTraceSpanCtx,\n attributes: {\n [SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE]: 'previous_trace',\n },\n });\n\n // TODO: Remove this once EAP can store span links. We currently only set this attribute so that we\n // can obtain the previous trace information from the EAP store. Long-term, EAP will handle\n // span links and then we should remove this again. Also throwing in a TODO(v10), to remind us\n // to check this at v10 time :)\n span.setAttribute(\n PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE,\n `${previousTraceSpanCtx.traceId}-${previousTraceSpanCtx.spanId}-${\n previousTraceSpanCtx.traceFlags === 0x1 ? 1 : 0\n }`,\n );\n }\n\n return {\n spanContext: span.spanContext(),\n startTimestamp: spanToJSON(span).start_timestamp,\n };\n}\n\n/**\n * Stores @param previousTraceInfo in sessionStorage.\n */\nexport function storePreviousTraceInSessionStorage(previousTraceInfo: PreviousTraceInfo): void {\n try {\n WINDOW.sessionStorage.setItem(PREVIOUS_TRACE_KEY, JSON.stringify(previousTraceInfo));\n } catch (e) {\n // Ignore potential errors (e.g. if sessionStorage is not available)\n DEBUG_BUILD && logger.warn('Could not store previous trace in sessionStorage', e);\n }\n}\n\n/**\n * Retrieves the previous trace from sessionStorage if available.\n */\nexport function getPreviousTraceFromSessionStorage(): PreviousTraceInfo | undefined {\n try {\n const previousTraceInfo = WINDOW.sessionStorage?.getItem(PREVIOUS_TRACE_KEY);\n // @ts-expect-error - intentionally risking JSON.parse throwing when previousTraceInfo is null to save bundle size\n return JSON.parse(previousTraceInfo);\n } catch (e) {\n return undefined;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAiBA;AACO,MAAM,2BAA4B,GAAE;;AAE3C;AACO,MAAM,kBAAmB,GAAE;;AAE3B,MAAM,iCAAkC,GAAE;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB;AACxC,EAAE,iBAAiB;AACnB,EAAE,IAAI;AACN,EAAqB;AACrB,EAAE,MAAM,QAAS,GAAE,UAAU,CAAC,IAAI,CAAC;;AAEnC,EAAE,IAAI,CAAC,iBAAiB,EAAE;AAC1B,IAAI,OAAO;AACX,MAAM,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;AACrC,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe;AAC9C,KAAK;AACL;;AAEA,EAAE,MAAM,oBAAA,GAAuB,iBAAiB,CAAC,WAAW;AAC5D,EAAE,IAAI,oBAAoB,CAAC,YAAY,QAAQ,CAAC,QAAQ,EAAE;AAC1D;AACA;AACA;AACA,IAAI,OAAO,iBAAiB;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI,IAAI,CAAC,GAAG,EAAC,GAAI,IAAA,GAAO,iBAAiB,CAAC,cAAe,IAAG,2BAA2B,EAAE;AAC3F,IAAI,IAAI,WAAW,EAAE;AACrB,MA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AA,iBAAA,CAAA;AACA,GAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA;AACA;;;;"}
|
|
@@ -40,6 +40,7 @@ export type BrowserClientOptions = ClientOptions<BrowserTransportOptions> & Brow
|
|
|
40
40
|
* @see SentryClient for usage documentation.
|
|
41
41
|
*/
|
|
42
42
|
export declare class BrowserClient extends Client<BrowserClientOptions> {
|
|
43
|
+
private _logFlushIdleTimeout;
|
|
43
44
|
/**
|
|
44
45
|
* Creates a new Browser SDK instance.
|
|
45
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,aAAa,EACb,KAAK,EACL,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,KAAK,EACL,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,aAAa,EACb,KAAK,EACL,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,KAAK,EACL,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,MAAM,EAMP,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAIlE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,GAC3D,0BAA0B,GAC1B,6BAA6B,GAAG;IAC9B;;;;;;;;;;;;;;;;OAgBG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,uBAAuB,CAAC,GACvE,0BAA0B,GAC1B,6BAA6B,GAAG;IAC9B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEJ;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,MAAM,CAAC,oBAAoB,CAAC;IAC7D,OAAO,CAAC,oBAAoB,CAA4C;IACxE;;;;OAIG;gBACgB,OAAO,EAAE,oBAAoB;IAiDhD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAInF;;OAEG;IACI,gBAAgB,CACrB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,GAAE,aAAsB,EAC7B,IAAI,CAAC,EAAE,SAAS,GACf,WAAW,CAAC,KAAK,CAAC;IAIrB;;OAEG;IACH,SAAS,CAAC,aAAa,CACrB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,KAAK,EACnB,cAAc,EAAE,KAAK,GACpB,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;CAK7B"}
|
|
@@ -5,7 +5,7 @@ export { reportingObserverIntegration } from './integrations/reportingobserver';
|
|
|
5
5
|
export { httpClientIntegration } from './integrations/httpclient';
|
|
6
6
|
export { contextLinesIntegration } from './integrations/contextlines';
|
|
7
7
|
export { graphqlClientIntegration } from './integrations/graphqlClient';
|
|
8
|
-
export { captureConsoleIntegration, extraErrorDataIntegration, rewriteFramesIntegration, captureFeedback, } from '@sentry/core';
|
|
8
|
+
export { captureConsoleIntegration, extraErrorDataIntegration, rewriteFramesIntegration, captureFeedback, consoleLoggingIntegration, } from '@sentry/core';
|
|
9
9
|
export { replayIntegration, getReplay } from '@sentry-internal/replay';
|
|
10
10
|
export type { ReplayEventType, ReplayEventWithTime, ReplayBreadcrumbFrame, ReplayBreadcrumbFrameEvent, ReplayOptionFrameEvent, ReplayFrame, ReplayFrameEvent, ReplaySpanFrame, ReplaySpanFrameEvent, } from '@sentry-internal/replay';
|
|
11
11
|
export { replayCanvasIntegration } from '@sentry-internal/replay-canvas';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,MAAM,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,MAAM,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,eAAe,EACf,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACvE,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM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;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkederrors.d.ts","sourceRoot":"","sources":["../../../../src/integrations/linkederrors.ts"],"names":[],"mappings":"AAIA,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"linkederrors.d.ts","sourceRoot":"","sources":["../../../../src/integrations/linkederrors.ts"],"names":[],"mappings":"AAIA,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA6BD;;GAEG;AACH,eAAO,MAAM,uBAAuB,mFAA8C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,GAAG,
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,GAAG,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAoB/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAEvF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAEvF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAExF;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -12,6 +12,7 @@ export interface PreviousTraceInfo {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const PREVIOUS_TRACE_MAX_DURATION = 3600;
|
|
14
14
|
export declare const PREVIOUS_TRACE_KEY = "sentry_previous_trace";
|
|
15
|
+
export declare const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = "sentry.previous_trace";
|
|
15
16
|
/**
|
|
16
17
|
* Adds a previous_trace span link to the passed span if the passed
|
|
17
18
|
* previousTraceInfo is still valid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previousTrace.d.ts","sourceRoot":"","sources":["../../../../src/tracing/previousTrace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAI3G,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC;IAE7B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAGD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,EAChD,IAAI,EAAE,IAAI,GACT,iBAAiB,
|
|
1
|
+
{"version":3,"file":"previousTrace.d.ts","sourceRoot":"","sources":["../../../../src/tracing/previousTrace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAyD,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAI3G,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC;IAE7B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAGD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,iCAAiC,0BAA0B,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,EAChD,IAAI,EAAE,IAAI,GACT,iBAAiB,CAwDnB;AAED;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAO7F;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,iBAAiB,GAAG,SAAS,CAQlF"}
|
|
@@ -40,6 +40,7 @@ export type BrowserClientOptions = ClientOptions<BrowserTransportOptions> & Brow
|
|
|
40
40
|
* @see SentryClient for usage documentation.
|
|
41
41
|
*/
|
|
42
42
|
export declare class BrowserClient extends Client<BrowserClientOptions> {
|
|
43
|
+
private _logFlushIdleTimeout;
|
|
43
44
|
/**
|
|
44
45
|
* Creates a new Browser SDK instance.
|
|
45
46
|
*
|
|
@@ -5,7 +5,7 @@ export { reportingObserverIntegration } from './integrations/reportingobserver';
|
|
|
5
5
|
export { httpClientIntegration } from './integrations/httpclient';
|
|
6
6
|
export { contextLinesIntegration } from './integrations/contextlines';
|
|
7
7
|
export { graphqlClientIntegration } from './integrations/graphqlClient';
|
|
8
|
-
export { captureConsoleIntegration, extraErrorDataIntegration, rewriteFramesIntegration, captureFeedback, } from '@sentry/core';
|
|
8
|
+
export { captureConsoleIntegration, extraErrorDataIntegration, rewriteFramesIntegration, captureFeedback, consoleLoggingIntegration, } from '@sentry/core';
|
|
9
9
|
export { replayIntegration, getReplay } from '@sentry-internal/replay';
|
|
10
10
|
export { ReplayEventType, ReplayEventWithTime, ReplayBreadcrumbFrame, ReplayBreadcrumbFrameEvent, ReplayOptionFrameEvent, ReplayFrame, ReplayFrameEvent, ReplaySpanFrame, ReplaySpanFrameEvent, } from '@sentry-internal/replay';
|
|
11
11
|
export { replayCanvasIntegration } from '@sentry-internal/replay-canvas';
|
|
@@ -12,6 +12,7 @@ export interface PreviousTraceInfo {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const PREVIOUS_TRACE_MAX_DURATION = 3600;
|
|
14
14
|
export declare const PREVIOUS_TRACE_KEY = "sentry_previous_trace";
|
|
15
|
+
export declare const PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE = "sentry.previous_trace";
|
|
15
16
|
/**
|
|
16
17
|
* Adds a previous_trace span link to the passed span if the passed
|
|
17
18
|
* previousTraceInfo is still valid.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.11.0",
|
|
4
4
|
"description": "Official Sentry SDK for browsers",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sentry-internal/browser-utils": "9.
|
|
43
|
-
"@sentry-internal/feedback": "9.
|
|
44
|
-
"@sentry-internal/replay": "9.
|
|
45
|
-
"@sentry-internal/replay-canvas": "9.
|
|
46
|
-
"@sentry/core": "9.
|
|
42
|
+
"@sentry-internal/browser-utils": "9.11.0",
|
|
43
|
+
"@sentry-internal/feedback": "9.11.0",
|
|
44
|
+
"@sentry-internal/replay": "9.11.0",
|
|
45
|
+
"@sentry-internal/replay-canvas": "9.11.0",
|
|
46
|
+
"@sentry/core": "9.11.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@sentry-internal/integration-shims": "9.
|
|
49
|
+
"@sentry-internal/integration-shims": "9.11.0",
|
|
50
50
|
"fake-indexeddb": "^4.0.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"clean": "rimraf build coverage .rpt2_cache sentry-browser-*.tgz",
|
|
68
68
|
"fix": "eslint . --format stylish --fix",
|
|
69
69
|
"lint": "eslint . --format stylish",
|
|
70
|
+
"lint:es-compatibility": "es-check es2020 ./build/{bundles,npm/cjs}/*.js && es-check es2020 ./build/npm/esm/*.js --module",
|
|
70
71
|
"size:check": "cat build/bundles/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print \"ES2017: \",$1,\"kB\";}'",
|
|
71
72
|
"test": "vitest run",
|
|
72
73
|
"test:watch": "vitest --watch",
|