File tree Expand file tree Collapse file tree 2 files changed +26
-24
lines changed Expand file tree Collapse file tree 2 files changed +26
-24
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
2
Breadcrumb ,
3
3
CaptureContext ,
4
+ CustomSamplingContext ,
4
5
Event ,
5
6
Extra ,
6
7
Extras ,
7
8
Primitive ,
8
9
Severity ,
9
10
SeverityLevel ,
11
+ TransactionContext ,
10
12
User ,
11
13
} from '@sentry/types' ;
12
14
@@ -160,3 +162,27 @@ export function setUser(user: User | null): ReturnType<Hub['setUser']> {
160
162
export function withScope ( callback : ( scope : Scope ) => void ) : ReturnType < Hub [ 'withScope' ] > {
161
163
getCurrentHub ( ) . withScope ( callback ) ;
162
164
}
165
+
166
+ /**
167
+ * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
168
+ *
169
+ * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
170
+ * new child span within the transaction or any span, call the respective `.startChild()` method.
171
+ *
172
+ * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
173
+ *
174
+ * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its
175
+ * finished child spans will be sent to Sentry.
176
+ *
177
+ * @param context Properties of the new `Transaction`.
178
+ * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
179
+ * default values). See {@link Options.tracesSampler}.
180
+ *
181
+ * @returns The transaction which was just started
182
+ */
183
+ export function startTransaction (
184
+ context : TransactionContext ,
185
+ customSamplingContext ?: CustomSamplingContext ,
186
+ ) : ReturnType < Hub [ 'startTransaction' ] > {
187
+ return getCurrentHub ( ) . startTransaction ( { ...context } , customSamplingContext ) ;
188
+ }
Original file line number Diff line number Diff line change @@ -28,27 +28,3 @@ function callOnHub<T>(method: string, ...args: any[]): T {
28
28
}
29
29
throw new Error ( `No hub defined or ${ method } was not found on the hub, please open a bug report.` ) ;
30
30
}
31
-
32
- /**
33
- * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
34
- *
35
- * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
36
- * new child span within the transaction or any span, call the respective `.startChild()` method.
37
- *
38
- * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
39
- *
40
- * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its
41
- * finished child spans will be sent to Sentry.
42
- *
43
- * @param context Properties of the new `Transaction`.
44
- * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
45
- * default values). See {@link Options.tracesSampler}.
46
- *
47
- * @returns The transaction which was just started
48
- */
49
- export function startTransaction (
50
- context : TransactionContext ,
51
- customSamplingContext ?: CustomSamplingContext ,
52
- ) : Transaction {
53
- return callOnHub ( 'startTransaction' , { ...context } , customSamplingContext ) ;
54
- }
You can’t perform that action at this time.
0 commit comments