mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-17 18:44:11 -05:00
Add GDS metrics package to admin app
Follows the code from the API
This commit is contained in:
@@ -24,6 +24,7 @@ from flask.globals import _lookup_req_object, _request_ctx_stack
|
|||||||
from flask_login import LoginManager, current_user
|
from flask_login import LoginManager, current_user
|
||||||
from flask_wtf import CSRFProtect
|
from flask_wtf import CSRFProtect
|
||||||
from flask_wtf.csrf import CSRFError
|
from flask_wtf.csrf import CSRFError
|
||||||
|
from gds_metrics import GDSMetrics
|
||||||
from govuk_frontend_jinja.flask_ext import init_govuk_frontend
|
from govuk_frontend_jinja.flask_ext import init_govuk_frontend
|
||||||
from itsdangerous import BadSignature
|
from itsdangerous import BadSignature
|
||||||
from notifications_python_client.errors import HTTPError
|
from notifications_python_client.errors import HTTPError
|
||||||
@@ -94,6 +95,7 @@ from app.utils import format_thousands, get_logo_cdn_domain, id_safe
|
|||||||
|
|
||||||
login_manager = LoginManager()
|
login_manager = LoginManager()
|
||||||
csrf = CSRFProtect()
|
csrf = CSRFProtect()
|
||||||
|
metrics = GDSMetrics()
|
||||||
|
|
||||||
|
|
||||||
# The current service attached to the request stack.
|
# The current service attached to the request stack.
|
||||||
@@ -132,6 +134,7 @@ def create_app(application):
|
|||||||
# Gubbins
|
# Gubbins
|
||||||
csrf,
|
csrf,
|
||||||
login_manager,
|
login_manager,
|
||||||
|
metrics,
|
||||||
proxy_fix,
|
proxy_fix,
|
||||||
request_helper,
|
request_helper,
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Navigation:
|
|||||||
def endpoints_without_navigation(self):
|
def endpoints_without_navigation(self):
|
||||||
return tuple(
|
return tuple(
|
||||||
self._get_endpoint_with_blueprint(endpoint) for endpoint in self.exclude
|
self._get_endpoint_with_blueprint(endpoint) for endpoint in self.exclude
|
||||||
) + ('static', 'status.show_status')
|
) + ('static', 'status.show_status', 'metrics')
|
||||||
|
|
||||||
def is_selected(self, navigation_item):
|
def is_selected(self, navigation_item):
|
||||||
if request.endpoint in self.mapping[navigation_item]:
|
if request.endpoint in self.mapping[navigation_item]:
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import traceback
|
|||||||
|
|
||||||
import gunicorn
|
import gunicorn
|
||||||
|
|
||||||
|
from gds_metrics.gunicorn import child_exit # noqa
|
||||||
|
|
||||||
workers = 5
|
workers = 5
|
||||||
worker_class = "eventlet"
|
worker_class = "eventlet"
|
||||||
errorlog = "/home/vcap/logs/gunicorn_error.log"
|
errorlog = "/home/vcap/logs/gunicorn_error.log"
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ applications:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
- logit-ssl-syslog-drain
|
- logit-ssl-syslog-drain
|
||||||
|
- notify-prometheus
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NOTIFY_APP_NAME: admin
|
NOTIFY_APP_NAME: admin
|
||||||
|
|||||||
@@ -25,3 +25,7 @@ itsdangerous==1.1.0
|
|||||||
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@39.7.0#egg=notifications-utils==39.7.0
|
git+https://github.com/alphagov/notifications-utils.git@39.7.0#egg=notifications-utils==39.7.0
|
||||||
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
||||||
|
|
||||||
|
# gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains
|
||||||
|
prometheus-client==0.8.0
|
||||||
|
gds-metrics==0.2.0
|
||||||
|
|||||||
@@ -28,11 +28,15 @@ itsdangerous==1.1.0
|
|||||||
git+https://github.com/alphagov/notifications-utils.git@39.7.0#egg=notifications-utils==39.7.0
|
git+https://github.com/alphagov/notifications-utils.git@39.7.0#egg=notifications-utils==39.7.0
|
||||||
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
||||||
|
|
||||||
|
# gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains
|
||||||
|
prometheus-client==0.8.0
|
||||||
|
gds-metrics==0.2.0
|
||||||
|
|
||||||
## The following requirements were added by pip freeze:
|
## The following requirements were added by pip freeze:
|
||||||
awscli==1.18.84
|
awscli==1.18.90
|
||||||
bleach==3.1.4
|
bleach==3.1.4
|
||||||
boto3==1.10.38
|
boto3==1.10.38
|
||||||
botocore==1.17.7
|
botocore==1.17.13
|
||||||
cachetools==4.1.0
|
cachetools==4.1.0
|
||||||
certifi==2020.6.20
|
certifi==2020.6.20
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
@@ -45,7 +49,7 @@ et-xmlfile==1.0.1
|
|||||||
flask-redis==0.4.0
|
flask-redis==0.4.0
|
||||||
future==0.18.2
|
future==0.18.2
|
||||||
greenlet==0.4.16
|
greenlet==0.4.16
|
||||||
idna==2.9
|
idna==2.10
|
||||||
jdcal==1.4.1
|
jdcal==1.4.1
|
||||||
Jinja2==2.11.2
|
Jinja2==2.11.2
|
||||||
jmespath==0.10.0
|
jmespath==0.10.0
|
||||||
@@ -54,7 +58,7 @@ lxml==4.5.1
|
|||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
mistune==0.8.4
|
mistune==0.8.4
|
||||||
monotonic==1.5
|
monotonic==1.5
|
||||||
openpyxl==3.0.3
|
openpyxl==3.0.4
|
||||||
orderedset==2.0.1
|
orderedset==2.0.1
|
||||||
phonenumbers==8.11.2
|
phonenumbers==8.11.2
|
||||||
pyasn1==0.4.8
|
pyasn1==0.4.8
|
||||||
|
|||||||
Reference in New Issue
Block a user