Beispiel #1
0
    def test_context_fn_isolation(self):
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind = engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key = True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)

        sqltap.start(self.engine, lambda *args: 1)
        sqltap.start(engine2, lambda *args: 2)

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(B).all()

        stats = sqltap.collect()

        ctxs = [qstats.user_context for qstats in _startswith(stats, 'SELECT')]
        assert ctxs.count(1) == 1
        assert ctxs.count(2) == 1
Beispiel #2
0
    def test_engine_global(self):
        """ Test that registering globally for all queries correctly pulls queries
            from multiple engines.
        
            This test passes, but because SQLAlchemy won't ever let us unregister
            our event handlers, this causes side-effects in other tests that will
            break them.
        """
        return
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind = engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key = True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)
        sqltap.start()

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(B).all()

        stats = _startswith(sqltap.collect(), 'SELECT')
        assert len(stats) == 2
Beispiel #3
0
    def test_engine_scoped(self):
        """
        Test that calling sqltap.start with a particular engine instance
        properly captures queries only to that engine.
        """
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind = engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key = True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)
        sqltap.start(engine2)

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(B).all()

        stats = _startswith(sqltap.collect(), 'SELECT')
        assert len(stats) == 1
Beispiel #4
0
    def test_stop(self):
        """ Ensure queries after you call sqltap.stop() are not recorded. """
        sqltap.start(self.engine)
        sess = self.Session()
        sess.query(self.A).all()
        sqltap.stop(self.engine)
        sess.query(self.A).all()

        assert len(sqltap.collect()) == 1
Beispiel #5
0
    def test_select(self):
        """ Simple test that sqltap collects a select query. """
        sqltap.start(self.engine)

        sess = self.Session()
        sess.query(self.A).all()

        stats = sqltap.collect()
        assert len(_startswith(stats, 'SELECT')) == 1
Beispiel #6
0
    def test_insert(self):
        """ Simple test that sqltap collects an insert query. """
        sqltap.start(self.engine)

        sess = self.Session()
        sess.add(self.A())
        sess.flush()

        stats = sqltap.collect()
        assert len(_startswith(stats, 'INSERT')) == 1
Beispiel #7
0
    def test_context_fn(self):
        sqltap.start(self.engine, lambda *args: 1)

        sess = self.Session()
        q = sess.query(self.A)
        q.all()
        stats = sqltap.collect()

        ctxs = [qstats.user_context for qstats in _startswith(stats, 'SELECT')]
        assert ctxs[0] == 1
Beispiel #8
0
    def test_start_twice(self):
        """ Ensure that if multiple calls to sqltap.start on the same
            engine do not cause us to record more than one event per query.
        """
        sqltap.start(self.engine)
        sqltap.start(self.engine)

        sess = self.Session()
        sess.query(self.A).all()

        stats = _startswith(sqltap.collect(), 'SELECT')
        assert len(stats) == 1
Beispiel #9
0
    def test_report(self):
        sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)
        qtext = str(q)
        q.all()


        report = sqltap.report(sqltap.collect())
        assert 'SQLTap Report' in report
        assert qtext in report
Beispiel #10
0
    def test_stop_global(self):
        """ Ensure queries after you call sqltap.stop() are not recorded when passing
            in the 'global' Engine object to record queries across all engines.
        
            This test passes, but because SQLAlchemy won't ever let us unregister
            our event handlers, this causes side-effects in other tests and will.
        """
        return
        sqltap.start()
        sess = self.Session()
        sess.query(self.A).all()
        sqltap.stop()
        sess.query(self.A).all()

        assert len(sqltap.collect()) == 1
Beispiel #11
0
        def f():
            engine2 = create_engine('sqlite:///:memory:', echo=True)

            Base = declarative_base(bind = engine2)

            class B(Base):
                __tablename__ = "b"
                id = Column("id", Integer, primary_key = True)

            Base.metadata.create_all(engine2)
            Session = sessionmaker(bind=engine2)
            sqltap.start(engine2)

            sqltap.start(self.engine)
            sess2 = Session()
            sess2.query(B).all()
Beispiel #12
0
    def test_collect_fn_execption_on_collect(self):
        def noop():
            pass

        profiler = sqltap.start(self.engine, collect_fn=noop)
        profiler.collect()
        profiler.stop()
Beispiel #13
0
    def test_engine_scoped(self):
        """
        Test that calling sqltap.start with a particular engine instance
        properly captures queries only to that engine.
        """
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind = engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key = True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)
        profiler = sqltap.start(engine2)

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(B).all()

        stats = _startswith(profiler.collect(), 'SELECT')
        assert len(stats) == 1
Beispiel #14
0
	def wrapper(*args, **kwargs):
		if not request.query.do_log:
			return callback(*args, **kwargs)

		import os

		fname = 'logs/{}.html'.format(request.path
			.replace('/', '.')
			.replace('<', '')
			.replace('>', '')
			.lstrip('.')
		)
		try:
			os.remove(fname)
		except:
			pass

		import sqltap

		profiler = sqltap.start()

		try:
			return callback(*args, **kwargs)
		finally:
			try:
				statistics = profiler.collect()
				profiler.stop()
				sqltap.report(statistics, fname)
			except Exception:
				raise
Beispiel #15
0
    def test_engine_global(self):
        """
        Test that registering globally for all queries correctly pulls queries
        from multiple engines.
        """
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind=engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key=True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)
        profiler = sqltap.start()

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(B).all()

        stats = _startswith(profiler.collect(), 'SELECT')
        assert len(stats) == 2
        profiler.stop()
    def test_report_aggregation_w_different_param_sets(self):
        """
        Test that report rendering works with groups of queries
        containing different parameter sets
        """

        sess = self.Session()

        a1 = self.A(name=uuid.uuid4().hex, description='')
        a2 = self.A(name=uuid.uuid4().hex, description='')
        sess.add_all([a1, a2])
        sess.commit()

        a1 = sess.query(self.A).get(a1.id)
        a2 = sess.query(self.A).get(a2.id)

        profiler = sqltap.start(self.engine)
        # this will create queries with the same text, but different param sets
        # (different query.params.keys() collections)
        a1.name = uuid.uuid4().hex
        a2.description = uuid.uuid4().hex
        sess.flush()

        report = sqltap.report(profiler.collect())
        print(report)
        profiler.stop()
        self.check_report(report)
Beispiel #17
0
    def test_engine_global(self):
        """
        Test that registering globally for all queries correctly pulls queries
        from multiple engines.
        """
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind=engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key=True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)
        profiler = sqltap.start()

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(B).all()

        stats = _startswith(profiler.collect(), 'SELECT')
        assert len(stats) == 2
        profiler.stop()
def test_it_loads_one_author(client, app):
    query = """
    query getAuthor($id: Int!){
        author(id: $id){
            id
            firstName
            books
            {
                id
                isbn
                readers {
                    id
                }
            }
        }
    }
    """
    with app.app_context():
        author = Author.create(first_name="test1", last_name="test2")
        book = Book.create(title="test", isbn="r123213", author=author)
        reader = Reader.create(first_name="test", last_name="test2")
        reader.books.append(book)
        reader.save()
        profiler = sqltap.start()
        result = schema.execute(query, variable_values={'id': author.id}).data
        statistics = profiler.collect()
        assert len(statistics) == 2
        assert result['author']['firstName'] == author.first_name
        assert result['author']['books'][0]['isbn'] == book.isbn
def test_it_loads_books(client, app):
    query = """
    {
        books{
            id
            title
            author {
                id
                firstName
            }
            readers {
                id
            }
        }
    }
    """
    with app.app_context():
        author = Author.create(first_name="test1", last_name="test2")
        book = Book.create(title="test", isbn="r123213", author=author)
        book2 = Book.create(title="test2", isbn="r12321312", author=author)

        reader = Reader.create(first_name="test", last_name="test2")
        reader.books.append(book)
        reader.save()
        profiler = sqltap.start()
        result = schema.execute(query)
        statistics = profiler.collect()
        assert result.data['books'][0]['title'] == book.title
        assert result.data['books'][0]['author']['firstName'] == author.first_name
        assert result.data['books'][1]['title'] == book2.title
        assert result.data['books'][1]['author']['firstName'] == author.first_name
        assert len(statistics) == 1
Beispiel #20
0
    def test_collect_fn_execption_on_collect(self):
        def noop():
            pass

        profiler = sqltap.start(self.engine, collect_fn=noop)
        profiler.collect()
        profiler.stop()
Beispiel #21
0
    def test_report_aggregation_w_different_param_sets(self):
        """
        Test that report rendering works with groups of queries
        containing different parameter sets
        """

        sess = self.Session()

        a1 = self.A(name=uuid.uuid4().hex, description="")
        a2 = self.A(name=uuid.uuid4().hex, description="")
        sess.add_all([a1, a2])
        sess.commit()

        a1 = sess.query(self.A).get(a1.id)
        a2 = sess.query(self.A).get(a2.id)

        profiler = sqltap.start(self.engine)
        # this will create queries with the same text, but different param sets
        # (different query.params.keys() collections)
        a1.name = uuid.uuid4().hex
        a2.description = uuid.uuid4().hex
        sess.flush()

        report = sqltap.report(profiler.collect())
        print(report)
        profiler.stop()
        self.check_report(report)
Beispiel #22
0
	def wrapper(*args, **kwargs):
		if not request.query.do_log:
			return callback(*args, **kwargs)

		import os

		fname = 'logs/{}.html'.format(request.path
			.replace('/', '.')
			.replace('<', '')
			.replace('>', '')
			.lstrip('.')
		)
		try:
			os.remove(fname)
		except:
			pass

		import sqltap

		profiler = sqltap.start()

		try:
			return callback(*args, **kwargs)
		finally:
			try:
				statistics = profiler.collect()
				profiler.stop()
				sqltap.report(statistics, fname)
			except Exception:
				raise
Beispiel #23
0
    def test_select(self):
        """ Simple test that sqltap collects a select query. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sess.query(self.A).all()

        stats = profiler.collect()
        assert len(_startswith(stats, 'SELECT')) == 1
Beispiel #24
0
    def test_stop(self):
        """ Ensure queries after you call ProfilingSession.stop() are not recorded. """
        profiler = sqltap.start(self.engine)
        sess = self.Session()
        sess.query(self.A).all()
        profiler.stop()
        sess.query(self.A).all()

        assert len(profiler.collect()) == 1
Beispiel #25
0
    def test_select(self):
        """ Simple test that sqltap collects a select query. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sess.query(self.A).all()

        stats = profiler.collect()
        assert len(_startswith(stats, "SELECT")) == 1
        profiler.stop()
Beispiel #26
0
    def test_context_fn(self):
        profiler = sqltap.start(self.engine, lambda *args: 1)

        sess = self.Session()
        q = sess.query(self.A)
        q.all()
        stats = profiler.collect()

        ctxs = [qstats.user_context for qstats in _startswith(stats, 'SELECT')]
        assert ctxs[0] == 1
Beispiel #27
0
    def test_insert(self):
        """ Simple test that sqltap collects an insert query. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sess.add(self.A())
        sess.flush()

        stats = profiler.collect()
        assert len(_startswith(stats, 'INSERT')) == 1
Beispiel #28
0
    def test_insert(self):
        """ Simple test that sqltap collects an insert query. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sess.add(self.A())
        sess.flush()

        stats = profiler.collect()
        assert len(_startswith(stats, "INSERT")) == 1
        profiler.stop()
Beispiel #29
0
 def decorated_get(*args, **kwargs):
     if 'tuning' in kwargs and kwargs['tuning']:
         if not current_app.config['DEBUG']:
             abort(403, message="`DEBUG` must be on for tuning page")
         profiler = sqltap.start()
         result = f(*args, **kwargs)
         profiler.stop()
         stats = profiler.collect()
         return make_response(sqltap.report(stats, 'tuning.html'))
     result = f(*args, **kwargs)
     return result
Beispiel #30
0
    def test_report(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)
        qtext = str(q)
        q.all()

        report = sqltap.report(profiler.collect())
        assert 'sqltap profile report' in report
        assert qtext in report
Beispiel #31
0
    def test_stop_global(self):
        """ Ensure queries after you call ProfilingSession.stop() are not recorded
            when passing in the 'global' Engine object to record queries across all engines.
        """
        profiler = sqltap.start()
        sess = self.Session()
        sess.query(self.A).all()
        profiler.stop()
        sess.query(self.A).all()

        assert len(profiler.collect()) == 1
Beispiel #32
0
    def test_report_aggregation(self):
        """
        Test that we aggregate stats for the same query called from
        different locations as well as aggregating queries called
        from the same stack trace.
        """
        sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)

        q.all()
        q.all()
            
        q2 = sess.query(self.A).filter(self.A.id == 10)
        for i in xrange(10):
            q2.all()

        report = sqltap.report(sqltap.collect())
        assert '2 unique' in report
        assert 'Query count: 10' in report
Beispiel #33
0
    def test_report_to_file(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A).filter(self.A.name == u"معاذ")
        q.all()
        stats = profiler.collect()

        fd, temp_path = tempfile.mkstemp()
        os.close(fd)
        report = sqltap.report(stats, filename=temp_path)

        with open(temp_path) as fp:
            self.assertEqual(report, fp.read())
Beispiel #34
0
    def test_report_to_file(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A).filter(self.A.name == u"معاذ")
        q.all()
        stats = profiler.collect()

        fd, temp_path = tempfile.mkstemp()
        os.close(fd)
        report = sqltap.report(stats, filename=temp_path)

        with open(temp_path) as fp:
            self.assertEqual(report, fp.read())
Beispiel #35
0
    def test_collect_fn(self):
        collection = []
        def my_collector(q):
            collection.append(q)

        sess = self.Session()
        profiler = sqltap.start(self.engine, collect_fn=my_collector)
        sess.query(self.A).all()

        assert len(collection) == 1

        sess.query(self.A).all()

        assert len(collection) == 2
