File tree 7 files changed +21
-9
lines changed
7 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,7 @@ export const generateUseBeacon =
34
34
const renderCountRef = useRef ( 0 )
35
35
renderCountRef . current += 1
36
36
37
- const attributes = {
38
- ...config . attributes ,
39
- renderCount : renderCountRef . current ,
40
- }
37
+ const { attributes } = config
41
38
42
39
const status = config . error ? 'error' : 'ok'
43
40
@@ -47,6 +44,7 @@ export const generateUseBeacon =
47
44
duration : 0 ,
48
45
attributes,
49
46
status,
47
+ renderCount : renderCountRef . current ,
50
48
} )
51
49
52
50
traceManager . processSpan ( renderStartTaskEntry )
@@ -60,6 +58,7 @@ export const generateUseBeacon =
60
58
duration : performance . now ( ) - renderStartTaskEntry . startTime . now ,
61
59
status,
62
60
attributes,
61
+ renderCount : renderCountRef . current ,
63
62
} ) ,
64
63
)
65
64
} )
@@ -75,6 +74,7 @@ export const generateUseBeacon =
75
74
errorInfo : errorBoundaryMetadata ?. errorInfo ,
76
75
duration : 0 ,
77
76
status : errorBoundaryMetadata ?. error ? 'error' : 'ok' ,
77
+ renderCount : renderCountRef . current ,
78
78
} )
79
79
traceManager . processSpan ( unmountEntry )
80
80
} ,
Original file line number Diff line number Diff line change @@ -16,12 +16,15 @@ export type SpanMatcherFn<ScopeT extends ScopeBase> = ((
16
16
SpanMatcherTags
17
17
18
18
export interface SpanMatchDefinition < ScopeT extends ScopeBase > {
19
+ // IMPLEMENTATION TODO: take in scope as a second parameter
19
20
name ?: string | RegExp | ( ( name : string ) => boolean )
21
+ // IMPLEMENTATION TODO: take in scope as a second parameter
20
22
performanceEntryName ?: string | RegExp | ( ( name : string ) => boolean )
21
23
type ?: SpanType
22
24
status ?: SpanStatus
23
25
attributes ?: Attributes
24
26
scopes ?: ( keyof ScopeT ) [ ]
27
+ // IMPLEMENTATION TODO: take in scope as a second parameter
25
28
occurrence ?: number | ( ( occurrence : number ) => boolean )
26
29
isIdle ?: boolean
27
30
}
Original file line number Diff line number Diff line change @@ -95,9 +95,10 @@ export interface SpanBase<ScopeT extends ScopeBase> {
95
95
96
96
export interface ComponentRenderSpan < ScopeT extends ScopeBase >
97
97
extends Omit < SpanBase < ScopeT > , 'scope' | 'attributes' > ,
98
- BeaconConfig < ScopeT > {
98
+ BeaconConfig < ScopeT > {
99
99
type : ComponentLifecycleSpanType
100
100
errorInfo ?: ErrorInfo
101
+ renderCount : number
101
102
}
102
103
103
104
export type InitiatorType =
@@ -126,17 +127,22 @@ export type InitiatorType =
126
127
127
128
export interface ResourceSpan < ScopeT extends ScopeBase >
128
129
extends SpanBase < ScopeT > {
130
+ type : 'resource' ,
129
131
resourceDetails : {
130
132
initiatorType : InitiatorType
131
133
query : Record < string , string | string [ ] >
132
134
hash : string
133
135
}
134
136
}
137
+
138
+ export interface PerformanceEntrySpan < ScopeT extends ScopeBase > extends SpanBase < ScopeT > {
139
+ type : Exclude < NativePerformanceEntryType , 'resource' >
140
+ }
141
+
135
142
/**
136
143
* All possible trace entries
137
144
*/
138
-
139
145
export type Span < ScopeT extends ScopeBase > =
140
- | SpanBase < ScopeT >
146
+ | PerformanceEntrySpan < ScopeT >
141
147
| ComponentRenderSpan < ScopeT >
142
148
| ResourceSpan < ScopeT >
Original file line number Diff line number Diff line change @@ -591,4 +591,6 @@ describe('TraceManager', () => {
591
591
expect ( report . interruptionReason ) . toBe ( 'timeout' )
592
592
} )
593
593
} )
594
+
595
+ // TESTING TODO: add test cases with getQuietWindowDuration
594
596
} )
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export class TraceManager<ScopeT extends ScopeBase> {
65
65
computedValueDefinitions,
66
66
}
67
67
68
+ // TESTING TODO: Add tests for define computed span and define computed value
68
69
return {
69
70
defineComputedSpan : ( definition ) => {
70
71
computedSpanDefinitions . push ( definition )
Original file line number Diff line number Diff line change @@ -85,6 +85,6 @@ export interface ComputedValueDefinition<
85
85
matches : [ ...MatchersT ]
86
86
computeValueFromMatches : (
87
87
// as many matches as match of type Span<ScopeT>
88
- matches : MapTuple < MatchersT , SpanAndAnnotation < ScopeT > > ,
88
+ ... matches : MapTuple < MatchersT , SpanAndAnnotation < ScopeT > [ ] >
89
89
) => number | string | boolean
90
90
}
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export interface TraceDefinition<ScopeT extends ScopeBase> {
86
86
*/
87
87
name : string
88
88
89
- type : TraceType
89
+ type ? : TraceType
90
90
91
91
// TODO: implement this with typechecking
92
92
// to ensure we cannot start a trace without the required scope keys
You can’t perform that action at this time.
0 commit comments