From 0004a733c85cee991a8a170e93cd69c326cc8f2f Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 8 Jan 2021 10:26:35 -0600 Subject: [PATCH] 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 --- tpl/partials/partials.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/partials/partials.go b/tpl/partials/partials.go index 016e0423..e8a8adc3 100644 --- a/tpl/partials/partials.go +++ b/tpl/partials/partials.go @@ -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 -- 2.30.2