コード例 #1
0
ファイル: database.py プロジェクト: jpyung/trytond
 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
コード例 #2
0
ファイル: database.py プロジェクト: coopengo/trytond
 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
コード例 #3
0
ファイル: database.py プロジェクト: coopengo/trytond
 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
コード例 #4
0
ファイル: database.py プロジェクト: jpyung/trytond
 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
コード例 #5
0
    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