mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 00:41:35 -05:00
Tidy up
This commit is contained in:
@@ -68,6 +68,11 @@ clients = Clients()
|
|||||||
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
|
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
|
||||||
authenticated_service = LocalProxy(lambda: _request_ctx_stack.top.authenticated_service)
|
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):
|
def create_app(application):
|
||||||
from app.config import configs
|
from app.config import configs
|
||||||
@@ -263,11 +268,6 @@ def register_v2_blueprints(application):
|
|||||||
|
|
||||||
def init_app(app):
|
def init_app(app):
|
||||||
|
|
||||||
CONCURRENT_REQUESTS = Gauge(
|
|
||||||
'concurrent_web_request_count',
|
|
||||||
'How many concurrent requests are currently being served',
|
|
||||||
)
|
|
||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def record_user_agent():
|
def record_user_agent():
|
||||||
statsd_client.incr("user-agent.{}".format(process_user_agent(request.headers.get('User-Agent', None))))
|
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(
|
TOTAL_DB_CONNECTIONS = Gauge(
|
||||||
'db_connection_total_connected',
|
'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(
|
TOTAL_CHECKED_OUT_DB_CONNECTIONS = Gauge(
|
||||||
@@ -381,7 +381,6 @@ def setup_sqlalchemy_events(app):
|
|||||||
}
|
}
|
||||||
# celery apps
|
# celery apps
|
||||||
elif current_task:
|
elif current_task:
|
||||||
print(current_task)
|
|
||||||
connection_record.info['request_data'] = {
|
connection_record.info['request_data'] = {
|
||||||
'method': 'celery',
|
'method': 'celery',
|
||||||
'host': current_app.config['NOTIFY_APP_NAME'], # worker name
|
'host': current_app.config['NOTIFY_APP_NAME'], # worker name
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from gds_metrics.gunicorn import child_exit # noqa
|
|||||||
|
|
||||||
workers = 4
|
workers = 4
|
||||||
worker_class = "eventlet"
|
worker_class = "eventlet"
|
||||||
worker_connections = 30
|
worker_connections = 256
|
||||||
errorlog = "/home/vcap/logs/gunicorn_error.log"
|
errorlog = "/home/vcap/logs/gunicorn_error.log"
|
||||||
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
|
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
|
||||||
statsd_host = "{}:8125".format(os.getenv("STATSD_HOST"))
|
statsd_host = "{}:8125".format(os.getenv("STATSD_HOST"))
|
||||||
|
|||||||
@@ -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-celery-beat': {'memory': '128M'},
|
||||||
'notify-delivery-worker-jobs': {},
|
'notify-delivery-worker-jobs': {},
|
||||||
'notify-delivery-worker-research': {},
|
'notify-delivery-worker-research': {},
|
||||||
@@ -87,7 +70,7 @@ applications:
|
|||||||
services:
|
services:
|
||||||
- notify-db
|
- notify-db
|
||||||
- logit-ssl-syslog-drain
|
- logit-ssl-syslog-drain
|
||||||
{% if CF_APP in ('notify-api', 'notify-api-loadtesting') %}
|
{% if CF_APP == 'notify-api' %}
|
||||||
- notify-prometheus
|
- notify-prometheus
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from flask import url_for
|
|||||||
from sqlalchemy.exc import DataError
|
from sqlalchemy.exc import DataError
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='function')
|
||||||
def app_for_test():
|
def app_for_test():
|
||||||
import flask
|
import flask
|
||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
|
|||||||
Reference in New Issue
Block a user