From 12cf72c88eb7621505e0a630025fe86654369a0f Mon Sep 17 00:00:00 2001 From: vicanso Date: Sat, 26 Oct 2024 13:02:42 +0800 Subject: [PATCH] feat: support unmarshal time --- .github/workflows/test.yml | 1 + trace.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 451e3c4..ff63a7b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: strategy: matrix: go: + - '1.23' - '1.22' - '1.21' - '1.20' diff --git a/trace.go b/trace.go index 2ca96d6..3fdc05c 100644 --- a/trace.go +++ b/trace.go @@ -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"` } @@ -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"` } @@ -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 }