Are there any crevasses using this outside of a notebook (e.g. to enable multi tenancy in fastapi with multiple projects and a single server)?
💡 Hint: Mention RunLLM in the thread for followups.
Hey Christopher H. 👋 That's a really good question. The project name is set via contextvars, which should be thread and task local. I think that probably means they're local to the coroutine defining each fastapi route, but I have not tested this behavior.
If you want to be extra careful, you can also instantiate an individual tracer provider with a project name resource for each project. But this might be overkill.
Yes, if project name is set via contextvars it should work. You mean with set_global_tracer_provider=False? Yeah, I will test and see. First option is more convenient 🙂 ...btw. really cool to see that the team is so response!
The current implementation is not safe for concurrency because it’s monkey patching the __init__ of each span. That’s why we generally limit its application in a notebook
Oh, good catch Roger Y.. Christopher H. better go with the individual tracer provider approach then.
