#NEWLINE# def __init__( self , metrics , prefix ) : #NEWLINE# #INDENT# self . metrics = metrics #NEWLINE# self . group_name = ( '%s-fetch-manager-metrics' % prefix ) #NEWLINE# self . bytes_fetched = metrics . sensor ( 'bytes-fetched' ) #NEWLINE# self . bytes_fetched . add ( metrics . metric_name ( 'fetch-size-avg' , self . group_name , 'The average number of bytes fetched per request' ) , Avg ( ) ) #NEWLINE# self . bytes_fetched . add ( metrics . metric_name ( 'fetch-size-max' , self . group_name , 'The maximum number of bytes fetched per request' ) , Max ( ) ) #NEWLINE# self . bytes_fetched . add ( metrics . metric_name ( 'bytes-consumed-rate' , metrics . group_name , 'The average number of bytes consumed per second' ) , Rate ( ) ) #NEWLINE# self . records_fetched = self . metrics . sensor ( 'records-fetched' ) #NEWLINE# self . records_fetched . add ( metrics . metric_name ( 'records-per-request-avg' , self . group_name , 'The average number of records in each request' ) , Avg ( ) ) #NEWLINE# self . records_fetched . add ( metrics . metric_name ( 'records-consumed-rate' , self . group_name , 'The average number of records consumed per second' ) , Rate ( ) ) #NEWLINE# self . fetch_latency = metrics . sensor ( 'fetch-latency' ) #NEWLINE# self . fetch_latency . add ( metrics . metric_name ( 'fetch-latency-avg' , self . group_name , 'The average time taken for a fetch request.' ) , Avg ( ) ) #NEWLINE# self . fetch_latency . add ( metrics . metric_name ( 'fetch-latency-max' , self . group_name , 'The max time taken for any fetch request.' ) , Max ( ) ) #NEWLINE# self . fetch_latency . add ( metrics . metric_name ( 'fetch-rate' , self . group_name , 'The number of fetch requests per second.' ) , Rate ( sampled_stat = Count ( ) ) ) #NEWLINE# self . records_fetch_lag = metrics . sensor ( 'records-lag' ) #NEWLINE# self . records_fetch_lag . add ( metrics . metric_name ( 'records-lag-max' , self . group_name , 'The maximum lag in terms of number of records for any partition in self window' ) , Max ( ) ) #NEWLINE# self . fetch_throttle_time_sensor = metrics . sensor ( 'fetch-throttle-time' ) #NEWLINE# self . fetch_throttle_time_sensor . add ( metrics . metric_name ( 'fetch-throttle-time-avg' , self . group_name , 'The average throttle time in ms' ) , Avg ( ) ) #NEWLINE# self . fetch_throttle_time_sensor . add ( metrics . metric_name ( 'fetch-throttle-time-max' , self . group_name , 'The maximum throttle time in ms' ) , Max ( ) )