Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend-V1] Deploy frontend V1 on staging and disable statsd push #3587

Merged
merged 3 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ services:
NODE_ENV: staging
ports:
- '80:80'
- "443:443"
volumes:
- /code/node_modules
- /code/bower_components
Expand All @@ -68,7 +69,6 @@ services:
NODE_ENV: staging
ports:
- "9999:80"
- "443:443"
volumes:
- /code/node_modules
logging:
Expand Down
43 changes: 22 additions & 21 deletions middleware/statsd/statsd_middleware.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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
4 changes: 3 additions & 1 deletion monitoring/statsd/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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