summaryrefslogtreecommitdiff
path: root/metrics.go
blob: 3a3d58baa91e3b1ef470376ef0bc3a8c3c22bac2 (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
25
26
27
28
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 {
	// times for rendering each template
	RenderDuration map[string]time.Duration
	// time it took to gather templates
	GatherDuration time.Duration
	// time it took to render all templates
	TotalRenderDuration time.Duration

	TemplatesGathered  int
	TemplatesProcessed int
	Errors             int
}

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