Beispiel #36
0
    def test_report_raw_sql(self):
        """ Ensure that reporting works when raw SQL queries were emitted. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sql = 'SELECT * FROM %s' % self.A.__tablename__
        sess.connection().execute(sql)

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert sqltap.format_sql(sql) in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(sql, reindent=True) in report
        profiler.stop()
Beispiel #37
0
    def test_report_raw_sql(self):
        """ Ensure that reporting works when raw SQL queries were emitted. """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        sql = 'SELECT * FROM %s' % self.A.__tablename__
        sess.connection().execute(sql)

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert sqltap.format_sql(sql) in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(sql, reindent=True) in report
        profiler.stop()
Beispiel #38
0
    def test_report(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)
        qtext = sqltap.format_sql(str(q))
        q.all()

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert qtext in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(qtext, reindent=True) in report
        profiler.stop()
Beispiel #39
0
    def test_report(self):
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)
        qtext = sqltap.format_sql(str(q))
        q.all()

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        assert qtext in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        assert sqlparse.format(qtext, reindent=True) in report
        profiler.stop()
Beispiel #40
0
    def test_report_ddl(self):
        """ Ensure that reporting works when DDL were emitted """
        engine2 = create_engine('sqlite:///:memory:', echo=True)
        Base2 = declarative_base(bind=engine2)

        class B(Base2):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key=True)

        profiler = sqltap.start(engine2)
        Base2.metadata.create_all(engine2)

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        profiler.stop()
Beispiel #41
0
    def test_report_ddl(self):
        """ Ensure that reporting works when DDL were emitted """
        engine2 = create_engine('sqlite:///:memory:', echo=True)
        Base2 = declarative_base(bind=engine2)

        class B(Base2):
            __tablename__ = "b"
            id = Column("id", Integer, primary_key=True)

        profiler = sqltap.start(engine2)
        Base2.metadata.create_all(engine2)

        stats = profiler.collect()
        report = sqltap.report(stats, report_format="html")
        assert REPORT_TITLE in report
        report = sqltap.report(stats, report_format="text")
        assert REPORT_TITLE in report
        profiler.stop()
Beispiel #42
0
    def test_context_fn_isolation(self):
        x = { "i": 0 }
        def context_fn(*args):
            x['i'] += 1
            return x['i']

        profiler = sqltap.start(self.engine, context_fn)

        sess = self.Session()
        sess.query(self.A).all()

        sess2 = Session()
        sess2.query(self.A).all()

        stats = profiler.collect()

        ctxs = [qstats.user_context for qstats in _startswith(stats, 'SELECT')]
        assert ctxs.count(1) == 1
        assert ctxs.count(2) == 1
Beispiel #43
0
    def test_report_escaped(self):
        """ Test that . """
        engine2 = create_engine('sqlite:///:memory:', echo=True)

        Base = declarative_base(bind = engine2)

        class B(Base):
            __tablename__ = "b"
            id = Column("id", Unicode, primary_key = True)

        Base.metadata.create_all(engine2)
        Session = sessionmaker(bind=engine2)
        profiler = sqltap.start(engine2)

        sess = Session()
        sess.query(B).filter(B.id == u"<blockquote class='test'>").all()

        report = sqltap.report(profiler.collect())
        assert "<blockquote class='test'>" not in report
        assert "&#34;&lt;blockquote class=&#39;test&#39;&gt;&#34;" in report
Beispiel #44
0
    def test_report_aggregation(self):
        """
        Test that we aggregate stats for the same query called from
        different locations as well as aggregating queries called
        from the same stack trace.
        """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)

        q.all()
        q.all()
            
        q2 = sess.query(self.A).filter(self.A.id == 10)
        for i in range(10):
            q2.all()

        report = sqltap.report(profiler.collect())
        print(report)
        assert '2 unique' in report
        assert '<dd>10</dd>' in report
Beispiel #45
0
    def test_report_aggregation(self):
        """
        Test that we aggregate stats for the same query called from
        different locations as well as aggregating queries called
        from the same stack trace.
        """
        profiler = sqltap.start(self.engine)

        sess = self.Session()
        q = sess.query(self.A)

        q.all()
        q.all()

        q2 = sess.query(self.A).filter(self.A.id == 10)
        for i in range(10):
            q2.all()

        report = sqltap.report(profiler.collect())
        print(report)
        assert '2 unique' in report
        assert '<dd>10</dd>' in report
        profiler.stop()
Beispiel #46
0
    try:
        import sqltap
    except:
        app.logger.error(
            'Cannot import sqltap. Install it with pip to use profiling!')
        raise

    def context_fn(*args):
        import uuid
        try:
            return g.req_id
        except AttributeError:
            g.req_id = uuid.uuid4().hex
            return g.req_id

    sqltap_sess = sqltap.start(user_context_fn=context_fn)


# -- main menu handing (context processor) --
@app.context_processor
def _myapp_contextproc_menu():
    """
	Context processor for the main menu

	Adds the main menu data into the template context. Menu items are sorted by sort-order, then (case-insensitively) by label.
	"""
    return dict(
        menu=sorted(app._myapp_menudata,
                    key=lambda mi: (mi['sortorder'], mi['label'].lower())))

Beispiel #47
0
 def session(self):
     if self.dbsession is None:
         self.dbsession = self.application.Session()
         if SQLTAP:
             sqltap.start(self.application.engine)
     return self.dbsession
Beispiel #48
0
async def add_sql_tap(request: Request, call_next):
    profiler = sqltap.start()
    response = await call_next(request)
    statistics = profiler.collect()
    sqltap.report(statistics, "report.txt", report_format="text")
    return response
Beispiel #49
0
 def test_collect_empty(self):
     profiler = sqltap.start(self.engine)
     assert len(profiler.collect()) == 0
Beispiel #50
0
 def before_request(self):
     if request.path not in os.environ.get('SQLTAP_EXCLUDE'):
         self.processing = True
         self.profiler = tap.start()
     else:
         self.processing = False
Beispiel #51
0
import os
import sys

from webcheck.cmd import parser, main

if __name__ == '__main__':
    try:
        args = parser.parse_args()
        if args.profile:
            fname = os.path.join(args.output_dir, 'webcheck.prof')
            try:
                import cProfile
            except ImportError:
                import profile as cProfile
            try:
                import sqltap
                sqltap.start()
            except ImportError:
                pass
            cProfile.run('main(vars(args))', fname)
            if 'sqltap' in locals():
                statistics = sqltap.collect()
                sqltap.report(statistics,
                              os.path.join(args.output_dir, 'sqltap.html'))
        else:
            main(vars(args))
    except KeyboardInterrupt:
        sys.stderr.write('Interrupted\n')
        sys.exit(1)
Beispiel #52
0
 def before_request(self):
     if request.path not in conf.SQLTAP_EXCLUDE:
         self.processing = True
         self.profiler = tap.start()
     else:
         self.processing = False