Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test():
with tornado_tracer.start_active_span('test'):
try:
return await self.http_client.fetch(testenv["tornado_server"] + "/405")
except tornado.httpclient.HTTPClientError as e:
return e.response
async def test():
with tornado_tracer.start_active_span('test'):
try:
return await self.http_client.fetch(testenv["tornado_server"] + "/504")
except tornado.httpclient.HTTPClientError as e:
return e.response
async def test():
with tornado_tracer.start_active_span('test'):
return await self.http_client.fetch(testenv["tornado_server"] + "/", method="POST", body='asdf')
async def test():
with tornado_tracer.start_active_span('test'):
return await self.http_client.fetch(testenv["tornado_server"] + "/")
async def test():
with tornado_tracer.start_active_span('test'):
return await self.http_client.fetch(testenv["tornado_server"] + "/301")
async def test():
with tornado_tracer.start_active_span('test'):
return await self.http_client.fetch(testenv["tornado_server"] + "/?secret=yeah")
request = argv[0]
# To modify request headers, we have to preemptively create an HTTPRequest object if a
# URL string was passed.
if not isinstance(request, tornado.httpclient.HTTPRequest):
request = tornado.httpclient.HTTPRequest(url=request, **kwargs)
new_kwargs = {}
for param in ('callback', 'raise_error'):
# if not in instead and pop
if param in kwargs:
new_kwargs[param] = kwargs.pop(param)
kwargs = new_kwargs
scope = tornado_tracer.start_active_span('tornado-client', child_of=parent_span)
tornado_tracer.inject(scope.span.context, opentracing.Format.HTTP_HEADERS, request.headers)
# Query param scrubbing
parts = request.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", request.method)
future = wrapped(request, **kwargs)
if future is not None:
cb = functools.partial(finish_tracing, scope=scope)
future.add_done_callback(cb)
def execute_with_instana(wrapped, instance, argv, kwargs):
try:
with tracer_stack_context():
ctx = tornado_tracer.extract(opentracing.Format.HTTP_HEADERS, instance.request.headers)
scope = tornado_tracer.start_active_span('tornado-server', child_of=ctx)
# Query param scrubbing
if instance.request.query is not None and len(instance.request.query) > 0:
cleaned_qp = strip_secrets(instance.request.query, agent.secrets_matcher, agent.secrets_list)
scope.span.set_tag("http.params", cleaned_qp)
url = "%s://%s%s" % (instance.request.protocol, instance.request.host, instance.request.path)
scope.span.set_tag("http.url", url)
scope.span.set_tag("http.method", instance.request.method)
scope.span.set_tag("handler", instance.__class__.__name__)
# Custom header tracking support
if hasattr(agent, 'extra_headers') and agent.extra_headers is not None:
for custom_header in agent.extra_headers:
if custom_header in instance.request.headers: