fix references to gds

This commit is contained in:
Kenneth Kehl
2023-08-17 09:01:53 -07:00
parent e4a37c84ca
commit 1765dba476
9 changed files with 15 additions and 104 deletions

View File

@@ -2,7 +2,6 @@ import uuid
from datetime import datetime
from flask import current_app
from gds_metrics import Histogram
from notifications_utils.clients import redis
from notifications_utils.recipients import (
format_email_address,
@@ -30,11 +29,6 @@ from app.models import (
)
from app.v2.errors import BadRequestError
REDIS_GET_AND_INCR_DAILY_LIMIT_DURATION_SECONDS = Histogram(
'redis_get_and_incr_daily_limit_duration_seconds',
'Time taken to get and possibly incremement the daily limit cache key',
)
def create_content_for_notification(template, personalisation):
if template.template_type == EMAIL_TYPE:

View File

@@ -1,5 +1,4 @@
from flask import Blueprint, current_app, json, jsonify, request
from gds_metrics.metrics import Counter
from notifications_utils.recipients import try_validate_and_format_phone_number
from app.celery import tasks
@@ -14,13 +13,6 @@ receive_notifications_blueprint = Blueprint('receive_notifications', __name__)
register_errors(receive_notifications_blueprint)
INBOUND_SMS_COUNTER = Counter(
'inbound_sms',
'Total number of inbound SMS received',
['provider']
)
@receive_notifications_blueprint.route('/notifications/sms/receive/sns', methods=['POST'])
def receive_sns_sms():
"""
@@ -64,8 +56,6 @@ def receive_sns_sms():
result="success", message="SMS-SNS callback succeeded"
), 200
INBOUND_SMS_COUNTER.labels("sns").inc()
content = message.get("messageBody")
from_number = message.get('originationNumber')
provider_ref = message.get('inboundMessageId')

View File

@@ -1,5 +1,4 @@
from flask import current_app
from gds_metrics.metrics import Histogram
from notifications_utils import SMS_CHAR_COUNT_LIMIT
from notifications_utils.clients.redis import (
daily_total_cache_key,
@@ -31,21 +30,15 @@ from app.service.utils import service_allowed_to_send_to
from app.utils import get_public_notify_type_text
from app.v2.errors import BadRequestError, RateLimitError, TotalRequestsError
REDIS_EXCEEDED_RATE_LIMIT_DURATION_SECONDS = Histogram(
'redis_exceeded_rate_limit_duration_seconds',
'Time taken to check rate limit',
)
def check_service_over_api_rate_limit(service, api_key):
if current_app.config['API_RATE_LIMIT_ENABLED'] and current_app.config['REDIS_ENABLED']:
cache_key = rate_limit_cache_key(service.id, api_key.key_type)
rate_limit = service.rate_limit
interval = 60
with REDIS_EXCEEDED_RATE_LIMIT_DURATION_SECONDS.time():
if redis_store.exceeded_rate_limit(cache_key, rate_limit, interval):
current_app.logger.info("service {} has been rate limited for throughput".format(service.id))
raise RateLimitError(rate_limit, interval, api_key.key_type)
if redis_store.exceeded_rate_limit(cache_key, rate_limit, interval):
current_app.logger.info("service {} has been rate limited for throughput".format(service.id))
raise RateLimitError(rate_limit, interval, api_key.key_type)
def check_application_over_retention_limit(key_type, service):