mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Merge pull request #1606 from alphagov/rc_remove_statsd_decorators
Removed the performance testing statsd calls
This commit is contained in:
@@ -28,7 +28,6 @@ from app.dao.notifications_dao import (
|
||||
dao_created_scheduled_notification
|
||||
)
|
||||
|
||||
from app.statsd_decorators import statsd
|
||||
from app.v2.errors import BadRequestError
|
||||
from app.utils import get_template_instance, cache_key_for_service_template_counter, convert_bst_to_utc
|
||||
|
||||
@@ -46,7 +45,6 @@ def check_placeholders(template_object):
|
||||
raise BadRequestError(fields=[{'template': message}], message=message)
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def persist_notification(
|
||||
*,
|
||||
template_id,
|
||||
@@ -116,7 +114,6 @@ def persist_notification(
|
||||
return notification
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def send_notification_to_queue(notification, research_mode, queue=None):
|
||||
if research_mode or notification.key_type == KEY_TYPE_TEST:
|
||||
queue = QueueNames.RESEARCH_MODE
|
||||
|
||||
@@ -14,7 +14,6 @@ from app.models import (
|
||||
KEY_TYPE_TEST, KEY_TYPE_TEAM, SCHEDULE_NOTIFICATIONS
|
||||
)
|
||||
from app.service.utils import service_allowed_to_send_to
|
||||
from app.statsd_decorators import statsd
|
||||
from app.v2.errors import TooManyRequestsError, BadRequestError, RateLimitError
|
||||
from app import redis_store
|
||||
from app.notifications.process_notifications import create_content_for_notification
|
||||
@@ -48,7 +47,6 @@ def check_service_over_daily_message_limit(key_type, service):
|
||||
raise TooManyRequestsError(service.message_limit)
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def check_rate_limiting(service, api_key):
|
||||
check_service_over_api_rate_limit(service, api_key)
|
||||
check_service_over_daily_message_limit(api_key.key_type, service)
|
||||
@@ -83,14 +81,12 @@ def service_has_permission(notify_type, permissions):
|
||||
return notify_type in [p.permission for p in permissions]
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def check_service_has_permission(notify_type, permissions):
|
||||
if not service_has_permission(notify_type, permissions):
|
||||
raise BadRequestError(message="Cannot send {}".format(
|
||||
get_public_notify_type_text(notify_type, plural=True)))
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def check_service_can_schedule_notification(permissions, scheduled_for):
|
||||
if scheduled_for:
|
||||
if not service_has_permission(SCHEDULE_NOTIFICATIONS, permissions):
|
||||
@@ -125,7 +121,6 @@ def check_sms_content_char_count(content_count):
|
||||
raise BadRequestError(message=message)
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def validate_template(template_id, personalisation, service, notification_type):
|
||||
try:
|
||||
template = templates_dao.dao_get_template_by_id_and_service_id(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from app.statsd_decorators import statsd
|
||||
|
||||
|
||||
def create_post_sms_response_from_notification(notification, content, from_number, url_root, scheduled_for):
|
||||
@@ -10,7 +9,6 @@ def create_post_sms_response_from_notification(notification, content, from_numbe
|
||||
return noti
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def create_post_email_response_from_notification(notification, content, subject, email_from, url_root, scheduled_for):
|
||||
noti = __create_notification_response(notification, url_root, scheduled_for)
|
||||
noti['content'] = {
|
||||
|
||||
@@ -37,7 +37,6 @@ from app.notifications.validators import (
|
||||
check_service_sms_sender_id
|
||||
)
|
||||
from app.schema_validation import validate
|
||||
from app.statsd_decorators import statsd
|
||||
from app.v2.errors import BadRequestError
|
||||
from app.v2.notifications import v2_notification_blueprint
|
||||
from app.v2.notifications.notification_schemas import (
|
||||
@@ -53,7 +52,6 @@ from app.v2.notifications.create_response import (
|
||||
|
||||
|
||||
@v2_notification_blueprint.route('/<notification_type>', methods=['POST'])
|
||||
@statsd(namespace="performance-testing")
|
||||
def post_notification(notification_type):
|
||||
if notification_type == EMAIL_TYPE:
|
||||
form = validate(request.get_json(), post_email_request)
|
||||
@@ -124,7 +122,6 @@ def post_notification(notification_type):
|
||||
return jsonify(resp), 201
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def process_sms_or_email_notification(*, form, notification_type, api_key, template, service, reply_to_text=None):
|
||||
form_send_to = form['email_address'] if notification_type == EMAIL_TYPE else form['phone_number']
|
||||
|
||||
@@ -199,7 +196,6 @@ def process_letter_notification(*, letter_data, api_key, template, reply_to_text
|
||||
return notification
|
||||
|
||||
|
||||
@statsd(namespace="performance-testing")
|
||||
def get_reply_to_text(notification_type, form, template):
|
||||
reply_to = None
|
||||
if notification_type == EMAIL_TYPE:
|
||||
|
||||
Reference in New Issue
Block a user