-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
73 lines (65 loc) · 2.17 KB
/
types.go
File metadata and controls
73 lines (65 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package profiler
import "time"
// Metrics holds XHProf metric values for a single caller→callee edge
type Metrics struct {
WallTime int64 `json:"wt"`
CPU int64 `json:"cpu"`
Memory int64 `json:"mu"`
PeakMem int64 `json:"pmu"`
Calls int64 `json:"ct"`
}
// Percentages of peak values
type Percentages struct {
WallTime float64 `json:"p_wt"`
CPU float64 `json:"p_cpu"`
Memory float64 `json:"p_mu"`
PeakMem float64 `json:"p_pmu"`
Calls float64 `json:"p_ct"`
}
// Diffs (exclusive metrics: inclusive minus children)
type Diffs struct {
WallTime int64 `json:"d_wt"`
CPU int64 `json:"d_cpu"`
Memory int64 `json:"d_mu"`
PeakMem int64 `json:"d_pmu"`
Calls int64 `json:"d_ct"`
}
// Edge represents a processed caller→callee relationship
type Edge struct {
ID string `json:"id"`
Caller *string `json:"caller"`
Callee string `json:"callee"`
Cost Metrics `json:"cost"`
Diff Diffs `json:"diff"`
Percents Percentages `json:"percents"`
Parent *string `json:"parent"`
}
// ProfileEvent is the fully processed event pushed to Jobs
type ProfileEvent struct {
Event string `json:"event"`
UUID string `json:"uuid"`
AppName string `json:"app_name"`
Hostname string `json:"hostname"`
Date int64 `json:"date"`
Tags map[string]any `json:"tags,omitempty"`
Peaks Metrics `json:"peaks"`
Edges map[string]Edge `json:"edges"`
TotalEdges int `json:"total_edges"`
ReceivedAt time.Time `json:"received_at"`
}
// IncomingProfile is the raw XHProf payload from the PHP client
type IncomingProfile struct {
Profile map[string]RawMetrics `json:"profile"`
AppName string `json:"app_name"`
Hostname string `json:"hostname"`
Date int64 `json:"date"`
Tags map[string]any `json:"tags,omitempty"`
}
// RawMetrics from XHProf — cpu may be absent when XHPROF_FLAGS_CPU is not set
type RawMetrics struct {
WallTime int64 `json:"wt"`
CPU int64 `json:"cpu"`
Memory int64 `json:"mu"`
PeakMem int64 `json:"pmu"`
Calls int64 `json:"ct"`
}