How to use instana - 10 common examples

To help you get started, we’ve selected a few instana examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instana / python-sensor / tests / clients / test_asynqp.py View on Github external
def test():
            with async_tracer.start_active_span('test'):
                msg1 = asynqp.Message({'consume': 'this'})
                self.exchange.publish(msg1, 'routing.key')

                self.consumer = yield from self.queue.consume(handle_message)
                yield from asyncio.sleep(0.5)
github instana / python-sensor / tests / frameworks / test_tornado_server.py View on Github external
async def test():
            with async_tracer.start_active_span('test'):
                async with aiohttp.ClientSession() as session:
                    return await self.fetch(session, testenv["tornado_server"] + "/301")
github instana / python-sensor / tests / frameworks / test_asyncio.py View on Github external
async def test():
            with async_tracer.start_active_span('test'):
                asyncio.ensure_future(run_later("Hello"))
            await asyncio.sleep(0.5)
github instana / python-sensor / tests / frameworks / test_aiohttp.py View on Github external
async def test():
            with async_tracer.start_active_span('test'):
                async with aiohttp.ClientSession() as session:
                    # Hack together a manual custom headers list
                    agent.extra_headers = [u'X-Capture-This', u'X-Capture-That']

                    headers = dict()
                    headers['X-Capture-This'] = 'this'
                    headers['X-Capture-That'] = 'that'

                    return await self.fetch(session, testenv["aiohttp_server"] + "/?secret=iloveyou", headers=headers)
github instana / python-sensor / tests / frameworks / test_aiohttp.py View on Github external
async def test():
            with async_tracer.start_active_span('test'):
                async with aiohttp.ClientSession() as session:
                    return await self.fetch(session, testenv["wsgi_server"] + "/?secret=yeah")
github instana / python-sensor / tests / frameworks / test_aiohttp.py View on Github external
async def test():
            with async_tracer.start_active_span('test'):
                async with aiohttp.ClientSession() as session:
                    return await self.fetch(session, testenv["wsgi_server"] + "/504")
github instana / python-sensor / tests / frameworks / test_aiohttp.py View on Github external
def test_client_response_header_capture(self):
        original_extra_headers = agent.extra_headers
        agent.extra_headers = ['X-Capture-This']

        async def test():
            with async_tracer.start_active_span('test'):
                async with aiohttp.ClientSession() as session:
                    return await self.fetch(session, testenv["wsgi_server"] + "/response_headers")

        response = self.loop.run_until_complete(test())

        spans = self.recorder.queued_spans()
        self.assertEqual(3, len(spans))

        wsgi_span = spans[0]
        aiohttp_span = spans[1]
        test_span = spans[2]
github instana / python-sensor / tests / frameworks / test_aiohttp.py View on Github external
def test_client_response_header_capture(self):
        original_extra_headers = agent.extra_headers
        agent.extra_headers = ['X-Capture-This']

        async def test():
            with async_tracer.start_active_span('test'):
                async with aiohttp.ClientSession() as session:
                    return await self.fetch(session, testenv["wsgi_server"] + "/response_headers")

        response = self.loop.run_until_complete(test())

        spans = self.recorder.queued_spans()
        self.assertEqual(3, len(spans))

        wsgi_span = spans[0]
        aiohttp_span = spans[1]
        test_span = spans[2]

        self.assertIsNone(async_tracer.active_span)
github instana / python-sensor / tests / clients / test_sqlalchemy.py View on Github external
def test_session_add(self):
        with tracer.start_active_span('test'):
            self.session.add(stan_user)
            self.session.commit()

        spans = self.recorder.queued_spans()
        self.assertEqual(2, len(spans))

        sql_span = spans[0]
        test_span = spans[1]

        self.assertIsNone(tracer.active_span)

        # Same traceId
        self.assertEqual(test_span.t, sql_span.t)

        # Parent relationships
        self.assertEqual(sql_span.p, test_span.s)

        # Error logging
        self.assertIsNone(test_span.ec)
        self.assertIsNone(sql_span.ec)

        # SQLAlchemy span
        self.assertEqual('sqlalchemy', sql_span.n)
        self.assertFalse('custom' in sql_span.data)
        self.assertTrue('sqlalchemy' in sql_span.data)
github instana / python-sensor / tests / clients / test_asynqp.py View on Github external
def test():
            with async_tracer.start_active_span('test'):
                msg = asynqp.Message({'hello': 'world'}, content_type='application/json')
                self.exchange.publish(msg, 'routing.key')