internal/frontend: add decoding time to stats
Change-Id: I429dfacd8ef8097869f03450258a7eebdc7b06b3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/262998
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/internal/frontend/unit_main.go b/internal/frontend/unit_main.go
index 359d918..76d1d3e 100644
--- a/internal/frontend/unit_main.go
+++ b/internal/frontend/unit_main.go
@@ -131,7 +131,9 @@
files []*File
)
if unit.Documentation != nil {
+ end := middleware.ElapsedStat(ctx, "DecodePackage")
docPkg, err := godoc.DecodePackage(unit.Documentation.Source)
+ end()
if err != nil {
return nil, err
}
@@ -139,8 +141,7 @@
// TODO: Deprecate godoc.Parse. The sidenav and body can
// either be rendered using separate functions, or all this content can
// be passed to the template via the UnitPage struct.
- end := middleware.ElapsedStat(ctx, "godoc Parses")
-
+ end = middleware.ElapsedStat(ctx, "godoc Parses")
b, err := godoc.Parse(docHTML, godoc.BodySection)
if err != nil {
return nil, err