コード例 #1
0
ファイル: utils.py プロジェクト: nnestle/commcare-hq
def create_datadog_event(title, text, alert_type=ALERT_INFO, tags=None, aggregation_key=None):
    tags = COMMON_TAGS + (tags or [])
    if datadog_initialized():
        try:
            api.Event.create(title=title, text=text, tags=tags, alert_type=alert_type, aggregation_key=aggregation_key)
        except DatadogException:
            datadog_logger.exception("Error creating Datadog event")
    else:
        datadog_logger.debug("Datadog event: (%s) %s\n%s", alert_type, title, text)
コード例 #2
0
ファイル: utils.py プロジェクト: yonglehou/commcare-hq
        def _inner(*args, **kwargs):
            response = fn(*args, **kwargs)

            try:
                metric_name = '{}.{}'.format(metric_prefix, response.status_code)
                statsd.increment(metric_name)
            except Exception:
                datadog_logger.exception('Unable to record Datadog stats')

            return response
コード例 #3
0
        def _inner(*args, **kwargs):
            response = fn(*args, **kwargs)

            try:
                datadog_counter(metric_name, tags=[
                    'status_code:{}'.format(response.status_code)
                ])
            except Exception:
                datadog_logger.exception('Unable to record Datadog stats')

            return response
コード例 #4
0
        def _inner(*args, **kwargs):
            response = fn(*args, **kwargs)

            try:
                datadog_counter(
                    metric_name,
                    tags=['status_code:{}'.format(response.status_code)])
            except Exception:
                datadog_logger.exception('Unable to record Datadog stats')

            return response
コード例 #5
0
ファイル: utils.py プロジェクト: fmagege/commcare-hq
def create_datadog_event(title, text, alert_type=ALERT_INFO, tags=None, aggregation_key=None):
    tags = COMMON_TAGS + (tags or [])
    if datadog_initialized():
        try:
            api.Event.create(
                title=title, text=text, tags=tags,
                alert_type=alert_type, aggregation_key=aggregation_key,
            )
        except Exception as e:
            datadog_logger.exception('Error creating Datadog event', e)
    else:
        datadog_logger.debug('Datadog event: (%s) %s\n%s', alert_type, title, text)
コード例 #6
0
def _datadog_record(fn, name, value, enforce_prefix='commcare', tags=None):
    _enforce_prefix(name, enforce_prefix)
    try:
        fn(name, value, tags=tags)
    except Exception:
        datadog_logger.exception('Unable to record Datadog stats')
コード例 #7
0
def _datadog_record(fn, name, value, enforce_prefix='commcare', tags=None):
    _enforce_prefix(name, enforce_prefix)
    try:
        fn(name, value, tags=tags)
    except Exception:
        datadog_logger.exception('Unable to record Datadog stats')