github.com/hairyhenderson/gomplate/v4@v4.0.0-pre-2.0.20240520121557-362f058f0c93/metrics.go (about)

     1  package gomplate
     2  
     3  import "time"
     4  
     5  // Metrics tracks interesting basic metrics around gomplate executions. Warning: experimental!
     6  // This may change in breaking ways without warning. This is not subject to any semantic versioning guarantees!
     7  var Metrics *MetricsType
     8  
     9  // MetricsType - Warning: experimental! This may change in breaking ways without warning.
    10  // This is not subject to any semantic versioning guarantees!
    11  type MetricsType struct {
    12  	// times for rendering each template
    13  	RenderDuration map[string]time.Duration
    14  	// time it took to gather templates
    15  	GatherDuration time.Duration
    16  	// time it took to render all templates
    17  	TotalRenderDuration time.Duration
    18  
    19  	TemplatesGathered  int
    20  	TemplatesProcessed int
    21  	Errors             int
    22  }
    23  
    24  func newMetrics() *MetricsType {
    25  	return &MetricsType{
    26  		RenderDuration: make(map[string]time.Duration),
    27  	}
    28  }