Skip to content

Commit

Permalink
feat: support unmarshal time
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Oct 26, 2024
1 parent 1e20161 commit 12cf72c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
strategy:
matrix:
go:
- '1.23'
- '1.22'
- '1.21'
- '1.20'
Expand Down
9 changes: 9 additions & 0 deletions trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type (
ServerProcessing time.Duration `json:"serverProcessing,omitempty"`
// content transfer time
ContentTransfer time.Duration `json:"contentTransfer,omitempty"`
// unmarshal time
Unmarshal time.Duration `json:"unmarshal,omitempty"`
// total time
Total time.Duration `json:"total,omitempty"`
}
Expand Down Expand Up @@ -110,6 +112,10 @@ type (
TLSHandshakeStart time.Time `json:"tlsHandshakeStart,omitempty"`
// tls handshake done time
TLSHandshakeDone time.Time `json:"tlsHandshakeDone,omitempty"`
// unmarshal start time
UnmarshalStart time.Time `json:"unmarshalStart,omitempty"`
// unmarshal done time
UnmarshalDone time.Time `json:"unmarshalDone,omitempty"`
// request done time
Done time.Time `json:"done,omitempty"`
}
Expand Down Expand Up @@ -236,6 +242,9 @@ func (ht *HTTPTrace) Stats() (stats *HTTPTimelineStats) {
if !ht.GotFirstResponseByte.IsZero() {
stats.ContentTransfer = ht.Done.Sub(ht.GotFirstResponseByte)
}
if !ht.UnmarshalDone.IsZero() {
stats.Unmarshal = ht.UnmarshalDone.Sub(ht.UnmarshalStart)
}
stats.Total = ht.Done.Sub(ht.Start)
return
}
Expand Down

0 comments on commit 12cf72c

Please sign in to comment.