def submit_influxdb_measurement(self):
        """Submit a measurement for a message to InfluxDB"""
        measurement = influxdb.Measurement(*self.influxdb)
        measurement.set_timestamp(time.time())
        for key, value in self.measurement.counters.items():
            measurement.set_field(key, value)
        for key, value in self.measurement.tags.items():
            measurement.set_tag(key, value)
        for key, value in self.measurement.values.items():
            measurement.set_field(key, value)

        for key, values in self.measurement.durations.items():
            if len(values) == 1:
                measurement.set_field(key, values[0])
            elif len(values) > 1:
                measurement.set_field('{}-average'.format(key),
                                      sum(values) / len(values))
                measurement.set_field('{}-max'.format(key), max(values))
                measurement.set_field('{}-min'.format(key), min(values))
                measurement.set_field('{}-median'.format(key),
                                      utils.percentile(values, 50))
                measurement.set_field('{}-95th'.format(key),
                                      utils.percentile(values, 95))

        influxdb.add_measurement(measurement)
        LOGGER.debug('InfluxDB Measurement: %r', measurement.marshall())
def submit_influxdb_measurement ( self ) : measurement = influxdb . Measurement ( * self . influxdb ) measurement . set_timestamp ( time . time ( ) ) for key , value in self . measurement . counters . items ( ) : measurement . set_field ( key , value ) for key , value in self . measurement . tags . items ( ) : measurement . set_tag ( key , value ) for key , value in self . measurement . values . items ( ) : measurement . set_field ( key , value ) for key , values in self . measurement . durations . items ( ) : if len ( values ) == 1 : measurement . set_field ( key , values [ 0 ] ) elif len ( values ) > 1 : measurement . set_field ( '{}-average' . format ( key ) , sum ( values ) / len ( values ) ) measurement . set_field ( '{}-max' . format ( key ) , max ( values ) ) measurement . set_field ( '{}-min' . format ( key ) , min ( values ) ) measurement . set_field ( '{}-median' . format ( key ) , utils . percentile ( values , 50 ) ) measurement . set_field ( '{}-95th' . format ( key ) , utils . percentile ( values , 95 ) ) influxdb . add_measurement ( measurement ) LOGGER . debug ( 'InfluxDB Measurement: %r' , measurement . marshall ( ) )
Submit a measurement for a message to InfluxDB