tpl: Fix metrics hint tracking

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`).  This was causing hints to go untracked since
there was no existing metric to append the hint to.

Fixes #8125
This commit is contained in:
Cameron Moore 2021-01-08 10:26:35 -06:00 committed by Bjørn Erik Pedersen
parent 8a26ab0bc5
commit 0004a733c8

View file

@ -155,7 +155,7 @@ func (ns *Namespace) Include(name string, contextList ...interface{}) (interface
} }
if ns.deps.Metrics != nil { if ns.deps.Metrics != nil {
ns.deps.Metrics.TrackValue(n, result) ns.deps.Metrics.TrackValue(templ.Name(), result)
} }
return result, nil return result, nil