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

Simplify process FindAndInstrument synchronization #1579

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

mariomac
Copy link
Contributor

To be merged after 2.0 is released

@mariomac mariomac requested a review from a team as a code owner January 27, 2025 10:57
@mariomac mariomac added the do-not-merge WIP or something that musn't be merged label Jan 27, 2025
instr := appolly.New(ctx, ctxInfo, config)
if err := instr.FindAndInstrument(&wg); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change avoids sharing the ownership of a critical synchronization mechanism between different components.

The usual convention in Go is expose a simpler synchronization mechanism, such as returning a close channel.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 71.23%. Comparing base (074e718) to head (7c90d66).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/components/beyla.go 66.66% 1 Missing and 2 partials ⚠️
pkg/internal/appolly/appolly.go 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1579      +/-   ##
==========================================
+ Coverage   71.20%   71.23%   +0.02%     
==========================================
  Files         197      197              
  Lines       19754    19750       -4     
==========================================
+ Hits        14066    14068       +2     
+ Misses       5006     5002       -4     
+ Partials      682      680       -2     
Flag Coverage Δ
integration-test 52.55% <80.00%> (-0.31%) ⬇️
k8s-integration-test 53.64% <80.00%> (+0.12%) ⬆️
oats-test 34.64% <80.00%> (-0.01%) ⬇️
unittests 47.31% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ctx context.Context
cancel func()
}
contexts := map[uint64]cancelCtx{}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't saw the utility of storing all the contexts and explicitly cancelling them after the parent context is cancelled.

If the parent context its Done, all the child contexts are Done in cascade.

@@ -95,7 +87,7 @@ func (i *Instrumenter) FindAndInstrument(wg *sync.WaitGroup) error {
}
}()
// TODO: wait until all the resources have been freed/unmounted
Copy link
Contributor Author

@mariomac mariomac Jan 27, 2025

Choose a reason for hiding this comment

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

Not sure if this already happens. I will try to check/fix the RingbufForwarder in a future PR.

pkg/components/beyla.go Outdated Show resolved Hide resolved
Copy link
Contributor

@rafaelroquetto rafaelroquetto left a comment

Choose a reason for hiding this comment

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

LGTM - I guess my only ""concern"" is that we aren't leaving anything behind - or if we are, that we understand why that happens and are fine with that.

pkg/components/beyla.go Outdated Show resolved Hide resolved
@mariomac mariomac removed the do-not-merge WIP or something that musn't be merged label Jan 28, 2025
Copy link
Contributor

@rafaelroquetto rafaelroquetto left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 :)

@mariomac mariomac merged commit 8e5105e into grafana:main Jan 28, 2025
13 checks passed
@mariomac mariomac deleted the simpler-findandinstrument branch January 28, 2025 15:58
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.

2 participants