How to use the instana.singletons.tornado_tracer.start_active_span function in instana

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 / frameworks / test_tornado_client.py View on Github external
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
github instana / python-sensor / tests / frameworks / test_tornado_client.py View on Github external
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
github instana / python-sensor / tests / frameworks / test_tornado_client.py View on Github external
async def test():
            with tornado_tracer.start_active_span('test'):
                return await self.http_client.fetch(testenv["tornado_server"] + "/", method="POST", body='asdf')
github instana / python-sensor / tests / frameworks / test_tornado_client.py View on Github external
async def test():
            with tornado_tracer.start_active_span('test'):
                return await self.http_client.fetch(testenv["tornado_server"] + "/")
github instana / python-sensor / tests / frameworks / test_tornado_client.py View on Github external
async def test():
            with tornado_tracer.start_active_span('test'):
                return await self.http_client.fetch(testenv["tornado_server"] + "/301")
github instana / python-sensor / tests / frameworks / test_tornado_client.py View on Github external
async def test():
            with tornado_tracer.start_active_span('test'):
                return await self.http_client.fetch(testenv["tornado_server"] + "/?secret=yeah")
github instana / python-sensor / instana / instrumentation / tornado / client.py View on Github external
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)
github instana / python-sensor / instana / instrumentation / tornado / server.py View on Github external
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: