statsd counters for callback statuses

also for the 'code' param from firetext
This commit is contained in:
Leo Hemsted
2016-06-02 15:53:04 +01:00
parent af89f86389
commit d41048f4aa
3 changed files with 40 additions and 19 deletions

View File

@@ -39,6 +39,8 @@ def process_sms_client_response(status, reference, client_name):
except KeyError:
return success, 'unknown sms client: {}'.format(client_name)
statsd_client.incr('notifications.callback.{}.status.{}'.format(client_name.lower(), status))
# validate status
try:
response_dict = response_parser(status)

View File

@@ -1,5 +1,4 @@
from datetime import datetime
import statsd
import itertools
from flask import (
Blueprint,
@@ -177,6 +176,8 @@ def process_firetext_response():
current_app.logger.info(validation_errors)
return jsonify(result='error', message=validation_errors), 400
statsd_client.incr('notifications.callback.firetext.code.{}'.format(request.form.get('code')))
success, errors = process_sms_client_response(status=request.form.get('status'),
reference=request.form.get('reference'),
client_name=client_name)