@sentry/browser 10.26.0 → 10.27.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.
Files changed (65) hide show
  1. package/build/npm/cjs/dev/client.js +0 -1
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/index.js +2 -0
  4. package/build/npm/cjs/dev/index.js.map +1 -1
  5. package/build/npm/cjs/dev/profiling/UIProfiler.js +98 -41
  6. package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
  7. package/build/npm/cjs/dev/profiling/index.js +59 -0
  8. package/build/npm/cjs/dev/profiling/index.js.map +1 -0
  9. package/build/npm/cjs/dev/profiling/integration.js +12 -10
  10. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  11. package/build/npm/cjs/dev/profiling/utils.js +11 -5
  12. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  13. package/build/npm/cjs/prod/client.js +0 -1
  14. package/build/npm/cjs/prod/client.js.map +1 -1
  15. package/build/npm/cjs/prod/index.js +2 -0
  16. package/build/npm/cjs/prod/index.js.map +1 -1
  17. package/build/npm/cjs/prod/profiling/UIProfiler.js +98 -41
  18. package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
  19. package/build/npm/cjs/prod/profiling/index.js +59 -0
  20. package/build/npm/cjs/prod/profiling/index.js.map +1 -0
  21. package/build/npm/cjs/prod/profiling/integration.js +12 -10
  22. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  23. package/build/npm/cjs/prod/profiling/utils.js +11 -5
  24. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  25. package/build/npm/esm/dev/client.js +0 -1
  26. package/build/npm/esm/dev/client.js.map +1 -1
  27. package/build/npm/esm/dev/index.js +1 -0
  28. package/build/npm/esm/dev/index.js.map +1 -1
  29. package/build/npm/esm/dev/package.json +1 -1
  30. package/build/npm/esm/dev/profiling/UIProfiler.js +100 -43
  31. package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
  32. package/build/npm/esm/dev/profiling/index.js +57 -0
  33. package/build/npm/esm/dev/profiling/index.js.map +1 -0
  34. package/build/npm/esm/dev/profiling/integration.js +13 -11
  35. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  36. package/build/npm/esm/dev/profiling/utils.js +12 -6
  37. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  38. package/build/npm/esm/prod/client.js +0 -1
  39. package/build/npm/esm/prod/client.js.map +1 -1
  40. package/build/npm/esm/prod/index.js +1 -0
  41. package/build/npm/esm/prod/index.js.map +1 -1
  42. package/build/npm/esm/prod/package.json +1 -1
  43. package/build/npm/esm/prod/profiling/UIProfiler.js +100 -43
  44. package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
  45. package/build/npm/esm/prod/profiling/index.js +57 -0
  46. package/build/npm/esm/prod/profiling/index.js.map +1 -0
  47. package/build/npm/esm/prod/profiling/integration.js +13 -11
  48. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  49. package/build/npm/esm/prod/profiling/utils.js +12 -6
  50. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  51. package/build/npm/types/client.d.ts.map +1 -1
  52. package/build/npm/types/exports.d.ts +1 -0
  53. package/build/npm/types/exports.d.ts.map +1 -1
  54. package/build/npm/types/profiling/UIProfiler.d.ts +23 -22
  55. package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -1
  56. package/build/npm/types/profiling/index.d.ts +8 -0
  57. package/build/npm/types/profiling/index.d.ts.map +1 -0
  58. package/build/npm/types/profiling/integration.d.ts.map +1 -1
  59. package/build/npm/types/profiling/utils.d.ts +1 -1
  60. package/build/npm/types/profiling/utils.d.ts.map +1 -1
  61. package/build/npm/types-ts3.8/exports.d.ts +1 -0
  62. package/build/npm/types-ts3.8/profiling/UIProfiler.d.ts +23 -22
  63. package/build/npm/types-ts3.8/profiling/index.d.ts +8 -0
  64. package/build/npm/types-ts3.8/profiling/utils.d.ts +1 -1
  65. package/package.json +7 -7
@@ -1,51 +1,52 @@
1
- import type { Client, Span } from '@sentry/core';
1
+ import type { Client, ContinuousProfiler, Span } from '@sentry/core';
2
2
  /**
3
- * Browser trace-lifecycle profiler (UI Profiling / Profiling V2):
4
- * - Starts when the first sampled root span starts
5
- * - Stops when the last sampled root span ends
6
- * - While running, periodically stops and restarts the JS self-profiling API to collect chunks
3
+ * UIProfiler (Profiling V2):
4
+ * Supports two lifecycle modes:
5
+ * - 'manual': controlled explicitly via start()/stop()
6
+ * - 'trace': automatically runs while there are active sampled root spans
7
7
  *
8
8
  * Profiles are emitted as standalone `profile_chunk` envelopes either when:
9
9
  * - there are no more sampled root spans, or
10
10
  * - the 60s chunk timer elapses while profiling is running.
11
11
  */
12
- export declare class UIProfiler {
12
+ export declare class UIProfiler implements ContinuousProfiler<Client> {
13
13
  private _client;
14
14
  private _profiler;
15
15
  private _chunkTimer;
16
- private _activeRootSpanIds;
17
- private _rootSpanTimeouts;
18
16
  private _profilerId;
19
17
  private _isRunning;
20
18
  private _sessionSampled;
19
+ private _lifecycleMode;
20
+ private _activeRootSpanIds;
21
+ private _rootSpanTimeouts;
21
22
  constructor();
22
23
  /**
23
- * Initialize the profiler with client and session sampling decision computed by the integration.
24
- */
25
- initialize(client: Client, sessionSampled: boolean): void;
26
- /**
27
- * Handle an already-active root span at integration setup time.
28
- */
29
- notifyRootSpanActive(rootSpan: Span): void;
30
- /**
31
- * Start profiling if not already running.
24
+ * Initialize the profiler with client, session sampling and lifecycle mode.
32
25
  */
26
+ initialize(client: Client): void;
27
+ /** Starts UI profiling (only effective in 'manual' mode and when sampled). */
33
28
  start(): void;
29
+ /** Stops UI profiling (only effective in 'manual' mode). */
30
+ stop(): void;
31
+ /** Handle an already-active root span at integration setup time (used only in trace mode). */
32
+ notifyRootSpanActive(rootSpan: Span): void;
34
33
  /**
35
- * Stop profiling; final chunk will be collected and sent.
34
+ * Begin profiling if not already running.
36
35
  */
37
- stop(): void;
36
+ private _beginProfiling;
37
+ /** End profiling session; final chunk will be collected and sent. */
38
+ private _endProfiling;
38
39
  /** Trace-mode: attach spanStart/spanEnd listeners. */
39
40
  private _setupTraceLifecycleListeners;
40
41
  /**
41
- * Resets profiling information from scope and resets running state
42
+ * Resets profiling information from scope and resets running state (used on failure)
42
43
  */
43
44
  private _resetProfilerInfo;
44
45
  /**
45
46
  * Clear and reset all per-root-span timeouts.
46
47
  */
47
48
  private _clearAllRootSpanTimeouts;
48
- /** Register root span and schedule safeguard timeout (trace mode). */
49
+ /** Keep track of root spans and schedule safeguard timeout (trace mode). */
49
50
  private _registerTraceRootSpan;
50
51
  /**
51
52
  * Start a profiler instance if needed.
@@ -63,7 +64,7 @@ export declare class UIProfiler {
63
64
  */
64
65
  private _onRootSpanTimeout;
65
66
  /**
66
- * Stop the current profiler, convert and send a profile chunk.
67
+ * Stop current profiler instance, convert profile to chunk & send.
67
68
  */
68
69
  private _collectCurrentChunk;
69
70
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"UIProfiler.d.ts","sourceRoot":"","sources":["../../../../src/profiling/UIProfiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAgB,IAAI,EAAE,MAAM,cAAc,CAAC;AAmB/D;;;;;;;;;GASG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,WAAW,CAA4C;IAE/D,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,iBAAiB,CAA6C;IAEtE,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,eAAe,CAAU;;IAajC;;OAEG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,IAAI;IAYhE;;OAEG;IACI,oBAAoB,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI;IAsBjD;;OAEG;IACI,KAAK,IAAI,IAA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;IAyBrB,sDAAsD;IACtD,OAAO,CAAC,6BAA6B;IAwDrC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAKjC,4EAA4E;IAC5E,OAAO,CAAC,sBAAsB;IAM9B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAwB9B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;YACW,oBAAoB;IAiClC;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAsB1B"}
@@ -0,0 +1,8 @@
1
+ import type { Profiler } from '@sentry/core';
2
+ /**
3
+ * Profiler namespace for controlling the JS profiler in 'manual' mode.
4
+ *
5
+ * Requires the `browserProfilingIntegration` from the `@sentry/browser` package.
6
+ */
7
+ export declare const uiProfiler: Profiler;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/profiling/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AA8C7C;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,QAGxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../src/profiling/integration.ts"],"names":[],"mappings":"AA8JA,eAAO,MAAM,2BAA2B,0CAAkD,CAAC"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../src/profiling/integration.ts"],"names":[],"mappings":"AA+JA,eAAO,MAAM,2BAA2B,0CAAkD,CAAC"}
@@ -82,7 +82,7 @@ export declare function startJSSelfProfile(): JSSelfProfiler | undefined;
82
82
  */
83
83
  export declare function shouldProfileSpanLegacy(span: Span): boolean;
84
84
  /**
85
- * Determine if a profile should be created for the current session (lifecycle profiling mode).
85
+ * Determine if a profile should be created for the current session.
86
86
  */
87
87
  export declare function shouldProfileSession(options: BrowserOptions): boolean;
88
88
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/profiling/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EAEN,UAAU,EACV,QAAQ,EACR,KAAK,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAatB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAiD,MAAM,mBAAmB,CAAC;AAQtH,eAAO,MAAM,yBAAyB,QAAY,CAAC;AACnD,eAAO,MAAM,oBAAoB,QAAmC,CAAC;AA2DrE;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,GAAG,gBAAgB,CAMvG;AAID,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,qBAAqB,EAAE;QACrB,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB,CAAC;CACH;AAkBD;;;;;;;;GAQG;AAEH;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,iBAAiB,EAAE,aAAa,EAChC,KAAK,EAAE,aAAa,GACnB,OAAO,CA8DT;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,GAClB,YAAY,CA8Bd;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAwC9F;AAsED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IA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;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAMxF;AACD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CASxF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CA8B/D"}
@@ -5,6 +5,7 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTI
5
5
  export { WINDOW } from './helpers';
6
6
  export { BrowserClient } from './client';
7
7
  export { makeFetchTransport } from './transports/fetch';
8
+ export { uiProfiler } from './profiling';
8
9
  export { defaultStackParser, defaultStackLineParsers, chromeStackLineParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser, } from './stack-parsers';
9
10
  export { eventFromException, eventFromMessage, exceptionFromError } from './eventbuilder';
10
11
  export { createUserFeedbackEnvelope } from './userfeedback';
@@ -1,51 +1,52 @@
1
- import { Client, Span } from '@sentry/core';
1
+ import { Client, ContinuousProfiler, Span } from '@sentry/core';
2
2
  /**
3
- * Browser trace-lifecycle profiler (UI Profiling / Profiling V2):
4
- * - Starts when the first sampled root span starts
5
- * - Stops when the last sampled root span ends
6
- * - While running, periodically stops and restarts the JS self-profiling API to collect chunks
3
+ * UIProfiler (Profiling V2):
4
+ * Supports two lifecycle modes:
5
+ * - 'manual': controlled explicitly via start()/stop()
6
+ * - 'trace': automatically runs while there are active sampled root spans
7
7
  *
8
8
  * Profiles are emitted as standalone `profile_chunk` envelopes either when:
9
9
  * - there are no more sampled root spans, or
10
10
  * - the 60s chunk timer elapses while profiling is running.
11
11
  */
12
- export declare class UIProfiler {
12
+ export declare class UIProfiler implements ContinuousProfiler<Client> {
13
13
  private _client;
14
14
  private _profiler;
15
15
  private _chunkTimer;
16
- private _activeRootSpanIds;
17
- private _rootSpanTimeouts;
18
16
  private _profilerId;
19
17
  private _isRunning;
20
18
  private _sessionSampled;
19
+ private _lifecycleMode;
20
+ private _activeRootSpanIds;
21
+ private _rootSpanTimeouts;
21
22
  constructor();
22
23
  /**
23
- * Initialize the profiler with client and session sampling decision computed by the integration.
24
- */
25
- initialize(client: Client, sessionSampled: boolean): void;
26
- /**
27
- * Handle an already-active root span at integration setup time.
28
- */
29
- notifyRootSpanActive(rootSpan: Span): void;
30
- /**
31
- * Start profiling if not already running.
24
+ * Initialize the profiler with client, session sampling and lifecycle mode.
32
25
  */
26
+ initialize(client: Client): void;
27
+ /** Starts UI profiling (only effective in 'manual' mode and when sampled). */
33
28
  start(): void;
29
+ /** Stops UI profiling (only effective in 'manual' mode). */
30
+ stop(): void;
31
+ /** Handle an already-active root span at integration setup time (used only in trace mode). */
32
+ notifyRootSpanActive(rootSpan: Span): void;
34
33
  /**
35
- * Stop profiling; final chunk will be collected and sent.
34
+ * Begin profiling if not already running.
36
35
  */
37
- stop(): void;
36
+ private _beginProfiling;
37
+ /** End profiling session; final chunk will be collected and sent. */
38
+ private _endProfiling;
38
39
  /** Trace-mode: attach spanStart/spanEnd listeners. */
39
40
  private _setupTraceLifecycleListeners;
40
41
  /**
41
- * Resets profiling information from scope and resets running state
42
+ * Resets profiling information from scope and resets running state (used on failure)
42
43
  */
43
44
  private _resetProfilerInfo;
44
45
  /**
45
46
  * Clear and reset all per-root-span timeouts.
46
47
  */
47
48
  private _clearAllRootSpanTimeouts;
48
- /** Register root span and schedule safeguard timeout (trace mode). */
49
+ /** Keep track of root spans and schedule safeguard timeout (trace mode). */
49
50
  private _registerTraceRootSpan;
50
51
  /**
51
52
  * Start a profiler instance if needed.
@@ -63,7 +64,7 @@ export declare class UIProfiler {
63
64
  */
64
65
  private _onRootSpanTimeout;
65
66
  /**
66
- * Stop the current profiler, convert and send a profile chunk.
67
+ * Stop current profiler instance, convert profile to chunk & send.
67
68
  */
68
69
  private _collectCurrentChunk;
69
70
  /**
@@ -0,0 +1,8 @@
1
+ import { Profiler } from '@sentry/core';
2
+ /**
3
+ * Profiler namespace for controlling the JS profiler in 'manual' mode.
4
+ *
5
+ * Requires the `browserProfilingIntegration` from the `@sentry/browser` package.
6
+ */
7
+ export declare const uiProfiler: Profiler;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -82,7 +82,7 @@ export declare function startJSSelfProfile(): JSSelfProfiler | undefined;
82
82
  */
83
83
  export declare function shouldProfileSpanLegacy(span: Span): boolean;
84
84
  /**
85
- * Determine if a profile should be created for the current session (lifecycle profiling mode).
85
+ * Determine if a profile should be created for the current session.
86
86
  */
87
87
  export declare function shouldProfileSession(options: BrowserOptions): boolean;
88
88
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/browser",
3
- "version": "10.26.0",
3
+ "version": "10.27.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",
@@ -44,14 +44,14 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@sentry-internal/browser-utils": "10.26.0",
48
- "@sentry-internal/feedback": "10.26.0",
49
- "@sentry-internal/replay": "10.26.0",
50
- "@sentry-internal/replay-canvas": "10.26.0",
51
- "@sentry/core": "10.26.0"
47
+ "@sentry-internal/browser-utils": "10.27.0",
48
+ "@sentry-internal/feedback": "10.27.0",
49
+ "@sentry-internal/replay": "10.27.0",
50
+ "@sentry-internal/replay-canvas": "10.27.0",
51
+ "@sentry/core": "10.27.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@sentry-internal/integration-shims": "10.26.0",
54
+ "@sentry-internal/integration-shims": "10.27.0",
55
55
  "fake-indexeddb": "^6.2.4"
56
56
  },
57
57
  "scripts": {