Merge pull request #2195 from EloiZalczer/master

Added alias parameter in query_counter
This commit is contained in:
Bastien Gérard
2019-12-04 21:50:41 +01:00
committed by GitHub
2 changed files with 40 additions and 2 deletions

View File

@@ -182,10 +182,10 @@ class query_counter(object):
- Some queries are ignored by default by the counter (killcursors, db.system.indexes)
"""
def __init__(self):
def __init__(self, alias=DEFAULT_CONNECTION_NAME):
"""Construct the query_counter
"""
self.db = get_db()
self.db = get_db(alias=alias)
self.initial_profiling_level = None
self._ctx_query_counter = 0 # number of queries issued by the context