-
Notifications
You must be signed in to change notification settings - Fork 171
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
Question or Bug? #88
Comments
Try with CLSContext? With ExplicitContext you have to keep track of the context manually/explicitly. |
@eirslett Use CLSContext also not right, I doubt |
The way it works, is that the context has a value outside of a scope, inside a scope you can set a new value, and that new value will be used until the end of the scope - after that, the old value will be back. |
@eirslett how best solve the problem? |
This seems like a fundamental flaw of the restify and express instrumentations:
I think the belief here was that since To make it concrete:
As far as fixing, I don't think the current approach can ever work. Can we not approach this by passing around an explicit context object on the request object? That seems much easier to reckon about, although would require updating clients like |
I think I get what the concern is: how do we get async callbacks to honor the scope we think they ought to be in? I think this is an implicit (no pun intended) challenge in the act of instrumenting. Each library will behave differently. The way I have recently thought of it is this..
disclaimer.. I help maintain, but don't use any of this code, so I might be mildly off.. feelfree to correct me if I've misunderstood anything |
@ppg @adriancole thanks for yours detailed answer |
@adriancole thanks for the response. I don't think we're in any disagreement, but for your item 2, per the example @feifeiiiiiiiiiii provided, using CLS with It seems like a better approach for express (and likely restify) would be to add a concept of the context onto either the request, or response.locals; it is after all where express says to put per request scoped objects, which is what the TraceId is. Then when the context, or more appropriately span, is needed you could grab from there and either pass into context/span aware clients, or create child spans to perform work. |
I think perhaps the interactions around "scoped" need more exploration. I don't know how scheduling works here. Maybe we can get more specific, like raise a test which has a user-provided code which needs to add to a trace, and show how scoping doesn't work? It would be faster for me to help as I am not as good in js as others.. One thing I'd like to see is if there's an instrumentation approach we can use that prevents users from needing to know special knowledge about a library specific request or response scope. Not saying we won't end up needing that out, just want to see concretely where it ends.. PS I put a few words here and happy to have help elaborating the general problem https://docs.google.com/document/d/16byriP7jCi2xmLf8IveTTy5ttoGFgd9hn8hg_QkfMTU/edit#heading=h.burk117bfcxf |
I use
restify
andredis
to testzipkin-js
, script as followI think result is not right
The text was updated successfully, but these errors were encountered: