commit 0004a733c85cee991a8a170e93cd69c326cc8f2f
parent 8a26ab0bc5dd9fa34e1362681fc08b0e522cd4ea
Author: Cameron Moore <moorereason@gmail.com>
Date: Fri, 8 Jan 2021 10:26:35 -0600
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
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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