Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow providing a parent span to a new Requests span #2

Open
alertedsnake opened this issue Sep 13, 2020 · 2 comments
Open

Allow providing a parent span to a new Requests span #2

alertedsnake opened this issue Sep 13, 2020 · 2 comments

Comments

@alertedsnake
Copy link

I'd like to use this in a service which makes calls to other services, so I'd like to attach the new Requests span to an existing span, but it seems the library doesn't do that. Any interest in adding this? I'm sure I could work on it if this is still an active project, but wanted to just make sure before I put in the effort...

@rmfitzpatrick
Copy link
Collaborator

@alertedsnake spans that are created by this library should use the current active span as their parent. Are you finding this not to be the case?

If you're referring to modifying the instrumentation in such a way to allow arbitrarily specifying a span to parent the request span, I'm not sure this use case is something we'd be able to support given that request methods don't allow arbitrary keyword arguments. I think it would be preferable to set the desired parent span as the active one before invoking the traced request method:

with tracer.scope_manager.activate(myDesiredParentSpan, False) as scope:
    post(...)

To your other question, this library is still active and bugs and feature requests will be followed up on, but I would advise beginning to look into the OpenTelemetry project as it's where most active development is occurring: https://github.com/open-telemetry/opentelemetry-python. They provide an OpenTracing shim to allow your existing instrumentation to continue to function: https://opentelemetry-python.readthedocs.io/en/latest/instrumentation/opentracing_shim/opentracing_shim.html

@alertedsnake
Copy link
Author

Okay, I'll try your suggestions - I hadn't actually started using this yet, but I'm using the gRPC tracing, where there's no magic "current active span" in the OpenTracing library, it's available in the request context - I could start another one from that as the active span, but then I have an unnecessary item in the tree. It's the "server side" example here.

Regarding OpenTelemetry, I spent a bunch of time trying to figure out how to get started, there's a lot of really in-depth documentation on the system as a whole, but very little simple "here's how to get started" examples, and a lot of other docs I've found are essentially autogenerated reference docs or just plain wrong, due to the libraries themselves being moving targets.

The shim does look interesting though, I'll have to try that out. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants