Skip to content
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

fix: //dd:span on func main() does not work #316

Merged
merged 9 commits into from
Oct 3, 2024

Conversation

RomainMuller
Copy link
Contributor

Since the tracer was started at the start of the main function, a //dd:span annotation there may not have been honored, depending on the order in which aspects were woven into the file.

This PR mvoes the tracer initialization to a func init() function, so that it happens strictly before the main function starts executing, making it possible to //dd:span the main function reliably.

Since the tracer was started at the start of the `main` function, a
`//dd:span` annotation there may not have been honored, depending on the
order in which aspects were woven into the file.

This PR mvoes the tracer initialization to a `func init()` function, so
that it happens strictly before the `main` function starts executing,
making it possible to `//dd:span` the `main` function reliably.
@RomainMuller RomainMuller requested a review from a team as a code owner October 3, 2024 10:01
Copy link
Contributor

@eliottness eliottness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts for later: would it be better to divide this aspect into 2: one for starting the tracer and one for the profiler ? Especially since we can add multiple init functions in the same file

samples/client/main.go Show resolved Hide resolved
@RomainMuller RomainMuller added this pull request to the merge queue Oct 3, 2024
Merged via the queue into main with commit bf40949 Oct 3, 2024
21 checks passed
@RomainMuller RomainMuller deleted the romain.marcadier/start-tracer-in-init branch October 3, 2024 14:29
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 61.04%. Comparing base (b6cd6fa) to head (ed224ab).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/jobserver/pkgs/resolve.go 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #316      +/-   ##
==========================================
+ Coverage   57.93%   61.04%   +3.11%     
==========================================
  Files         151      149       -2     
  Lines       10973     9419    -1554     
==========================================
- Hits         6357     5750     -607     
+ Misses       4149     3199     -950     
- Partials      467      470       +3     
Components Coverage Δ
Generators 78.38% <ø> (+1.40%) ⬆️
Instruments 88.05% <ø> (ø)
Go Driver 80.24% <ø> (+7.43%) ⬆️
Toolexec Driver 74.29% <ø> (+3.41%) ⬆️
Aspects 77.12% <100.00%> (+6.26%) ⬆️
Injector 77.35% <100.00%> (+4.21%) ⬆️
Job Server 69.09% <33.33%> (+5.36%) ⬆️
Integration Test Suite 50.58% <ø> (+2.08%) ⬆️
Other 61.04% <50.00%> (+3.11%) ⬆️
Files with missing lines Coverage Δ
internal/injector/aspect/advice/inject.go 81.81% <100.00%> (+8.64%) ⬆️
internal/jobserver/pkgs/resolve.go 89.65% <33.33%> (+0.27%) ⬆️

... and 129 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants