Parse dsn param to get key for pg stats.

This commit is contained in:
Logan Hanks
2012-12-17 13:00:28 -08:00
parent 46070df795
commit c053d82883

View File

@@ -322,7 +322,9 @@ class Stats:
def pg_after_cursor_execute(self, conn, cursor, statement, parameters,
context, executemany):
self.pg_event(context.engine.url.host, context.engine.url.database,
dsn = dict(part.split('=', 1)
for part in context.engine.url.query['dsn'].split())
self.pg_event(dsn['host'], dsn['dbname'],
time.time() - context._query_start_time)
def pg_event(self, db_server, db_name, service_time):