Skip to content

Commit f841ed1

Browse files
committed
feat(cmd/curl): include timings in JSON output
The PerfOps API returns timings in curl responses, that this command line tool was ignoring. This CL adds this field to the internal structs, so that it will be marshalled for output. Bug: #35
1 parent 2684cd1 commit f841ed1

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

perfops/run.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type (
5656
Output interface{} `json:"output,omitempty"`
5757
Message string `json:"message,omitempty"`
5858
Finished interface{} `json:"finished"`
59+
Timing *RunTiming `json:"timing,omitempty"`
5960
}
6061

6162
// RunItem represents an item of an MTR or ping output.
@@ -72,6 +73,14 @@ type (
7273
Items []*RunItem `json:"items,omitempty"`
7374
}
7475

76+
// RunTiming represents the test timings.
77+
RunTiming struct {
78+
Total float64 `json:"total,omitempty,string"`
79+
DNS float64 `json:"dns,omitempty,string"`
80+
Connect float64 `json:"connect,omitempty,string"`
81+
TTFB float64 `json:"ttfb,omityempty,string"`
82+
}
83+
7584
// DNSPerfRequest represents the parameters for a DNS perf request.
7685
DNSPerfRequest struct {
7786
Target string `json:"target,omitempty"`

0 commit comments

Comments
 (0)