From 505cdf155fae33227941482846386ff225f6b9e8 Mon Sep 17 00:00:00 2001 From: Ram Ramrakhya Date: Tue, 31 Aug 2021 12:07:55 -0400 Subject: [PATCH] Deployment: Deploy frontend V1 on staging and disable statsd push for monitoring setup(#3587) * Deploy frontend V1 on staging and disable statsd push * Flake8 fixes Co-authored-by: Rishabh Jain --- docker-compose-staging.yml | 2 +- middleware/statsd/statsd_middleware.py | 43 +++++++++++++------------- monitoring/statsd/metrics.py | 4 ++- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/docker-compose-staging.yml b/docker-compose-staging.yml index d2ec2112aa..f7dccfa0d1 100644 --- a/docker-compose-staging.yml +++ b/docker-compose-staging.yml @@ -49,6 +49,7 @@ services: NODE_ENV: staging ports: - '80:80' + - "443:443" volumes: - /code/node_modules - /code/bower_components @@ -68,7 +69,6 @@ services: NODE_ENV: staging ports: - "9999:80" - - "443:443" volumes: - /code/node_modules logging: diff --git a/middleware/statsd/statsd_middleware.py b/middleware/statsd/statsd_middleware.py index c1c4c89f8c..901696b99a 100644 --- a/middleware/statsd/statsd_middleware.py +++ b/middleware/statsd/statsd_middleware.py @@ -1,7 +1,7 @@ import time from django.utils.deprecation import MiddlewareMixin -from monitoring.statsd.metrics import statsd, REQUEST_COUNT_METRIC_NAME, REQUEST_LATENCY_METRIC_NAME +# from monitoring.statsd.metrics import statsd, REQUEST_COUNT_METRIC_NAME, REQUEST_LATENCY_METRIC_NAME class StatsdMetricsMiddleware(MiddlewareMixin): @@ -17,25 +17,26 @@ def get_view_name(self, request): return view_name def process_response(self, request, response): - statsd.increment( - REQUEST_COUNT_METRIC_NAME, - tags=[ - "service:django_worker", - "method:%s" % request.method, - "view:%s" % self.get_view_name(request), - "status:%s" % str(response.status_code), - ], - ) - - resp_time = (time.time() - request.start_time) * 1000 - - statsd.histogram( - REQUEST_LATENCY_METRIC_NAME, - resp_time, - tags=[ - "service:django_worker", - "view:%s" % self.get_view_name(request), - ], - ) + # TODO: Enable statsd metric push once production docker setup is ready + # statsd.increment( + # REQUEST_COUNT_METRIC_NAME, + # tags=[ + # "service:django_worker", + # "method:%s" % request.method, + # "view:%s" % self.get_view_name(request), + # "status:%s" % str(response.status_code), + # ], + # ) + + # resp_time = (time.time() - request.start_time) * 1000 + + # statsd.histogram( + # REQUEST_LATENCY_METRIC_NAME, + # resp_time, + # tags=[ + # "service:django_worker", + # "view:%s" % self.get_view_name(request), + # ], + # ) return response diff --git a/monitoring/statsd/metrics.py b/monitoring/statsd/metrics.py index 61de7d3d9a..f46c5b9dd1 100644 --- a/monitoring/statsd/metrics.py +++ b/monitoring/statsd/metrics.py @@ -14,4 +14,6 @@ def increment_statsd_counter(metric_name, tags, inc_value): - statsd.increment(metric_name, inc_value, tags=tags) + # TODO: Enable statsd metric increment once production docker setup is ready + # statsd.increment(metric_name, inc_value, tags=tags) + return