This repository was archived by the owner on Aug 17, 2020. It is now read-only.
Draft
Conversation
0f7eab7 to
673e9ff
Compare
bedb332 to
69bc25f
Compare
69bc25f to
d6c316b
Compare
cc123a3 to
6bcf27a
Compare
c2db8e9 to
5a1148d
Compare
2c9d98e to
36da140
Compare
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.
This
PRadds auto instrumentation to sub tests and sub benchmarks.The problem on auto instrumenting sub tests and sub benchmarks is that the call to
t.Runandb.Runare recursive from the initial test execution to other sub tests.An initial try to solve the problem could be the following implementation:
This uses
PatchandUnpatchtwice to use the originalt.Runimplementation. The problem with this algorithm is that is not valid onParallelscenarios, because we don't know the execution order, If we try to use amutexwe end with a deadlock, because eachfuncexecuted byt.Runruns in a separated goroutine.The way we solve to solve this issue, is by never
Unpatchthe patched function, but calling the original implementation in another way.In this case we copy the implementation of both
t.Runandb.Runfrom the original golang source code, to do that we are forced to create the sametesting.Tandtesting.Bstructure and useunsafeto have access to the private fields and use somelinkingto private methods. Note with this implementation we don't need any lock.With this, we add auto instrumentation support for the following cases:
Tests
Benchmarks