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

Fixes #8125
  • Loading branch information
moorereason authored and bep committed Jan 8, 2021
1 parent 8a26ab0 commit 0004a73
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 0004a73

Please sign in to comment.