-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmetrics.go
63 lines (56 loc) · 2.47 KB
/
metrics.go
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
package main
import (
"encoding/json"
"github.com/volatiletech/null/v8"
)
type Metrics struct {
NavigationPerformance *PerformanceNavigationEntry
// can grow
}
func (pr *probeResult) NullJSON() (null.JSON, error) {
m := Metrics{
NavigationPerformance: pr.navPerf,
}
data, err := json.Marshal(m)
if err != nil {
return null.NewJSON(nil, false), err
}
return null.JSONFrom(data), nil
}
// PerformanceNavigationEntry was generated with quicktype.io
type PerformanceNavigationEntry struct {
Name string `json:"name"`
EntryType string `json:"entryType"`
StartTime float64 `json:"startTime"`
Duration float64 `json:"duration"`
InitiatorType string `json:"initiatorType"`
NextHopProtocol string `json:"nextHopProtocol"`
RenderBlockingStatus string `json:"renderBlockingStatus"`
WorkerStart float64 `json:"workerStart"`
RedirectStart float64 `json:"redirectStart"`
RedirectEnd float64 `json:"redirectEnd"`
FetchStart float64 `json:"fetchStart"`
DomainLookupStart float64 `json:"domainLookupStart"`
DomainLookupEnd float64 `json:"domainLookupEnd"`
ConnectStart float64 `json:"connectStart"`
SecureConnectionStart float64 `json:"secureConnectionStart"`
ConnectEnd float64 `json:"connectEnd"`
RequestStart float64 `json:"requestStart"`
ResponseStart float64 `json:"responseStart"`
ResponseEnd float64 `json:"responseEnd"`
TransferSize int64 `json:"transferSize"`
EncodedBodySize int64 `json:"encodedBodySize"`
DecodedBodySize int64 `json:"decodedBodySize"`
ResponseStatus int64 `json:"responseStatus"`
UnloadEventStart float64 `json:"unloadEventStart"`
UnloadEventEnd float64 `json:"unloadEventEnd"`
DOMInteractive float64 `json:"domInteractive"`
DOMContentLoadedEventStart float64 `json:"domContentLoadedEventStart"`
DOMContentLoadedEventEnd float64 `json:"domContentLoadedEventEnd"`
DOMComplete float64 `json:"domComplete"`
LoadEventStart float64 `json:"loadEventStart"`
LoadEventEnd float64 `json:"loadEventEnd"`
Type string `json:"type"`
RedirectCount int64 `json:"redirectCount"`
ActivationStart float64 `json:"activationStart"`
}