opentracing-python
opentracing-python copied to clipboard
Too much code
Don't get me wrong. I love typing.
But I think the current two examples (inbound, outbound) of the README are too long.
I guess more could be done in the library.
Why is it not possible to write the implementation of before_http_request() and before_request() in one line?
And all = in codes have been - , is this a mistake?
@liubin I think that is a mistake :smile:
Thank you for fixing =' being -' in README.
This issue was about a different topic (see above).
AFAIK above topic was not fixed.
You're right -- github closed the issue automatically when that typo PR merged. Reopened.
(catching up on open issues)
@guettli FYI, I would like to address this issue once PR #50 or similar is merged. The fundamental problem (IMO) is that the examples only describe HTTP request handling and don't start with simpler things first, like instrumenting a synchronous function call. While it's possible to write wrappers that simply, well, anything, things that could be a part of opentracing-contrib should at least start life there. I.e., I do not want to clutter the core opentracing-python lib with helpers that just reduce typing.
I personally think we need a few simple "code labs" in each popular language that we could also use in the workshops at conferences, i.e.
- hello world one-span example
- traced function example
- traced async function
- traced http request
- traced server-server example
Opened https://github.com/opentracing/specification/issues/73
Unless the intention is to replace the examples with something completely different, I can create a PR to make that a bit easier to read. Just let me know if that can be useful ;)
@tbarbugli it's difficult to say "if that can be useful" without actually seeing the different examples. The current examples have reasons for being written the way they are. As @bhs mentioned, one of the more obscure parts is the in-process span propagation that will be addressed soon with the new API changes.
Side note - might be worth pointing to opentracing-tutorial for simpler examples.