From 1ba76b5c8584783ba114b8565b00983e9133e310 Mon Sep 17 00:00:00 2001 From: walker-16 Date: Wed, 28 Jun 2023 13:07:45 -0300 Subject: [PATCH] Fix METRIC_ENABLED to METRICS_ENABLED in fly component (#469) --- deploy/fly/env/production.env | 2 +- deploy/fly/env/staging.env | 2 +- deploy/fly/env/test.env | 2 +- deploy/fly/fly-service.yaml | 6 +++--- fly/config/config.go | 12 ++++++------ fly/main.go | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/deploy/fly/env/production.env b/deploy/fly/env/production.env index f788f331..cd8865eb 100644 --- a/deploy/fly/env/production.env +++ b/deploy/fly/env/production.env @@ -14,4 +14,4 @@ PPROF_ENABLED=false MAX_HEALTH_TIME_SECONDS=90 AWS_IAM_ROLE= ALERT_ENABLED=false -METRIC_ENABLED=false \ No newline at end of file +METRICS_ENABLED=false \ No newline at end of file diff --git a/deploy/fly/env/staging.env b/deploy/fly/env/staging.env index 21dafb4b..c7f8631b 100644 --- a/deploy/fly/env/staging.env +++ b/deploy/fly/env/staging.env @@ -14,4 +14,4 @@ PPROF_ENABLED=true MAX_HEALTH_TIME_SECONDS=90 AWS_IAM_ROLE= ALERT_ENABLED=false -METRIC_ENABLED=false \ No newline at end of file +METRICS_ENABLED=false \ No newline at end of file diff --git a/deploy/fly/env/test.env b/deploy/fly/env/test.env index 117e1a0f..14f44b2d 100644 --- a/deploy/fly/env/test.env +++ b/deploy/fly/env/test.env @@ -14,4 +14,4 @@ PPROF_ENABLED=false MAX_HEALTH_TIME_SECONDS=300 AWS_IAM_ROLE= ALERT_ENABLED=false -METRIC_ENABLED=false \ No newline at end of file +METRICS_ENABLED=false \ No newline at end of file diff --git a/deploy/fly/fly-service.yaml b/deploy/fly/fly-service.yaml index 04e446c1..4d5571db 100644 --- a/deploy/fly/fly-service.yaml +++ b/deploy/fly/fly-service.yaml @@ -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 }} diff --git a/fly/config/config.go b/fly/config/config.go index 9deb4718..cab2ecd8 100644 --- a/fly/config/config.go +++ b/fly/config/config.go @@ -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 } diff --git a/fly/main.go b/fly/main.go index 4bf70cd2..e0167f80 100644 --- a/fly/main.go +++ b/fly/main.go @@ -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)