metrics: Add simple template metrics feature

This commit is contained in:
Cameron Moore
2017-09-26 13:03:04 -05:00
committed by Bjørn Erik Pedersen
parent cb8eb47260
commit b4a14c25fe
7 changed files with 159 additions and 3 deletions

7
deps/deps.go vendored
View File

@@ -8,6 +8,7 @@ import (
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/metrics"
"github.com/gohugoio/hugo/output"
"github.com/gohugoio/hugo/tpl"
jww "github.com/spf13/jwalterweatherman"
@@ -47,6 +48,8 @@ type Deps struct {
WithTemplate func(templ tpl.TemplateHandler) error `json:"-"`
translationProvider ResourceProvider
Metrics metrics.Provider
}
// ResourceProvider is used to create and refresh, and clone resources needed.
@@ -131,6 +134,10 @@ func New(cfg DepsCfg) (*Deps, error) {
Language: cfg.Language,
}
if cfg.Cfg.GetBool("templateMetrics") {
d.Metrics = metrics.NewProvider()
}
return d, nil
}