logger.critical('error: UnicodeDecodeError')

    except Exception as ex:
        logger.critical('exception: %s: %s', ex, traceback.format_exc())

        # Should we write this exception-causing email to disk?
        if settings.EXCEPTION_DIR and email_string:
            dump_to_exception_file('Exception caught: %s\n%s\n\n%s' % (ex,
                                                                       traceback.format_exc(),
                                                                       email_string))
    else:
        try:
            processing_time = time.time()-starttime

            logger.critical('success: %s: %fs', requested_addr, processing_time)
            logger_json.critical('{"timestamp": "%s", "event_name": "success", "requested_address": "%s"}' % (datetime.datetime.utcnow().isoformat() + "Z", requested_addr))

            aws_helpers.put_cloudwatch_metric_data(settings.CLOUDWATCH_PROCESSING_TIME_METRIC_NAME,
                                                   processing_time,
                                                   'Milliseconds',
                                                   settings.CLOUDWATCH_NAMESPACE)

            aws_helpers.put_cloudwatch_metric_data(settings.CLOUDWATCH_TOTAL_SENT_METRIC_NAME,
                                                   1,
                                                   'Count',
                                                   settings.CLOUDWATCH_NAMESPACE)

            aws_helpers.put_cloudwatch_metric_data(requested_addr,
                                                   1,
                                                   'Count',
                                                   settings.CLOUDWATCH_NAMESPACE)
Beispiel #2
0
    except Exception as ex:
        logger.critical('exception: %s: %s', ex, traceback.format_exc())

        # Should we write this exception-causing email to disk?
        if settings.EXCEPTION_DIR and email_string:
            dump_to_exception_file('Exception caught: %s\n%s\n\n%s' %
                                   (ex, traceback.format_exc(), email_string))
    else:
        try:
            processing_time = time.time() - starttime

            logger.critical('success: %s: %fs', requested_addr,
                            processing_time)
            logger_json.critical(
                '{"event_name": "success", "requested_address": "%s"}' %
                requested_addr)

            aws_helpers.put_cloudwatch_metric_data(
                settings.CLOUDWATCH_PROCESSING_TIME_METRIC_NAME,
                processing_time, 'Milliseconds', settings.CLOUDWATCH_NAMESPACE)

            aws_helpers.put_cloudwatch_metric_data(
                settings.CLOUDWATCH_TOTAL_SENT_METRIC_NAME, 1, 'Count',
                settings.CLOUDWATCH_NAMESPACE)

            aws_helpers.put_cloudwatch_metric_data(
                requested_addr, 1, 'Count', settings.CLOUDWATCH_NAMESPACE)
        except Exception as ex:
            logger.critical('exception: %s: %s', ex, traceback.format_exc())
Beispiel #3
0
        logger.critical('error: UnicodeDecodeError')

    except Exception as ex:
        logger.critical('exception: %s: %s', ex, traceback.format_exc())

        # Should we write this exception-causing email to disk?
        if settings.EXCEPTION_DIR and email_string:
            dump_to_exception_file('Exception caught: %s\n%s\n\n%s' % (ex,
                                                                       traceback.format_exc(),
                                                                       email_string))
    else:
        try:
            processing_time = time.time()-starttime

            logger.critical('success: %s: %fs', requested_addr, processing_time)
            logger_json.critical('{"event_name": "success", "requested_address": "%s"}' % requested_addr)

            aws_helpers.put_cloudwatch_metric_data(settings.CLOUDWATCH_PROCESSING_TIME_METRIC_NAME,
                                                   processing_time,
                                                   'Milliseconds',
                                                   settings.CLOUDWATCH_NAMESPACE)

            aws_helpers.put_cloudwatch_metric_data(settings.CLOUDWATCH_TOTAL_SENT_METRIC_NAME,
                                                   1,
                                                   'Count',
                                                   settings.CLOUDWATCH_NAMESPACE)

            aws_helpers.put_cloudwatch_metric_data(requested_addr,
                                                   1,
                                                   'Count',
                                                   settings.CLOUDWATCH_NAMESPACE)