Fixed and pushed

From: Sharad Gandhi <notifications@github.com<mailto:notifications@github.com>>
Reply-To: linkedin/naarad <reply@reply.github.com<mailto:reply@reply.github.com>>
Date: Tuesday, April 8, 2014 at 2:00 PM
To: linkedin/naarad <naarad@noreply.github.com<mailto:naarad@noreply.github.com>>
Cc: Shaoshan Liu <shliu@linkedin.com<mailto:shliu@linkedin.com>>
Subject: Re: [naarad] Add capability to grade the diff of different metrics (#182)


In src/naarad/utils.py:

> -          if not sla.check_sla_passed(metric.calculated_stats[sub_metric][stat_name]):
> -            logger.info("Failed SLA for " + sub_metric)
> -            ret += 1
> -            metric.status = CONSTANTS.SLA_FAILED
> +  for metric_label in metric.sla_map.keys():
> +    for sub_metric in metric.sla_map[metric_label].keys():
> +      for stat_name in metric.sla_map[metric_label][sub_metric].keys():
> +        sla = metric.sla_map[metric_label][sub_metric][stat_name]
> +        if stat_name[0] == 'p' and hasattr(metric, 'calculated_percentiles'):
> +          if sub_metric in metric.calculated_percentiles.keys():
> +            percentile_num = int(stat_name[1:])
> +            if isinstance(percentile_num, float) or isinstance(percentile_num, int):
> +              if percentile_num in metric.calculated_percentiles[sub_metric].keys():
> +                if not sla.check_sla_passed(metric.calculated_percentiles[sub_metric][percentile_num]):
> +                  logger.info("Failed SLA for " + sub_metric)
> +                  ret += 1


This can be deleted and we can use metric.status everywhere to track status

—
Reply to this email directly or view it on GitHub<https://github.com/linkedin/naarad/pull/182/files#r11411429>.