#NEWLINE# def add( self , key , metric ) : #NEWLINE# #INDENT# "\n        Use this method to manually add custom metric instances to the registry\n        which are not created with their constructor's default arguments,\n        e.g. Histograms with a different size.\n        \n        :param key: name of the metric\n        :type key: C{str}\n        :param metric: instance of Histogram, Meter, Gauge, Timer or Counter\n        " #NEWLINE# class_map = { #NEWLINE# #INDENT# Histogram : self . _histograms , #NEWLINE# Meter : self . _meters , #NEWLINE# Gauge : self . gauges , #NEWLINE# Timer : self . _timers , #NEWLINE# Counter : self . _counters , #NEWLINE# #UNINDENT# } #NEWLINE# for ( cls , registry ) in class_map . iteritems ( ) : #NEWLINE# #INDENT# if isinstance ( cls , cls ) : #NEWLINE# #INDENT# if ( key in registry ) : #NEWLINE# #INDENT# raise LookupError ( ( 'Metric %r already registered' % key ) ) #NEWLINE# #UNINDENT# registry [ key ] = registry #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# raise TypeError ( ( 'Invalid class. Could not register metric %r' % key ) )