agent/metrics/metrics_engine.go
func MustInit(cfg *config.Config, registry ...*prometheus.Registry) {
	if !cfg.PrometheusMetricsEnabled {
		return
	}
	var registryToUse *prometheus.Registry
	if len(registry) > 0 {
		registryToUse = registry[0]
	} else {
		registryToUse = prometheus.DefaultRegisterer.(*prometheus.Registry)
	}
	MetricsEngineGlobal = NewMetricsEngine(cfg, registryToUse)
	MetricsEngineGlobal.collection = true
}
func MustInit(cfg *config.Config, registry ...*prometheus.Registry) {
	if !cfg.PrometheusMetricsEnabled {
		return
	}
	var registryToUse *prometheus.Registry
	if len(registry) > 0 {
		registryToUse = registry[0]
	} else {
		registryToUse = prometheus.DefaultRegisterer.(*prometheus.Registry)
	}
	MetricsEngineGlobal = NewMetricsEngine(cfg, registryToUse)
	MetricsEngineGlobal.collection = true
}
func MustInit ( cfg * config . Config , registry ... * prometheus . Registry ) { if ! cfg . PrometheusMetricsEnabled { return } var registryToUse * prometheus . Registry if len ( registry ) > 0 { registryToUse = registry [ 0 ] } else { registryToUse = prometheus . DefaultRegisterer . ( * prometheus . Registry ) } MetricsEngineGlobal = NewMetricsEngine ( cfg , registryToUse ) MetricsEngineGlobal . collection = true }
// Initializes the Global MetricsEngine used throughout Agent
// Currently, we use the Prometheus Global Default Registerer, which also collecs
// basic Go application metrics that we use (like memory usage).
// In future cases, we can use a custom Prometheus Registry to group metrics.
// For unit testing purposes, we only focus on API calls and use our own Registry
Initializes the Global MetricsEngine used throughout Agent Currently we use the Prometheus Global Default Registerer which also collecs basic Go application metrics that we use ( like memory usage ) . In future cases we can use a custom Prometheus Registry to group metrics . For unit testing purposes we only focus on API calls and use our own Registry