src/dirbs/reports/stats_generator.py
def _log_perf_metric(statsd, metric_root, stat_name, duration, operator_id=None, record_counts_map=None):
    """Utility method used to store a StatsD performance metric for an operator ID, stat_name and duration."""
    triplet_count = -1
    stat_name_norm = stat_name.lower().replace(' ', '_')
    if operator_id == OperatorConfig.COUNTRY_OPERATOR_NAME or operator_id is None:
        metric_key = '{0}runtime.per_stat.country.{1}'.format(metric_root, stat_name_norm)
        if record_counts_map is not None:
            triplet_count = record_counts_map[OperatorConfig.COUNTRY_OPERATOR_NAME]
    else:
        metric_key = '{0}runtime.per_stat.operators.{1}.{2}'.format(metric_root, operator_id, stat_name_norm)
        if record_counts_map is not None:
            triplet_count = record_counts_map[operator_id]

    statsd.gauge('{0}.raw'.format(metric_key), duration)
    if triplet_count > 0:
        norm_factor = 1000000 / triplet_count
        statsd.gauge('{0}.normalized_triplets'.format(metric_key), norm_factor * duration)
Utility method used to store a StatsD performance metric for an operator ID, stat_name and duration.
Utility method used to store a StatsD performance metric for an operator ID, stat_name and duration.
Utility method used to store a StatsD performance metric for an operator ID stat_name and duration .
def _log_perf_metric(statsd, metric_root, stat_name, duration, operator_id=None, record_counts_map=None):
    triplet_count = -1
    stat_name_norm = stat_name.lower().replace(' ', '_')
    if operator_id == OperatorConfig.COUNTRY_OPERATOR_NAME or operator_id is None:
        metric_key = '{0}runtime.per_stat.country.{1}'.format(metric_root, stat_name_norm)
        if record_counts_map is not None:
            triplet_count = record_counts_map[OperatorConfig.COUNTRY_OPERATOR_NAME]
    else:
        metric_key = '{0}runtime.per_stat.operators.{1}.{2}'.format(metric_root, operator_id, stat_name_norm)
        if record_counts_map is not None:
            triplet_count = record_counts_map[operator_id]
    statsd.gauge('{0}.raw'.format(metric_key), duration)
    if triplet_count > 0:
        norm_factor = 1000000 / triplet_count
        statsd.gauge('{0}.normalized_triplets'.format(metric_key), norm_factor * duration)
def _log_perf_metric ( statsd , metric_root , stat_name , duration , operator_id = None , record_counts_map = None ) : triplet_count = - 1 stat_name_norm = stat_name . lower ( ) . replace ( ' ' , '_' ) if operator_id == OperatorConfig . COUNTRY_OPERATOR_NAME or operator_id is None : metric_key = '{0}runtime.per_stat.country.{1}' . format ( metric_root , stat_name_norm ) if record_counts_map is not None : triplet_count = record_counts_map [ OperatorConfig . COUNTRY_OPERATOR_NAME ] else : metric_key = '{0}runtime.per_stat.operators.{1}.{2}' . format ( metric_root , operator_id , stat_name_norm ) if record_counts_map is not None : triplet_count = record_counts_map [ operator_id ] statsd . gauge ( '{0}.raw' . format ( metric_key ) , duration ) if triplet_count > 0 : norm_factor = 1000000 / triplet_count statsd . gauge ( '{0}.normalized_triplets' . format ( metric_key ) , norm_factor * duration )
Utility method used to store a StatsD performance metric for an operator ID, stat_name and duration.
Utility method used to store a StatsD performance metric for an operator ID stat_name and duration .
"""Utility method used to store a StatsD performance metric for an operator ID, stat_name and duration."""
statsd
metric_root
stat_name
duration
operator_id
record_counts_map