(self)
return 0
Analyzes queries from a given log file
Analyzes queries from a given log file
Analyzes queries from a given log file
def analyze_profile(self):
        """Analyzes queries from a given log file"""
        profile_parser = ProfileParser()
        databases = self._get_requested_databases()
        connection = pymongo.MongoClient(self._db_uri,
                                         document_class=OrderedDict,
                                         read_preference=pymongo.ReadPreference.PRIMARY_PREFERRED)

        if databases == []:
            try:
                databases = connection.database_names()
            except:
                message = "Error: Could not list databases on server. Please " \
                          +         "check the auth components of your URI or provide " \
                          +         "a namespace filter with -n.\n"
                sys.stderr.write(message)
                databases = []

            for ignore_db in IGNORE_DBS:
                if ignore_db in databases:
                    databases.remove(ignore_db)

        for database in databases:

            db = connection[database]

            profile_entries = db['system.profile'].find()

            for profile_entry in profile_entries:
                self._process_query(profile_entry,
                                    profile_parser)

        self._output_aggregated_report(sys.stdout)

        return 0
def analyze_profile ( self ) : profile_parser = ProfileParser ( ) databases = self . _get_requested_databases ( ) connection = pymongo . MongoClient ( self . _db_uri , document_class = OrderedDict , read_preference = pymongo . ReadPreference . PRIMARY_PREFERRED ) if databases == [ ] : try : databases = connection . database_names ( ) except : message = "Error: Could not list databases on server. Please " + "check the auth components of your URI or provide " + "a namespace filter with -n.\n" sys . stderr . write ( message ) databases = [ ] for ignore_db in IGNORE_DBS : if ignore_db in databases : databases . remove ( ignore_db ) for database in databases : db = connection [ database ] profile_entries = db [ 'system.profile' ] . find ( ) for profile_entry in profile_entries : self . _process_query ( profile_entry , profile_parser ) self . _output_aggregated_report ( sys . stdout ) return 0