Fix METRIC_ENABLED to METRICS_ENABLED in fly component (#469)

This commit is contained in:
walker-16 2023-06-28 13:07:45 -03:00 committed by GitHub
parent 914580cfdc
commit 1ba76b5c85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 14 deletions

View File

@ -14,4 +14,4 @@ PPROF_ENABLED=false
MAX_HEALTH_TIME_SECONDS=90
AWS_IAM_ROLE=
ALERT_ENABLED=false
METRIC_ENABLED=false
METRICS_ENABLED=false

View File

@ -14,4 +14,4 @@ PPROF_ENABLED=true
MAX_HEALTH_TIME_SECONDS=90
AWS_IAM_ROLE=
ALERT_ENABLED=false
METRIC_ENABLED=false
METRICS_ENABLED=false

View File

@ -14,4 +14,4 @@ PPROF_ENABLED=false
MAX_HEALTH_TIME_SECONDS=300
AWS_IAM_ROLE=
ALERT_ENABLED=false
METRIC_ENABLED=false
METRICS_ENABLED=false

View File

@ -70,11 +70,11 @@ spec:
name: opsgenie
key: api-key
- name: ALERT_ENABLED
value: {{ .ALERT_ENABLED }}
value: "{{ .ALERT_ENABLED }}"
- name: ENVIRONMENT
value: {{ .ENVIRONMENT }}
- name: METRIC_ENABLED
value: {{ .METRIC_ENABLED }}
- name: METRICS_ENABLED
value: "{{ .METRICS_ENABLED }}"
resources:
limits:
memory: {{ .RESOURCES_LIMITS_MEMORY }}

View File

@ -106,12 +106,12 @@ func getAlertApiKey() string {
return os.Getenv("ALERT_API_KEY")
}
// GetMetricEnabled get if metric is enabled.
func GetMetricEnabled() bool {
strMetricEnabled := os.Getenv("METRIC_ENABLED")
metricEnabled, err := strconv.ParseBool(strMetricEnabled)
// GetMetricsEnabled get if metrics is enabled.
func GetMetricsEnabled() bool {
strMetricsEnabled := os.Getenv("METRICS_ENABLED")
metricsEnabled, err := strconv.ParseBool(strMetricsEnabled)
if err != nil {
metricEnabled = false
metricsEnabled = false
}
return metricEnabled
return metricsEnabled
}

View File

@ -196,8 +196,8 @@ func newAlertClient() (alert.AlertClient, error) {
}
func newMetrics(p2pNetwork *config.P2pNetworkConfig) metrics.Metrics {
metricEnabled := config.GetMetricEnabled()
if !metricEnabled {
metricsEnabled := config.GetMetricsEnabled()
if !metricsEnabled {
return metrics.NewDummyMetrics()
}
return metrics.NewPrometheusMetrics(p2pNetwork.Enviroment)