-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug] incorrect span segment when enhancing the Gin framework #11852
Comments
What was wrong? This sentence is not clear. |
I found that the Gin plugin has been changed to |
Could you put a graph to explain this? You are using an instance level dynamic field, this should not be helpful is a handler instance repeatedly used in the process. |
when customize middleware in Gin, the trace info will lost , such as
and the log like this, after has no trace info
|
I could understand your case now, then, when the context gets reset in the after? Is it caused by |
because every middleware handlerFuncs could call |
OK, then there is typically solution for this, you should put a counter in the context of the chain. This counter increases one in before and minus one in after. Then, create span when the counter created, and stop span when counter back to zero. Note, the counter should be kept in the request context. |
Search before asking
Apache SkyWalking Component
OAP server (apache/skywalking)
What happened
span will be created by the first HandlerFunc and closed by the last HandlerFunc, and cause incorrect SegmentID and SpanId in the gin middware
What you expected to happen
handle the create and end span correctly
How to reproduce
using Gin middleware methods
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
The text was updated successfully, but these errors were encountered: