#NEWLINE# def _create_metric( self , data , tags = None ) : #NEWLINE# #INDENT# overall_stats = data . get ( 'stats' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for ( key , stats ) in overall_stats . items ( ) : #NEWLINE# #INDENT# for ( metric , val ) in stats . items ( ) : #NEWLINE# #INDENT# if ( val [ 'current' ] is not None ) : #NEWLINE# #INDENT# metric_name = '.' . join ( [ 'couchdb' , key , metric ] ) #NEWLINE# self . gauge ( metric_name , val [ 'current' ] , tags = tags ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for ( db_name , db_stats ) in data . get ( 'databases' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . items ( ) : #NEWLINE# #INDENT# for ( name , val ) in db_stats . items ( ) : #NEWLINE# #INDENT# if ( ( name in [ 'doc_count' , 'disk_size' ] ) and ( val is not None ) ) : #NEWLINE# #INDENT# metric_name = '.' . join ( [ 'couchdb' , 'by_db' , name ] ) #NEWLINE# metric_tags = list ( tags ) #NEWLINE# metric_tags . append ( ( 'db:%s' % db_name ) ) #NEWLINE# self . gauge ( metric_name , val , tags = metric_tags , device_name = db_name )