Usage examples should be provided
Opened this issue · 10 comments
Basic usage of the OpenTracing APIs in JS should be provided along with the code.
Any updates?
You may be interested to look at a complete implementation in an OpenSource project:
RPC extraction:
Handler with traced methods:
https://github.com/sourcegraph/javascript-typescript-langserver/blob/2f97618928eec654c4fd10dbdd19e605e3f67e9f/src/typescript-service.ts#L355
I would recommend you to scroll a bit through that and use jump to definition to look at how spans are passed around and used. Hope this helps
Really? You recommend going through of thousand of lines of code just to understand how to use the opentracing api?
It should be easy to add some real world examples to this repository.
- Create spans
- Create child spans
- Inject context
- Extract context
- Cross Process tracing
that would be a start.
As far as I can tell, the README already provides some example.
To have a more tutorial-style examples, we used this repo in the recent OpenTracing workshop: https://github.com/yurishkuro/opentracing-tutorial/. The Javascript tutorial is currently incomplete, there is a PR in progress.
@yurishkuro An example with internal hops between multiple files would be really helpful.
For Node, how to handle it for big project?
Is initializing all the variables/constants in each files while passing parent_span in the function parameter is the only way around this??
For a large project you want to standardize on some representation of a Context (can create an internal module), or you can rely on CLS in newer Node versions if you're happy with its performance.
Thanks @yurishkuro.
Your response as well as your opentracing-tutorial repository was very helpful.
I might later send a PR with the module included..
Thanks @yurishkuro. Would be awesome if we had some examples for followsFrom
when used across process boundaries too (how to create a context from a parent with google's pubsub, in example?).
I am looking for the same thing. Can anyone share me some experience with opentrace on different node?
I have an example of tracing through Kafka that uses follows-from: https://github.com/PacktPublishing/Mastering-Distributed-Tracing/tree/master/Chapter05