GithubHelp home page GithubHelp logo

Comments (4)

thehesiod avatar thehesiod commented on May 18, 2024

btw for asyncio I found I could do it by serializing the parent span in the base process via:

        dd_span = tracer.get_call_context().get_current_span()
        attrs = {'name', 'service', 'resource', 'span_type', 'trace_id', 'span_id', 'parent_id', 'start'}
        dd_span_info = {n: getattr(dd_span, n) for n in attrs} if dd_span else None

then smashing it in in the child process:

try:
        if dd_span_info:
            dd_ctx = tracer.get_call_context()
            parent_span = Span(tracer, **dd_span_info, context=dd_ctx)

            dd_ctx._current_span = parent_span

            task = asyncio.Task.current_task(loop=self._loop)
            set_call_context(task, dd_ctx)
finally:
            if dd_span_info:
                set_call_context(task, None)

This works because the tracer only needs a few key pieces of information. If we could formalize a process for this it would be awesome!

from dd-trace-py.

thehesiod avatar thehesiod commented on May 18, 2024

hmm, reading http://pypi.datadoghq.com/trace/docs/#distributed-tracing it seems like perhaps the asyncio patchers should support parent trace/span IDs

from dd-trace-py.

thehesiod avatar thehesiod commented on May 18, 2024

ok, I think I've implemented something acceptable in my PR: #248 It adds optional kwargs that follows the aiohttp style for distributed spans...however if there was a way to officially tell the context what the parent was it would be better I think.

from dd-trace-py.

palazzem avatar palazzem commented on May 18, 2024

Related to #247 that has been solved. Closing this one too.

from dd-trace-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.