@sentry/profiling-node 8.9.2 → 8.10.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 (153) hide show
  1. package/bindings/cpu_profiler.cc +2 -2
  2. package/lib/cjs/index.js +743 -33
  3. package/lib/cjs/index.js.map +1 -1
  4. package/lib/esm/index.js +744 -34
  5. package/lib/esm/index.js.map +1 -1
  6. package/lib/sentry_cpu_profiler-darwin-arm64-108.node +0 -0
  7. package/lib/sentry_cpu_profiler-darwin-arm64-115.node +0 -0
  8. package/lib/sentry_cpu_profiler-darwin-arm64-127.node +0 -0
  9. package/lib/sentry_cpu_profiler-darwin-arm64-93.node +0 -0
  10. package/lib/sentry_cpu_profiler-darwin-x64-108.node +0 -0
  11. package/lib/sentry_cpu_profiler-darwin-x64-115.node +0 -0
  12. package/lib/sentry_cpu_profiler-darwin-x64-127.node +0 -0
  13. package/lib/sentry_cpu_profiler-darwin-x64-93.node +0 -0
  14. package/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node +0 -0
  15. package/lib/sentry_cpu_profiler-linux-arm64-glibc-115.node +0 -0
  16. package/lib/sentry_cpu_profiler-linux-arm64-glibc-127.node +0 -0
  17. package/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node +0 -0
  18. package/lib/sentry_cpu_profiler-linux-arm64-musl-108.node +0 -0
  19. package/lib/sentry_cpu_profiler-linux-arm64-musl-115.node +0 -0
  20. package/lib/sentry_cpu_profiler-linux-arm64-musl-127.node +0 -0
  21. package/lib/sentry_cpu_profiler-linux-arm64-musl-93.node +0 -0
  22. package/lib/sentry_cpu_profiler-linux-x64-glibc-108.node +0 -0
  23. package/lib/sentry_cpu_profiler-linux-x64-glibc-115.node +0 -0
  24. package/lib/sentry_cpu_profiler-linux-x64-glibc-127.node +0 -0
  25. package/lib/sentry_cpu_profiler-linux-x64-glibc-93.node +0 -0
  26. package/lib/sentry_cpu_profiler-linux-x64-musl-108.node +0 -0
  27. package/lib/sentry_cpu_profiler-linux-x64-musl-115.node +0 -0
  28. package/lib/sentry_cpu_profiler-linux-x64-musl-127.node +0 -0
  29. package/lib/sentry_cpu_profiler-linux-x64-musl-93.node +0 -0
  30. package/lib/sentry_cpu_profiler-win32-x64-108.node +0 -0
  31. package/lib/sentry_cpu_profiler-win32-x64-115.node +0 -0
  32. package/lib/sentry_cpu_profiler-win32-x64-127.node +0 -0
  33. package/lib/sentry_cpu_profiler-win32-x64-93.node +0 -0
  34. package/lib/types/core/src/asyncContext/index.d.ts +14 -0
  35. package/lib/types/core/src/asyncContext/index.d.ts.map +1 -0
  36. package/lib/types/core/src/asyncContext/stackStrategy.d.ts +52 -0
  37. package/lib/types/core/src/asyncContext/stackStrategy.d.ts.map +1 -0
  38. package/lib/types/core/src/asyncContext/types.d.ts +47 -0
  39. package/lib/types/core/src/asyncContext/types.d.ts.map +1 -0
  40. package/lib/types/core/src/carrier.d.ts +37 -0
  41. package/lib/types/core/src/carrier.d.ts.map +1 -0
  42. package/lib/types/core/src/constants.d.ts +2 -0
  43. package/lib/types/core/src/constants.d.ts.map +1 -0
  44. package/lib/types/core/src/currentScopes.d.ts +55 -0
  45. package/lib/types/core/src/currentScopes.d.ts.map +1 -0
  46. package/lib/types/core/src/debug-build.d.ts.map +1 -0
  47. package/lib/types/core/src/defaultScopes.d.ts +6 -0
  48. package/lib/types/core/src/defaultScopes.d.ts.map +1 -0
  49. package/lib/types/core/src/envelope.d.ts +15 -0
  50. package/lib/types/core/src/envelope.d.ts.map +1 -0
  51. package/lib/types/core/src/metrics/constants.d.ts +19 -0
  52. package/lib/types/core/src/metrics/constants.d.ts.map +1 -0
  53. package/lib/types/core/src/metrics/metric-summary.d.ts +13 -0
  54. package/lib/types/core/src/metrics/metric-summary.d.ts.map +1 -0
  55. package/lib/types/core/src/metrics/types.d.ts +5 -0
  56. package/lib/types/core/src/metrics/types.d.ts.map +1 -0
  57. package/lib/types/core/src/scope.d.ts +211 -0
  58. package/lib/types/core/src/scope.d.ts.map +1 -0
  59. package/lib/types/core/src/semanticAttributes.d.ts +33 -0
  60. package/lib/types/core/src/semanticAttributes.d.ts.map +1 -0
  61. package/lib/types/core/src/session.d.ts +35 -0
  62. package/lib/types/core/src/session.d.ts.map +1 -0
  63. package/lib/types/core/src/tracing/dynamicSamplingContext.d.ts +24 -0
  64. package/lib/types/core/src/tracing/dynamicSamplingContext.d.ts.map +1 -0
  65. package/lib/types/core/src/tracing/logSpans.d.ts +10 -0
  66. package/lib/types/core/src/tracing/logSpans.d.ts.map +1 -0
  67. package/lib/types/core/src/tracing/measurement.d.ts +10 -0
  68. package/lib/types/core/src/tracing/measurement.d.ts.map +1 -0
  69. package/lib/types/core/src/tracing/sampling.d.ts +9 -0
  70. package/lib/types/core/src/tracing/sampling.d.ts.map +1 -0
  71. package/lib/types/core/src/tracing/sentryNonRecordingSpan.d.ts +26 -0
  72. package/lib/types/core/src/tracing/sentryNonRecordingSpan.d.ts.map +1 -0
  73. package/lib/types/core/src/tracing/sentrySpan.d.ts +86 -0
  74. package/lib/types/core/src/tracing/sentrySpan.d.ts.map +1 -0
  75. package/lib/types/core/src/tracing/spanstatus.d.ts +17 -0
  76. package/lib/types/core/src/tracing/spanstatus.d.ts.map +1 -0
  77. package/lib/types/core/src/tracing/trace.d.ts +76 -0
  78. package/lib/types/core/src/tracing/trace.d.ts.map +1 -0
  79. package/lib/types/core/src/tracing/utils.d.ts +13 -0
  80. package/lib/types/core/src/tracing/utils.d.ts.map +1 -0
  81. package/lib/types/core/src/utils/handleCallbackErrors.d.ts +13 -0
  82. package/lib/types/core/src/utils/handleCallbackErrors.d.ts.map +1 -0
  83. package/lib/types/core/src/utils/hasTracingEnabled.d.ts +8 -0
  84. package/lib/types/core/src/utils/hasTracingEnabled.d.ts.map +1 -0
  85. package/lib/types/core/src/utils/parseSampleRate.d.ts +9 -0
  86. package/lib/types/core/src/utils/parseSampleRate.d.ts.map +1 -0
  87. package/lib/types/core/src/utils/spanOnScope.d.ts +17 -0
  88. package/lib/types/core/src/utils/spanOnScope.d.ts.map +1 -0
  89. package/lib/types/core/src/utils/spanUtils.d.ts +74 -0
  90. package/lib/types/core/src/utils/spanUtils.d.ts.map +1 -0
  91. package/lib/types/profiling-node/src/cpu_profiler.d.ts.map +1 -0
  92. package/lib/types/profiling-node/src/debug-build.d.ts +7 -0
  93. package/lib/types/profiling-node/src/debug-build.d.ts.map +1 -0
  94. package/lib/types/profiling-node/src/index.d.ts.map +1 -0
  95. package/lib/types/{integration.d.ts → profiling-node/src/integration.d.ts} +18 -0
  96. package/lib/types/profiling-node/src/integration.d.ts.map +1 -0
  97. package/lib/types/profiling-node/src/nodeVersion.d.ts.map +1 -0
  98. package/lib/types/profiling-node/src/spanProfileUtils.d.ts.map +1 -0
  99. package/lib/types/profiling-node/src/types.d.ts.map +1 -0
  100. package/lib/types/{utils.d.ts → profiling-node/src/utils.d.ts} +3 -1
  101. package/lib/types/profiling-node/src/utils.d.ts.map +1 -0
  102. package/lib/types-ts3.8/core/src/asyncContext/index.d.ts +14 -0
  103. package/lib/types-ts3.8/core/src/asyncContext/stackStrategy.d.ts +52 -0
  104. package/lib/types-ts3.8/core/src/asyncContext/types.d.ts +47 -0
  105. package/lib/types-ts3.8/core/src/carrier.d.ts +37 -0
  106. package/lib/types-ts3.8/core/src/constants.d.ts +2 -0
  107. package/lib/types-ts3.8/core/src/currentScopes.d.ts +55 -0
  108. package/lib/types-ts3.8/core/src/defaultScopes.d.ts +6 -0
  109. package/lib/types-ts3.8/core/src/envelope.d.ts +18 -0
  110. package/lib/types-ts3.8/core/src/metrics/constants.d.ts +19 -0
  111. package/lib/types-ts3.8/core/src/metrics/metric-summary.d.ts +13 -0
  112. package/lib/types-ts3.8/core/src/metrics/types.d.ts +5 -0
  113. package/lib/types-ts3.8/core/src/scope.d.ts +211 -0
  114. package/lib/types-ts3.8/core/src/semanticAttributes.d.ts +33 -0
  115. package/lib/types-ts3.8/core/src/session.d.ts +35 -0
  116. package/lib/types-ts3.8/core/src/tracing/dynamicSamplingContext.d.ts +24 -0
  117. package/lib/types-ts3.8/core/src/tracing/logSpans.d.ts +10 -0
  118. package/lib/types-ts3.8/core/src/tracing/measurement.d.ts +10 -0
  119. package/lib/types-ts3.8/core/src/tracing/sampling.d.ts +12 -0
  120. package/lib/types-ts3.8/core/src/tracing/sentryNonRecordingSpan.d.ts +26 -0
  121. package/lib/types-ts3.8/core/src/tracing/sentrySpan.d.ts +86 -0
  122. package/lib/types-ts3.8/core/src/tracing/spanstatus.d.ts +17 -0
  123. package/lib/types-ts3.8/core/src/tracing/trace.d.ts +76 -0
  124. package/lib/types-ts3.8/core/src/tracing/utils.d.ts +13 -0
  125. package/lib/types-ts3.8/core/src/utils/handleCallbackErrors.d.ts +13 -0
  126. package/lib/types-ts3.8/core/src/utils/hasTracingEnabled.d.ts +8 -0
  127. package/lib/types-ts3.8/core/src/utils/parseSampleRate.d.ts +9 -0
  128. package/lib/types-ts3.8/core/src/utils/spanOnScope.d.ts +17 -0
  129. package/lib/types-ts3.8/core/src/utils/spanUtils.d.ts +74 -0
  130. package/lib/types-ts3.8/profiling-node/src/debug-build.d.ts +7 -0
  131. package/lib/types-ts3.8/{integration.d.ts → profiling-node/src/integration.d.ts} +18 -0
  132. package/lib/types-ts3.8/{utils.d.ts → profiling-node/src/utils.d.ts} +3 -1
  133. package/package.json +5 -5
  134. package/lib/types/cpu_profiler.d.ts.map +0 -1
  135. package/lib/types/debug-build.d.ts.map +0 -1
  136. package/lib/types/index.d.ts.map +0 -1
  137. package/lib/types/integration.d.ts.map +0 -1
  138. package/lib/types/nodeVersion.d.ts.map +0 -1
  139. package/lib/types/spanProfileUtils.d.ts.map +0 -1
  140. package/lib/types/types.d.ts.map +0 -1
  141. package/lib/types/utils.d.ts.map +0 -1
  142. /package/lib/types/{debug-build.d.ts → core/src/debug-build.d.ts} +0 -0
  143. /package/lib/types/{cpu_profiler.d.ts → profiling-node/src/cpu_profiler.d.ts} +0 -0
  144. /package/lib/types/{index.d.ts → profiling-node/src/index.d.ts} +0 -0
  145. /package/lib/types/{nodeVersion.d.ts → profiling-node/src/nodeVersion.d.ts} +0 -0
  146. /package/lib/types/{spanProfileUtils.d.ts → profiling-node/src/spanProfileUtils.d.ts} +0 -0
  147. /package/lib/types/{types.d.ts → profiling-node/src/types.d.ts} +0 -0
  148. /package/lib/types-ts3.8/{debug-build.d.ts → core/src/debug-build.d.ts} +0 -0
  149. /package/lib/types-ts3.8/{cpu_profiler.d.ts → profiling-node/src/cpu_profiler.d.ts} +0 -0
  150. /package/lib/types-ts3.8/{index.d.ts → profiling-node/src/index.d.ts} +0 -0
  151. /package/lib/types-ts3.8/{nodeVersion.d.ts → profiling-node/src/nodeVersion.d.ts} +0 -0
  152. /package/lib/types-ts3.8/{spanProfileUtils.d.ts → profiling-node/src/spanProfileUtils.d.ts} +0 -0
  153. /package/lib/types-ts3.8/{types.d.ts → profiling-node/src/types.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ import { MeasurementUnit, Span } from '@sentry/types';
2
+ import { MetricSummary } from '@sentry/types';
3
+ import { Primitive } from '@sentry/types';
4
+ import { MetricType } from './types';
5
+ /**
6
+ * Fetches the metric summary if it exists for the passed span
7
+ */
8
+ export declare function getMetricSummaryJsonForSpan(span: Span): Record<string, Array<MetricSummary>> | undefined;
9
+ /**
10
+ * Updates the metric summary on a span.
11
+ */
12
+ export declare function updateMetricSummaryOnSpan(span: Span, metricType: MetricType, sanitizedName: string, value: number, unit: MeasurementUnit, tags: Record<string, Primitive>, bucketKey: string): void;
13
+ //# sourceMappingURL=metric-summary.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { MetricBucketItem } from '@sentry/types';
2
+ import { COUNTER_METRIC_TYPE, DISTRIBUTION_METRIC_TYPE, GAUGE_METRIC_TYPE, SET_METRIC_TYPE } from './constants';
3
+ export type MetricType = typeof COUNTER_METRIC_TYPE | typeof GAUGE_METRIC_TYPE | typeof SET_METRIC_TYPE | typeof DISTRIBUTION_METRIC_TYPE;
4
+ export type MetricBucket = Map<string, MetricBucketItem>;
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,211 @@
1
+ import { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, SeverityLevel, User } from '@sentry/types';
2
+ /**
3
+ * Holds additional event information.
4
+ */
5
+ declare class ScopeClass implements ScopeInterface {
6
+ /** Flag if notifying is happening. */
7
+ protected _notifyingListeners: boolean;
8
+ /** Callback for client to receive scope changes. */
9
+ protected _scopeListeners: Array<(scope: Scope) => void>;
10
+ /** Callback list that will be called during event processing. */
11
+ protected _eventProcessors: EventProcessor[];
12
+ /** Array of breadcrumbs. */
13
+ protected _breadcrumbs: Breadcrumb[];
14
+ /** User */
15
+ protected _user: User;
16
+ /** Tags */
17
+ protected _tags: {
18
+ [key: string]: Primitive;
19
+ };
20
+ /** Extra */
21
+ protected _extra: Extras;
22
+ /** Contexts */
23
+ protected _contexts: Contexts;
24
+ /** Attachments */
25
+ protected _attachments: Attachment[];
26
+ /** Propagation Context for distributed tracing */
27
+ protected _propagationContext: PropagationContext;
28
+ /**
29
+ * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
30
+ * sent to Sentry
31
+ */
32
+ protected _sdkProcessingMetadata: {
33
+ [key: string]: unknown;
34
+ };
35
+ /** Fingerprint */
36
+ protected _fingerprint?: string[];
37
+ /** Severity */
38
+ protected _level?: SeverityLevel;
39
+ /**
40
+ * Transaction Name
41
+ *
42
+ * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
43
+ * It's purpose is to assign a transaction to the scope that's added to non-transaction events.
44
+ */
45
+ protected _transactionName?: string;
46
+ /** Session */
47
+ protected _session?: Session;
48
+ /** Request Mode Session Status */
49
+ protected _requestSession?: RequestSession;
50
+ /** The client on this scope */
51
+ protected _client?: Client;
52
+ /** Contains the last event id of a captured event. */
53
+ protected _lastEventId?: string;
54
+ constructor();
55
+ /**
56
+ * @inheritDoc
57
+ */
58
+ clone(): ScopeClass;
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ setClient(client: Client | undefined): void;
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ setLastEventId(lastEventId: string | undefined): void;
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ getClient<C extends Client>(): C | undefined;
71
+ /**
72
+ * @inheritDoc
73
+ */
74
+ lastEventId(): string | undefined;
75
+ /**
76
+ * @inheritDoc
77
+ */
78
+ addScopeListener(callback: (scope: Scope) => void): void;
79
+ /**
80
+ * @inheritDoc
81
+ */
82
+ addEventProcessor(callback: EventProcessor): this;
83
+ /**
84
+ * @inheritDoc
85
+ */
86
+ setUser(user: User | null): this;
87
+ /**
88
+ * @inheritDoc
89
+ */
90
+ getUser(): User | undefined;
91
+ /**
92
+ * @inheritDoc
93
+ */
94
+ getRequestSession(): RequestSession | undefined;
95
+ /**
96
+ * @inheritDoc
97
+ */
98
+ setRequestSession(requestSession?: RequestSession): this;
99
+ /**
100
+ * @inheritDoc
101
+ */
102
+ setTags(tags: {
103
+ [key: string]: Primitive;
104
+ }): this;
105
+ /**
106
+ * @inheritDoc
107
+ */
108
+ setTag(key: string, value: Primitive): this;
109
+ /**
110
+ * @inheritDoc
111
+ */
112
+ setExtras(extras: Extras): this;
113
+ /**
114
+ * @inheritDoc
115
+ */
116
+ setExtra(key: string, extra: Extra): this;
117
+ /**
118
+ * @inheritDoc
119
+ */
120
+ setFingerprint(fingerprint: string[]): this;
121
+ /**
122
+ * @inheritDoc
123
+ */
124
+ setLevel(level: SeverityLevel): this;
125
+ /**
126
+ * @inheritDoc
127
+ */
128
+ setTransactionName(name?: string): this;
129
+ /**
130
+ * @inheritDoc
131
+ */
132
+ setContext(key: string, context: Context | null): this;
133
+ /**
134
+ * @inheritDoc
135
+ */
136
+ setSession(session?: Session): this;
137
+ /**
138
+ * @inheritDoc
139
+ */
140
+ getSession(): Session | undefined;
141
+ /**
142
+ * @inheritDoc
143
+ */
144
+ update(captureContext?: CaptureContext): this;
145
+ /**
146
+ * @inheritDoc
147
+ */
148
+ clear(): this;
149
+ /**
150
+ * @inheritDoc
151
+ */
152
+ addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
153
+ /**
154
+ * @inheritDoc
155
+ */
156
+ getLastBreadcrumb(): Breadcrumb | undefined;
157
+ /**
158
+ * @inheritDoc
159
+ */
160
+ clearBreadcrumbs(): this;
161
+ /**
162
+ * @inheritDoc
163
+ */
164
+ addAttachment(attachment: Attachment): this;
165
+ /**
166
+ * @inheritDoc
167
+ */
168
+ clearAttachments(): this;
169
+ /** @inheritDoc */
170
+ getScopeData(): ScopeData;
171
+ /**
172
+ * @inheritDoc
173
+ */
174
+ setSDKProcessingMetadata(newData: {
175
+ [key: string]: unknown;
176
+ }): this;
177
+ /**
178
+ * @inheritDoc
179
+ */
180
+ setPropagationContext(context: PropagationContext): this;
181
+ /**
182
+ * @inheritDoc
183
+ */
184
+ getPropagationContext(): PropagationContext;
185
+ /**
186
+ * @inheritDoc
187
+ */
188
+ captureException(exception: unknown, hint?: EventHint): string;
189
+ /**
190
+ * @inheritDoc
191
+ */
192
+ captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
193
+ /**
194
+ * @inheritDoc
195
+ */
196
+ captureEvent(event: Event, hint?: EventHint): string;
197
+ /**
198
+ * This will be called on every set call.
199
+ */
200
+ protected _notifyScopeListeners(): void;
201
+ }
202
+ /**
203
+ * Holds additional event information.
204
+ */
205
+ export declare const Scope: typeof ScopeClass;
206
+ /**
207
+ * Holds additional event information.
208
+ */
209
+ export type Scope = ScopeInterface;
210
+ export {};
211
+ //# sourceMappingURL=scope.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Use this attribute to represent the source of a span.
3
+ * Should be one of: custom, url, route, view, component, task, unknown
4
+ *
5
+ */
6
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source";
7
+ /**
8
+ * Use this attribute to represent the sample rate used for a span.
9
+ */
10
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = "sentry.sample_rate";
11
+ /**
12
+ * Use this attribute to represent the operation of a span.
13
+ */
14
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_OP = "sentry.op";
15
+ /**
16
+ * Use this attribute to represent the origin of a span.
17
+ */
18
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = "sentry.origin";
19
+ /** The reason why an idle span finished. */
20
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = "sentry.idle_span_finish_reason";
21
+ /** The unit of a measurement, which may be stored as a TimedEvent. */
22
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = "sentry.measurement_unit";
23
+ /** The value of a measurement, which may be stored as a TimedEvent. */
24
+ export declare const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value";
25
+ /**
26
+ * The id of the profile that this span occured in.
27
+ */
28
+ export declare const SEMANTIC_ATTRIBUTE_PROFILE_ID = "sentry.profile_id";
29
+ export declare const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = "sentry.exclusive_time";
30
+ export declare const SEMANTIC_ATTRIBUTE_CACHE_HIT = "cache.hit";
31
+ export declare const SEMANTIC_ATTRIBUTE_CACHE_KEY = "cache.key";
32
+ export declare const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = "cache.item_size";
33
+ //# sourceMappingURL=semanticAttributes.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { Session, SessionContext, SessionStatus } from '@sentry/types';
2
+ /**
3
+ * Creates a new `Session` object by setting certain default parameters. If optional @param context
4
+ * is passed, the passed properties are applied to the session object.
5
+ *
6
+ * @param context (optional) additional properties to be applied to the returned session object
7
+ *
8
+ * @returns a new `Session` object
9
+ */
10
+ export declare function makeSession(context?: Pick<SessionContext, Exclude<keyof SessionContext, 'started' | 'status'>>): Session;
11
+ /**
12
+ * Updates a session object with the properties passed in the context.
13
+ *
14
+ * Note that this function mutates the passed object and returns void.
15
+ * (Had to do this instead of returning a new and updated session because closing and sending a session
16
+ * makes an update to the session after it was passed to the sending logic.
17
+ * @see BaseClient.captureSession )
18
+ *
19
+ * @param session the `Session` to update
20
+ * @param context the `SessionContext` holding the properties that should be updated in @param session
21
+ */
22
+ export declare function updateSession(session: Session, context?: SessionContext): void;
23
+ /**
24
+ * Closes a session by setting its status and updating the session object with it.
25
+ * Internally calls `updateSession` to update the passed session object.
26
+ *
27
+ * Note that this function mutates the passed session (@see updateSession for explanation).
28
+ *
29
+ * @param session the `Session` object to be closed
30
+ * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,
31
+ * this function will keep the previously set status, unless it was `'ok'` in which case
32
+ * it is changed to `'exited'`.
33
+ */
34
+ export declare function closeSession(session: Session, status?: Exclude<SessionStatus, 'ok'>): void;
35
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { Client, DynamicSamplingContext, Span } from '@sentry/types';
2
+ /**
3
+ * Freeze the given DSC on the given span.
4
+ */
5
+ export declare function freezeDscOnSpan(span: Span, dsc: Partial<DynamicSamplingContext>): void;
6
+ /**
7
+ * Creates a dynamic sampling context from a client.
8
+ *
9
+ * Dispatches the `createDsc` lifecycle hook as a side effect.
10
+ */
11
+ export declare function getDynamicSamplingContextFromClient(trace_id: string, client: Client): DynamicSamplingContext;
12
+ /**
13
+ * Creates a dynamic sampling context from a span (and client and scope)
14
+ *
15
+ * @param span the span from which a few values like the root span name and sample rate are extracted.
16
+ *
17
+ * @returns a dynamic sampling context
18
+ */
19
+ export declare function getDynamicSamplingContextFromSpan(span: Span): Readonly<Partial<DynamicSamplingContext>>;
20
+ /**
21
+ * Convert a Span to a baggage header.
22
+ */
23
+ export declare function spanToBaggageHeader(span: Span): string | undefined;
24
+ //# sourceMappingURL=dynamicSamplingContext.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Span } from '@sentry/types';
2
+ /**
3
+ * Print a log message for a started span.
4
+ */
5
+ export declare function logSpanStart(span: Span): void;
6
+ /**
7
+ * Print a log message for an ended span.
8
+ */
9
+ export declare function logSpanEnd(span: Span): void;
10
+ //# sourceMappingURL=logSpans.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { MeasurementUnit, Measurements, TimedEvent } from '@sentry/types';
2
+ /**
3
+ * Adds a measurement to the current active transaction.
4
+ */
5
+ export declare function setMeasurement(name: string, value: number, unit: MeasurementUnit): void;
6
+ /**
7
+ * Convert timed events to measurements.
8
+ */
9
+ export declare function timedEventsToMeasurements(events: TimedEvent[]): Measurements | undefined;
10
+ //# sourceMappingURL=measurement.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { Options, SamplingContext } from '@sentry/types';
2
+ /**
3
+ * Makes a sampling decision for the given options.
4
+ *
5
+ * Called every time a root span is created. Only root spans which emerge with a `sampled` value of `true` will be
6
+ * sent to Sentry.
7
+ */
8
+ export declare function sampleSpan(options: Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'>, samplingContext: SamplingContext): [
9
+ /*sampled*/ boolean,
10
+ /*sampleRate*/ number
11
+ ];
12
+ //# sourceMappingURL=sampling.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { SentrySpanArguments, Span, SpanAttributeValue, SpanAttributes, SpanContextData, SpanStatus, SpanTimeInput } from '@sentry/types';
2
+ /**
3
+ * A Sentry Span that is non-recording, meaning it will not be sent to Sentry.
4
+ */
5
+ export declare class SentryNonRecordingSpan implements Span {
6
+ private _traceId;
7
+ private _spanId;
8
+ constructor(spanContext?: SentrySpanArguments);
9
+ /** @inheritdoc */
10
+ spanContext(): SpanContextData;
11
+ /** @inheritdoc */
12
+ end(_timestamp?: SpanTimeInput): void;
13
+ /** @inheritdoc */
14
+ setAttribute(_key: string, _value: SpanAttributeValue | undefined): this;
15
+ /** @inheritdoc */
16
+ setAttributes(_values: SpanAttributes): this;
17
+ /** @inheritdoc */
18
+ setStatus(_status: SpanStatus): this;
19
+ /** @inheritdoc */
20
+ updateName(_name: string): this;
21
+ /** @inheritdoc */
22
+ isRecording(): boolean;
23
+ /** @inheritdoc */
24
+ addEvent(_name: string, _attributesOrStartTime?: SpanAttributes | SpanTimeInput, _startTime?: SpanTimeInput): this;
25
+ }
26
+ //# sourceMappingURL=sentryNonRecordingSpan.d.ts.map
@@ -0,0 +1,86 @@
1
+ import { SentrySpanArguments, Span, SpanAttributeValue, SpanAttributes, SpanContextData, SpanJSON, SpanStatus, SpanTimeInput, TimedEvent } from '@sentry/types';
2
+ /**
3
+ * Span contains all data about a span
4
+ */
5
+ export declare class SentrySpan implements Span {
6
+ protected _traceId: string;
7
+ protected _spanId: string;
8
+ protected _parentSpanId?: string | undefined;
9
+ protected _sampled: boolean | undefined;
10
+ protected _name?: string | undefined;
11
+ protected _attributes: SpanAttributes;
12
+ /** Epoch timestamp in seconds when the span started. */
13
+ protected _startTime: number;
14
+ /** Epoch timestamp in seconds when the span ended. */
15
+ protected _endTime?: number | undefined;
16
+ /** Internal keeper of the status */
17
+ protected _status?: SpanStatus;
18
+ /** The timed events added to this span. */
19
+ protected _events: TimedEvent[];
20
+ /** if true, treat span as a standalone span (not part of a transaction) */
21
+ private _isStandaloneSpan?;
22
+ /**
23
+ * You should never call the constructor manually, always use `Sentry.startSpan()`
24
+ * or other span methods.
25
+ * @internal
26
+ * @hideconstructor
27
+ * @hidden
28
+ */
29
+ constructor(spanContext?: SentrySpanArguments);
30
+ /** @inheritdoc */
31
+ spanContext(): SpanContextData;
32
+ /** @inheritdoc */
33
+ setAttribute(key: string, value: SpanAttributeValue | undefined): void;
34
+ /** @inheritdoc */
35
+ setAttributes(attributes: SpanAttributes): void;
36
+ /**
37
+ * This should generally not be used,
38
+ * but we need it for browser tracing where we want to adjust the start time afterwards.
39
+ * USE THIS WITH CAUTION!
40
+ *
41
+ * @hidden
42
+ * @internal
43
+ */
44
+ updateStartTime(timeInput: SpanTimeInput): void;
45
+ /**
46
+ * @inheritDoc
47
+ */
48
+ setStatus(value: SpanStatus): this;
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ updateName(name: string): this;
53
+ /** @inheritdoc */
54
+ end(endTimestamp?: SpanTimeInput): void;
55
+ /**
56
+ * Get JSON representation of this span.
57
+ *
58
+ * @hidden
59
+ * @internal This method is purely for internal purposes and should not be used outside
60
+ * of SDK code. If you need to get a JSON representation of a span,
61
+ * use `spanToJSON(span)` instead.
62
+ */
63
+ getSpanJSON(): SpanJSON;
64
+ /** @inheritdoc */
65
+ isRecording(): boolean;
66
+ /**
67
+ * @inheritdoc
68
+ */
69
+ addEvent(name: string, attributesOrStartTime?: SpanAttributes | SpanTimeInput, startTime?: SpanTimeInput): this;
70
+ /**
71
+ * This method should generally not be used,
72
+ * but for now we need a way to publicly check if the `_isStandaloneSpan` flag is set.
73
+ * USE THIS WITH CAUTION!
74
+ * @internal
75
+ * @hidden
76
+ * @experimental
77
+ */
78
+ isStandaloneSpan(): boolean;
79
+ /** Emit `spanEnd` when the span is ended. */
80
+ private _onSpanEnded;
81
+ /**
82
+ * Finish the transaction & prepare the event to send to Sentry.
83
+ */
84
+ private _convertSpanToTransaction;
85
+ }
86
+ //# sourceMappingURL=sentrySpan.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { Span, SpanStatus } from '@sentry/types';
2
+ export declare const SPAN_STATUS_UNSET = 0;
3
+ export declare const SPAN_STATUS_OK = 1;
4
+ export declare const SPAN_STATUS_ERROR = 2;
5
+ /**
6
+ * Converts a HTTP status code into a sentry status with a message.
7
+ *
8
+ * @param httpStatus The HTTP response status code.
9
+ * @returns The span status or unknown_error.
10
+ */
11
+ export declare function getSpanStatusFromHttpCode(httpStatus: number): SpanStatus;
12
+ /**
13
+ * Sets the Http status attributes on the current span based on the http code.
14
+ * Additionally, the span's status is updated, depending on the http code.
15
+ */
16
+ export declare function setHttpStatus(span: Span, httpStatus: number): void;
17
+ //# sourceMappingURL=spanstatus.d.ts.map
@@ -0,0 +1,76 @@
1
+ import { Scope, Span, StartSpanOptions } from '@sentry/types';
2
+ import { propagationContextFromHeaders } from '@sentry/utils';
3
+ /**
4
+ * Wraps a function with a transaction/span and finishes the span after the function is done.
5
+ * The created span is the active span and will be used as parent by other spans created inside the function
6
+ * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
7
+ *
8
+ * If you want to create a span that is not set as active, use {@link startInactiveSpan}.
9
+ *
10
+ * You'll always get a span passed to the callback,
11
+ * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
12
+ */
13
+ export declare function startSpan<T>(context: StartSpanOptions, callback: (span: Span) => T): T;
14
+ /**
15
+ * Similar to `Sentry.startSpan`. Wraps a function with a transaction/span, but does not finish the span
16
+ * after the function is done automatically. You'll have to call `span.end()` manually.
17
+ *
18
+ * The created span is the active span and will be used as parent by other spans created inside the function
19
+ * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
20
+ *
21
+ * You'll always get a span passed to the callback,
22
+ * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
23
+ */
24
+ export declare function startSpanManual<T>(context: StartSpanOptions, callback: (span: Span, finish: () => void) => T): T;
25
+ /**
26
+ * Creates a span. This span is not set as active, so will not get automatic instrumentation spans
27
+ * as children or be able to be accessed via `Sentry.getActiveSpan()`.
28
+ *
29
+ * If you want to create a span that is set as active, use {@link startSpan}.
30
+ *
31
+ * This function will always return a span,
32
+ * it may just be a non-recording span if the span is not sampled or if tracing is disabled.
33
+ */
34
+ export declare function startInactiveSpan(context: StartSpanOptions): Span;
35
+ /**
36
+ * Continue a trace from `sentry-trace` and `baggage` values.
37
+ * These values can be obtained from incoming request headers, or in the browser from `<meta name="sentry-trace">`
38
+ * and `<meta name="baggage">` HTML tags.
39
+ *
40
+ * Spans started with `startSpan`, `startSpanManual` and `startInactiveSpan`, within the callback will automatically
41
+ * be attached to the incoming trace.
42
+ */
43
+ export declare const continueTrace: <V>({ sentryTrace, baggage, }: {
44
+ sentryTrace: Parameters<typeof propagationContextFromHeaders>[0];
45
+ baggage: Parameters<typeof propagationContextFromHeaders>[1];
46
+ }, callback: () => V) => V;
47
+ /**
48
+ * Forks the current scope and sets the provided span as active span in the context of the provided callback. Can be
49
+ * passed `null` to start an entirely new span tree.
50
+ *
51
+ * @param span Spans started in the context of the provided callback will be children of this span. If `null` is passed,
52
+ * spans started within the callback will not be attached to a parent span.
53
+ * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.
54
+ * @returns the value returned from the provided callback function.
55
+ */
56
+ export declare function withActiveSpan<T>(span: Span | null, callback: (scope: Scope) => T): T;
57
+ /** Suppress tracing in the given callback, ensuring no spans are generated inside of it. */
58
+ export declare function suppressTracing<T>(callback: () => T): T;
59
+ /**
60
+ * Starts a new trace for the duration of the provided callback. Spans started within the
61
+ * callback will be part of the new trace instead of a potentially previously started trace.
62
+ *
63
+ * Important: Only use this function if you want to override the default trace lifetime and
64
+ * propagation mechanism of the SDK for the duration and scope of the provided callback.
65
+ * The newly created trace will also be the root of a new distributed trace, for example if
66
+ * you make http requests within the callback.
67
+ * This function might be useful if the operation you want to instrument should not be part
68
+ * of a potentially ongoing trace.
69
+ *
70
+ * Default behavior:
71
+ * - Server-side: A new trace is started for each incoming request.
72
+ * - Browser: A new trace is started for each page our route. Navigating to a new route
73
+ * or page will automatically create a new trace.
74
+ */
75
+ export declare function startNewTrace<T>(callback: () => T): T;
76
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { Span } from '@sentry/types';
2
+ import { Scope } from '@sentry/types';
3
+ export { stripUrlQueryAndFragment } from '@sentry/utils';
4
+ /** Store the scope & isolation scope for a span, which can the be used when it is finished. */
5
+ export declare function setCapturedScopesOnSpan(span: Span | undefined, scope: Scope, isolationScope: Scope): void;
6
+ /**
7
+ * Grabs the scope and isolation scope off a span that were active when the span was started.
8
+ */
9
+ export declare function getCapturedScopesOnSpan(span: Span): {
10
+ scope?: Scope;
11
+ isolationScope?: Scope;
12
+ };
13
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Wrap a callback function with error handling.
3
+ * If an error is thrown, it will be passed to the `onError` callback and re-thrown.
4
+ *
5
+ * If the return value of the function is a promise, it will be handled with `maybeHandlePromiseRejection`.
6
+ *
7
+ * If an `onFinally` callback is provided, this will be called when the callback has finished
8
+ * - so if it returns a promise, once the promise resolved/rejected,
9
+ * else once the callback has finished executing.
10
+ * The `onFinally` callback will _always_ be called, no matter if an error was thrown or not.
11
+ */
12
+ export declare function handleCallbackErrors<Fn extends () => any>(fn: Fn, onError: (error: unknown) => void, onFinally?: () => void): ReturnType<Fn>;
13
+ //# sourceMappingURL=handleCallbackErrors.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { Options } from '@sentry/types';
2
+ /**
3
+ * Determines if tracing is currently enabled.
4
+ *
5
+ * Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config.
6
+ */
7
+ export declare function hasTracingEnabled(maybeOptions?: Pick<Options, 'tracesSampleRate' | 'tracesSampler' | 'enableTracing'> | undefined): boolean;
8
+ //# sourceMappingURL=hasTracingEnabled.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Parse a sample rate from a given value.
3
+ * This will either return a boolean or number sample rate, if the sample rate is valid (between 0 and 1).
4
+ * If a string is passed, we try to convert it to a number.
5
+ *
6
+ * Any invalid sample rate will return `undefined`.
7
+ */
8
+ export declare function parseSampleRate(sampleRate: unknown): number | undefined;
9
+ //# sourceMappingURL=parseSampleRate.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { Scope, Span } from '@sentry/types';
2
+ declare const SCOPE_SPAN_FIELD = "_sentrySpan";
3
+ type ScopeWithMaybeSpan = Scope & {
4
+ [SCOPE_SPAN_FIELD]?: Span;
5
+ };
6
+ /**
7
+ * Set the active span for a given scope.
8
+ * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
9
+ */
10
+ export declare function _setSpanForScope(scope: Scope, span: Span | undefined): void;
11
+ /**
12
+ * Get the active span for a given scope.
13
+ * NOTE: This should NOT be used directly, but is only used internally by the trace methods.
14
+ */
15
+ export declare function _getSpanForScope(scope: ScopeWithMaybeSpan): Span | undefined;
16
+ export {};
17
+ //# sourceMappingURL=spanOnScope.d.ts.map