Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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")
async def test():
with async_tracer.start_active_span('test'):
asyncio.ensure_future(run_later("Hello"))
await asyncio.sleep(0.5)
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)
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")
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")
async def stan_request_start(session, trace_config_ctx, params):
try:
parent_span = async_tracer.active_span
# If we're not tracing, just return
if parent_span is None:
trace_config_ctx.scope = None
return
scope = async_tracer.start_active_span("aiohttp-client", child_of=parent_span)
trace_config_ctx.scope = scope
async_tracer.inject(scope.span.context, opentracing.Format.HTTP_HEADERS, params.headers)
parts = str(params.url).split('?')
if len(parts) > 1:
cleaned_qp = strip_secrets(parts[1], agent.secrets_matcher, agent.secrets_list)
scope.span.set_tag("http.params", cleaned_qp)
scope.span.set_tag("http.url", parts[0])
scope.span.set_tag('http.method', params.method)
except Exception:
logger.debug("stan_request_start", exc_info=True)
def publish_with_instana(wrapped, instance, argv, kwargs):
parent_span = async_tracer.active_span
# If we're not tracing, just return
if parent_span is None:
return wrapped(*argv, **kwargs)
with async_tracer.start_active_span("rabbitmq", child_of=parent_span) as scope:
host, port = instance.sender.protocol.transport._sock.getsockname()
msg = argv[0]
if msg.headers is None:
msg.headers = {}
async_tracer.inject(scope.span.context, opentracing.Format.TEXT_MAP, msg.headers)
try:
scope.span.set_tag("exchange", instance.name)
scope.span.set_tag("sort", "publish")
scope.span.set_tag("address", host + ":" + str(port) )
if 'routing_key' in kwargs:
scope.span.set_tag("key", kwargs['routing_key'])
elif len(argv) > 1 and argv[1] is not None:
scope.span.set_tag("key", argv[1])