func NewMetricStore()

in pkg/metricstore/metricstore.go [56:109]


func NewMetricStore(envVariable environment.EnvVariables) MetricStore {
	constLabels := prometheus.Labels{
		"controller_class":                envVariable.IngressClassControllerName,
		"controller_namespace":            envVariable.AGICPodNamespace,
		"controller_pod":                  envVariable.AGICPodName,
		"controller_appgw_subscription":   envVariable.SubscriptionID,
		"controller_appgw_resource_group": envVariable.ResourceGroupName,
		"controller_appgw_name":           envVariable.AppGwName,
		"controller_version":              fmt.Sprintf("%s/%s/%s", version.Version, version.GitCommit, version.BuildDate),
	}
	return &AGICMetricStore{
		constLabels: constLabels,
		updateLatency: prometheus.NewGauge(prometheus.GaugeOpts{
			Namespace:   PrometheusNamespace,
			ConstLabels: constLabels,
			Name:        "update_latency_seconds",
			Help:        "The time spent in updating Application Gateway",
		}),
		k8sAPIEventCounter: prometheus.NewCounter(prometheus.CounterOpts{
			Namespace:   PrometheusNamespace,
			ConstLabels: constLabels,
			Name:        "k8s_api_event_counter",
			Help:        "This counter represents the number of events received from k8s API Server",
		}),
		armAPICallCounter: prometheus.NewCounter(prometheus.CounterOpts{
			Namespace:   PrometheusNamespace,
			ConstLabels: constLabels,
			Name:        "arm_api_call_counter",
			Help:        "This counter represents the number of API calls to ARM",
		}),
		armAPIUpdateCallFailureCounter: prometheus.NewCounter(prometheus.CounterOpts{
			Namespace:   PrometheusNamespace,
			ConstLabels: constLabels,
			Name:        "arm_api_update_call_failure_counter",
			Help:        "This counter represents the number of update API calls that failed to update Application Gateway",
		}),
		armAPIUpdateCallSuccessCounter: prometheus.NewCounter(prometheus.CounterOpts{
			Namespace:   PrometheusNamespace,
			ConstLabels: constLabels,
			Name:        "arm_api_update_call_success_counter",
			Help:        "This counter represents the number of update API calls that successfully updated Application Gateway",
		}),
		errorCounterVec: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Namespace:   PrometheusNamespace,
				ConstLabels: constLabels,
				Name:        "error_counter",
				Help:        "This gauge changes represents an error on AGIC",
			},
			[]string{ErrorCode},
		),
		registry: prometheus.NewRegistry(),
	}
}