File tree Expand file tree Collapse file tree 3 files changed +33
-34
lines changed Expand file tree Collapse file tree 3 files changed +33
-34
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ import { Hub } from '@sentry/hub';
33import { TransactionContext } from '@sentry/types' ;
44import { logger , timestampWithMs } from '@sentry/utils' ;
55
6- import { Span } from './span' ;
6+ import { Span , SpanRecorder } from './span' ;
77import { SpanStatus } from './spanstatus' ;
8- import { SpanRecorder , Transaction } from './transaction' ;
8+ import { Transaction } from './transaction' ;
99
1010export const DEFAULT_IDLE_TIMEOUT = 1000 ;
1111
Original file line number Diff line number Diff line change 1+ // tslint:disable:max-classes-per-file
12import { Span as SpanInterface , SpanContext } from '@sentry/types' ;
23import { dropUndefinedKeys , timestampWithMs , uuid4 } from '@sentry/utils' ;
34
45import { SpanStatus } from './spanstatus' ;
5- import { SpanRecorder } from './transaction' ;
66
77export const TRACEPARENT_REGEXP = new RegExp (
88 '^[ \\t]*' + // whitespace
@@ -12,6 +12,35 @@ export const TRACEPARENT_REGEXP = new RegExp(
1212 '[ \\t]*$' , // whitespace
1313) ;
1414
15+ /**
16+ * Keeps track of finished spans for a given transaction
17+ * @internal
18+ * @hideconstructor
19+ * @hidden
20+ */
21+ export class SpanRecorder {
22+ private readonly _maxlen : number ;
23+ public spans : Span [ ] = [ ] ;
24+
25+ public constructor ( maxlen : number = 1000 ) {
26+ this . _maxlen = maxlen ;
27+ }
28+
29+ /**
30+ * This is just so that we don't run out of memory while recording a lot
31+ * of spans. At some point we just stop and flush out the start of the
32+ * trace tree (i.e.the first n spans with the smallest
33+ * start_timestamp).
34+ */
35+ public add ( span : Span ) : void {
36+ if ( this . spans . length > this . _maxlen ) {
37+ span . spanRecorder = undefined ;
38+ } else {
39+ this . spans . push ( span ) ;
40+ }
41+ }
42+ }
43+
1544/**
1645 * Span contains all data about a span
1746 */
Original file line number Diff line number Diff line change 1- // tslint:disable:max-classes-per-file
21import { getCurrentHub , Hub } from '@sentry/hub' ;
32import { TransactionContext } from '@sentry/types' ;
43import { isInstanceOf , logger } from '@sentry/utils' ;
54
6- import { Span as SpanClass } from './span' ;
7-
8- /**
9- * Keeps track of finished spans for a given transaction
10- * @internal
11- * @hideconstructor
12- * @hidden
13- */
14- export class SpanRecorder {
15- private readonly _maxlen : number ;
16- public spans : SpanClass [ ] = [ ] ;
17-
18- public constructor ( maxlen : number = 1000 ) {
19- this . _maxlen = maxlen ;
20- }
21-
22- /**
23- * This is just so that we don't run out of memory while recording a lot
24- * of spans. At some point we just stop and flush out the start of the
25- * trace tree (i.e.the first n spans with the smallest
26- * start_timestamp).
27- */
28- public add ( span : SpanClass ) : void {
29- if ( this . spans . length > this . _maxlen ) {
30- span . spanRecorder = undefined ;
31- } else {
32- this . spans . push ( span ) ;
33- }
34- }
35- }
5+ import { Span as SpanClass , SpanRecorder } from './span' ;
366
377/** JSDoc */
388export class Transaction extends SpanClass {
You can’t perform that action at this time.
0 commit comments