def callproc(self, procname, vars=None): try: context = analyze_before(self) except: perf_logger.exception('analyse_before failed') context = None ret = super(PerfCursor, self).callproc(procname, vars) if context is not None: try: analyze_after(*context) except: perf_logger.exception('analyse_after failed') return ret
def execute(self, query, vars=None): try: context = analyze_before(self) except: perf_logger.exception('analyse_before failed') context = None ret = super(PerfCursor, self).execute(query, vars) if context is not None: try: analyze_after(*context) except: perf_logger.exception('analyse_after failed') return ret
def execute(self, query, vars=None): if logger.isEnabledFor(logging.DEBUG): logger.debug(self.mogrify(query, vars)) try: context = analyze_before(self) except: perf_logger.exception('analyse_before failed') context = None ret = super(PerfCursor, self).execute(query, vars) if context is not None: try: analyze_after(*context) except: perf_logger.exception('analyse_after failed') return ret
def execute(self, query, vars=None): if logger.isEnabledFor(logging.DEBUG): logger.debug(self.mogrify(query, vars)) try: context = analyze_before(self) except Exception: perf_logger.exception('analyse_before failed') context = None # JCA: Log slow queries if _slow_logging_enabled: start = time.time() ret = super(PerfCursor, self).execute(query, vars) if _slow_logging_enabled: end = time.time() if end - start > _slow_threshold: logger.warning('slow:(%s s):%s' % (end - start, self.mogrify(query, vars))) if context is not None: try: analyze_after(*context) except Exception: perf_logger.exception('analyse_after failed') return ret