def create_metric_set(name=None, metrics=None, email_recipients=None,
        no_email=False, send_daily=True, send_weekly=False,
        send_monthly=False):
    """ Create a metric set """

    # This should be a NOOP for the non-database-backed backends
    if not should_create_models():
        return

    try:
        metric_set = MetricSet(
                            name=name,
                            no_email=no_email,
                            send_daily=send_daily,
                            send_weekly=send_weekly,
                            send_monthly=send_monthly)
        metric_set.save()

        for m in metrics:
            metric_set.metrics.add(m)

        for e in email_recipients:
            metric_set.email_recipients.add(e)

    except:
        return False

    return metric_set
Esempio n. 2
0
def create_metric_set(name=None,
                      metrics=None,
                      email_recipients=None,
                      no_email=False,
                      send_daily=True,
                      send_weekly=False,
                      send_monthly=False):
    """ Create a metric set """

    # This should be a NOOP for the non-database-backed backends
    if not should_create_models():
        return

    try:
        metric_set = MetricSet(name=name,
                               no_email=no_email,
                               send_daily=send_daily,
                               send_weekly=send_weekly,
                               send_monthly=send_monthly)
        metric_set.save()

        for m in metrics:
            metric_set.metrics.add(m)

        for e in email_recipients:
            metric_set.email_recipients.add(e)

    except:
        return False

    return metric_set
Esempio n. 3
0
def create_metric_set(name=None, metrics=None, email_recipients=None,
                      no_email=False, send_daily=True, send_weekly=False,
                      send_monthly=False): 
    """ Create a metric set """ 

    # This should be a NOOP for the mixpanel backend 
    backend = get_backend()
    if backend == 'app_metrics.backends.mixpanel': 
        return 

    try: 
        metric_set = MetricSet(
                            name=name, 
                            no_email=no_email, 
                            send_daily=send_daily,
                            send_weekly=send_weekly,
                            send_monthly=send_monthly)
        metric_set.save()

        for m in metrics: 
            metric_set.metrics.add(m)

        for e in email_recipients: 
            metric_set.email_recipients.add(e)

    except: 
        return False 

    return metric_set 
Esempio n. 4
0
def create_metric_set(name=None,
                      metrics=None,
                      email_recipients=None,
                      no_email=False,
                      send_daily=True,
                      send_weekly=False,
                      send_monthly=False):
    """ Create a metric set """

    # This should be a NOOP for the mixpanel backend
    backend = get_backend()
    if backend == 'app_metrics.backends.mixpanel':
        return

    try:
        metric_set = MetricSet(name=name,
                               no_email=no_email,
                               send_daily=send_daily,
                               send_weekly=send_weekly,
                               send_monthly=send_monthly)
        metric_set.save()

        for m in metrics:
            metric_set.metrics.add(m)

        for e in email_recipients:
            metric_set.email_recipients.add(e)

    except:
        return False

    return metric_set
Esempio n. 5
0
def create_metric_set(name=None, metrics=None, email_recipients=None, no_email=False, send_daily=True, send_weekly=False, send_monthly=False): 
    """ Create a metric set """ 
    try: 
        metric_set = MetricSet(
                            name=name, 
                            no_email=no_email, 
                            send_daily=send_daily,
                            send_weekly=send_weekly,
                            send_monthly=send_monthly)
        metric_set.save()

        for m in metrics: 
            metric_set.metrics.add(m)

        for e in email_recipients: 
            metric_set.email_recipients.add(e)

    except: 
        return False 

    return metric_set