This repository was archived by the owner on Aug 23, 2023. It is now read-only.
Merged
Conversation
cc623b7 to
5c476f6
Compare
Dieterbe
reviewed
Sep 20, 2018
| if noTrace, ok := macCtx.Data["noTrace"]; ok && noTrace.(bool) { | ||
| return | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
why do all the work up to here if we don't need tracing? can't we do this at the start of this function?
Contributor
Author
There was a problem hiding this comment.
in the beginning of this function macCtx.Data["noTrace"] would not have been set yet, because the tracer is at the beginning of the list of handlers before the one that sets noTrace. I think it probably makes sense to leave the tracer at it's position in the middleware chain, so that we have it available in the other middlewares if we want to use it there.
Contributor
Author
|
Tested like this:
Looks good afaict |
Contributor
|
great. thanks mauro! |
Dieterbe
approved these changes
Sep 24, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not sure what the best method to disable tracing on certain routes is. We could also just have a list of urls where tracing should be disabled, then we could compare the url against that list in
api/middleware/tracer.go, but I think maintaining such a list is going to be ugly.We could also just not add the tracer middleware with
r.Use()anymore, but add it in those routes that should have tracing enabled separately, but then we wouldn't have the tracer in all the middlewares that get executed before that one because then the tracer would be later in the list of middlewares.