This commit is contained in:
David McDonald
2020-06-12 14:52:04 +01:00
parent 15ce9fe3f9
commit 8b4a424df1
4 changed files with 9 additions and 27 deletions

View File

@@ -68,6 +68,11 @@ clients = Clients()
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
authenticated_service = LocalProxy(lambda: _request_ctx_stack.top.authenticated_service)
CONCURRENT_REQUESTS = Gauge(
'concurrent_web_request_count',
'How many concurrent requests are currently being served',
)
def create_app(application):
from app.config import configs
@@ -263,11 +268,6 @@ def register_v2_blueprints(application):
def init_app(app):
CONCURRENT_REQUESTS = Gauge(
'concurrent_web_request_count',
'How many concurrent requests are currently being served',
)
@app.before_request
def record_user_agent():
statsd_client.incr("user-agent.{}".format(process_user_agent(request.headers.get('User-Agent', None))))
@@ -334,7 +334,7 @@ def setup_sqlalchemy_events(app):
TOTAL_DB_CONNECTIONS = Gauge(
'db_connection_total_connected',
'How many db connections are currently held (potentially idel) by the server',
'How many db connections are currently held (potentially idle) by the server',
)
TOTAL_CHECKED_OUT_DB_CONNECTIONS = Gauge(
@@ -381,7 +381,6 @@ def setup_sqlalchemy_events(app):
}
# celery apps
elif current_task:
print(current_task)
connection_record.info['request_data'] = {
'method': 'celery',
'host': current_app.config['NOTIFY_APP_NAME'], # worker name

View File

@@ -7,7 +7,7 @@ from gds_metrics.gunicorn import child_exit # noqa
workers = 4
worker_class = "eventlet"
worker_connections = 30
worker_connections = 256
errorlog = "/home/vcap/logs/gunicorn_error.log"
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
statsd_host = "{}:8125".format(os.getenv("STATSD_HOST"))

View File

@@ -25,23 +25,6 @@
},
},
'notify-api-loadtesting': {
'comments': 'DELETE ME LATER',
'NOTIFY_APP_NAME': 'api',
'disk_quota': '2G',
'sqlalchemy_pool_size': 30,
'routes': {
'staging': [],
},
'health-check-type': 'port',
'health-check-invocation-timeout': 3,
'instances': {
'preview': None,
'staging': 4,
'production': None
},
},
'notify-delivery-celery-beat': {'memory': '128M'},
'notify-delivery-worker-jobs': {},
'notify-delivery-worker-research': {},
@@ -87,7 +70,7 @@ applications:
services:
- notify-db
- logit-ssl-syslog-drain
{% if CF_APP in ('notify-api', 'notify-api-loadtesting') %}
{% if CF_APP == 'notify-api' %}
- notify-prometheus
{% endif %}

View File

@@ -3,7 +3,7 @@ from flask import url_for
from sqlalchemy.exc import DataError
@pytest.fixture(scope='session')
@pytest.fixture(scope='function')
def app_for_test():
import flask
from flask import Blueprint