summaryrefslogtreecommitdiff
path: root/metrics.go
blob: d7e83d3e987022a58a9910f2670ffe6a836c0aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package gomplate

import "time"

// Metrics tracks interesting basic metrics around gomplate executions. Warning: experimental!
// This may change in breaking ways without warning. This is not subject to any semantic versioning guarantees!
var Metrics *MetricsType

// MetricsType - Warning: experimental! This may change in breaking ways without warning.
// This is not subject to any semantic versioning guarantees!
type MetricsType struct {
	TemplatesGathered   int
	TemplatesProcessed  int
	Errors              int
	GatherDuration      time.Duration            // time it took to gather templates
	TotalRenderDuration time.Duration            // time it took to render all templates
	RenderDuration      map[string]time.Duration // times for rendering each template
}

func newMetrics() *MetricsType {
	return &MetricsType{
		RenderDuration: make(map[string]time.Duration),
	}
}