1
1
import { trimPackage } from 'sentry/components/events/interfaces/frame/utils' ;
2
2
import type { SymbolicatorStatus } from 'sentry/components/events/interfaces/types' ;
3
3
import { t } from 'sentry/locale' ;
4
+ import { defined } from 'sentry/utils' ;
4
5
5
6
const ROOT_KEY = 'sentry root' ;
6
7
const BROWSER_EXTENSION_REGEXP = / ^ ( \@ m o z - e x t e n s i o n \: \/ \/ | c h r o m e - e x t e n s i o n \: \/ \/ ) / ;
@@ -27,9 +28,9 @@ export class Frame {
27
28
28
29
readonly isRoot : boolean ;
29
30
30
- totalWeight = 0 ;
31
- selfWeight = 0 ;
32
- aggregateDuration = 0 ;
31
+ readonly totalCallCount ?: number ;
32
+ readonly totalCallDuration ?: number ;
33
+ readonly averageCallDuration ?: number ;
33
34
34
35
static Root = new Frame ( {
35
36
key : ROOT_KEY ,
@@ -38,40 +39,49 @@ export class Frame {
38
39
} ) ;
39
40
40
41
constructor (
41
- frameInfo : Profiling . FrameInfo ,
42
+ frame : Profiling . Frame ,
42
43
type ?: 'mobile' | 'javascript' | 'node' | string ,
43
44
// In aggregate mode, we miss certain info like lineno/col and so
44
45
// we need to make sure we don't try to use it or infer data based on it
45
46
mode ?: 'detailed' | 'aggregate'
46
47
) {
47
- this . key = frameInfo . key ;
48
- this . file = frameInfo . file ;
49
- this . name = frameInfo . name ;
50
- this . resource = frameInfo . resource ;
51
- this . line = frameInfo . line ;
52
- this . column = frameInfo . column ;
53
- this . is_application = ! ! frameInfo . is_application ;
54
- this . package = frameInfo . package ;
55
- this . module = frameInfo . module ?? frameInfo . image ;
56
- this . threadId = frameInfo . threadId ;
57
- this . path = frameInfo . path ;
58
- this . platform = frameInfo . platform ;
59
- this . instructionAddr = frameInfo . instructionAddr ;
60
- this . symbol = frameInfo . symbol ;
61
- this . symbolAddr = frameInfo . symbolAddr ;
62
- this . symbolicatorStatus = frameInfo . symbolicatorStatus ;
48
+ this . key = frame . key ;
49
+ this . file = frame . file ;
50
+ this . name = frame . name ;
51
+ this . resource = frame . resource ;
52
+ this . line = frame . line ;
53
+ this . column = frame . column ;
54
+ this . is_application = ! ! frame . is_application ;
55
+ this . package = frame . package ;
56
+ this . module = frame . module ?? frame . image ;
57
+ this . threadId = frame . threadId ;
58
+ this . path = frame . path ;
59
+ this . platform = frame . platform ;
60
+ this . instructionAddr = frame . instructionAddr ;
61
+ this . symbol = frame . symbol ;
62
+ this . symbolAddr = frame . symbolAddr ;
63
+ this . symbolicatorStatus = frame . symbolicatorStatus ;
63
64
this . isRoot = this . key === ROOT_KEY ;
64
65
66
+ this . totalCallCount = frame . count ;
67
+ this . totalCallDuration = frame . weight ;
68
+ this . averageCallDuration =
69
+ defined ( frame . weight ) && defined ( frame . count )
70
+ ? frame . count
71
+ ? frame . weight / frame . count
72
+ : 0
73
+ : undefined ;
74
+
65
75
// We are remapping some of the keys as they differ between platforms.
66
76
// This is a temporary solution until we adopt a unified format.
67
- if ( frameInfo . columnNumber && this . column === undefined ) {
68
- this . column = frameInfo . columnNumber ;
77
+ if ( frame . columnNumber && this . column === undefined ) {
78
+ this . column = frame . columnNumber ;
69
79
}
70
- if ( frameInfo . lineNumber && this . column === undefined ) {
71
- this . line = frameInfo . lineNumber ;
80
+ if ( frame . lineNumber && this . column === undefined ) {
81
+ this . line = frame . lineNumber ;
72
82
}
73
- if ( frameInfo . scriptName && this . column === undefined ) {
74
- this . resource = frameInfo . scriptName ;
83
+ if ( frame . scriptName && this . column === undefined ) {
84
+ this . resource = frame . scriptName ;
75
85
}
76
86
77
87
// If the frame is a web frame and there is no name associated to it, then it was likely invoked as an iife or anonymous callback as
0 commit comments