Skip to content

Commit

Permalink
tpl: Fix metrics hint tracking
Browse files Browse the repository at this point in the history
When tracking for cache hints, track the same template name as the call
to MeasureSince() in Execute.  When referencing a partial "foo", the
value of `n` does not match `templ.Name()` (`partials/foo` versus
`partials/foo.html`), which was caused hints to not be tracked since
there was no existing metric to append the hint to.

Fixes gohugoio#8125
  • Loading branch information
moorereason committed Jan 8, 2021
1 parent 4d2b6fc commit fb41086
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tpl/partials/partials.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (ns *Namespace) Include(name string, contextList ...interface{}) (interface
}

if ns.deps.Metrics != nil {
ns.deps.Metrics.TrackValue(n, result)
ns.deps.Metrics.TrackValue(templ.Name(), result)
}

return result, nil
Expand Down

0 comments on commit fb41086

Please sign in to comment.