diff options
| author | Will Hawkins <[email protected]> | 2022-05-05 01:59:46 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2022-05-05 01:59:46 -0400 |
| commit | 2a9feb82b55481308c0f6aa9d813e9021b0333ef (patch) | |
| tree | ebe116516ce93446508100ccac64178a20ac3a6f /stats | |
| parent | 10ddc4e9c56beeb5718cd878313ddf88695a1948 (diff) | |
Upgraded RPM Calculation Support (Take 1)
This patch begins the work on updated RPM calculations using
the httptrace infrastructure. Because we are still not able
to break out the TLS handshake time due to upstream bugs, there
are some workarounds in place. However, the numbers appear much
more sane.
Diffstat (limited to 'stats')
| -rw-r--r-- | stats/stats.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/stats/stats.go b/stats/stats.go new file mode 100644 index 0000000..a636326 --- /dev/null +++ b/stats/stats.go @@ -0,0 +1,50 @@ +package stats + +import ( + "crypto/tls" + "fmt" + "net/http/httptrace" + "time" + + "github.com/network-quality/goresponsiveness/utilities" +) + +type TraceStats struct { + DnsStart httptrace.DNSStartInfo + DnsDone httptrace.DNSDoneInfo + ConnInfo httptrace.GotConnInfo + HttpInfo httptrace.WroteRequestInfo + TLSConnInfo tls.ConnectionState + ConnectDoneError error + DnsStartTime time.Time + DnsDoneTime time.Time + TLSStartTime utilities.Optional[time.Time] + TLSDoneTime utilities.Optional[time.Time] + ConnectStartTime time.Time + ConnectDoneTime time.Time + GetConnectionStartTime time.Time + GetConnectionDoneTime time.Time + HttpWroteRequestTime time.Time + HttpResponseReadyTime time.Time +} + +func NewStats() *TraceStats { + return &TraceStats{} +} + +func (s *TraceStats) String() string { + return fmt.Sprintf("DnsStart: %v\n", s.DnsStart) + + fmt.Sprintf("DnsDone: %v\n", s.DnsDone) + + fmt.Sprintf("ConnInfo: %v\n", s.ConnInfo) + + fmt.Sprintf("HttpInfo: %v\n", s.HttpInfo) + + fmt.Sprintf("TLSConnInfo: %v\n", s.TLSConnInfo) + + fmt.Sprintf("ConnectDoneError: %v\n", s.ConnectDoneError) + + fmt.Sprintf("DnsStartTime: %v\n", s.DnsStartTime) + + fmt.Sprintf("DnsDoneTime: %v\n", s.DnsDoneTime) + + fmt.Sprintf("TLSDoneTime: %v\n", s.TLSDoneTime) + + fmt.Sprintf("ConnectStartTime: %v\n", s.ConnectStartTime) + + fmt.Sprintf("ConnectDoneTime: %v\n", s.ConnectDoneTime) + + fmt.Sprintf("GetConnectionStartTime: %v\n", s.GetConnectionStartTime) + + fmt.Sprintf("GetConnectionDoneTime: %v\n", s.GetConnectionDoneTime) + + fmt.Sprintf("HttpResponseReadyTime: %v\n", s.HttpResponseReadyTime) +} |
