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

feat(injector): early filtering of aspects #435

Merged
merged 24 commits into from
Dec 19, 2024
Merged

Conversation

eliottness
Copy link
Contributor

@eliottness eliottness commented Nov 28, 2024

What

This PR adds two new functions to the join.Point interface:

// MatchType is an enumeration of the possible outcomes of a join point
type MatchType byte

const (
	// Unknown indicates that the join point cannot determine whether it matches the given context
	Unknown MatchType = '?'
	// Match indicates that the join point may match the given context
	Match MatchType = 'Y'
	// NeverMatch indicates that the join point DOES NOT match the given context
	NeverMatch MatchType = 'N'
)

// PackageMayMatch determines whether the join point may match the given package data from the importcfg file.
PackageMayMatch(ctx *context.PackageMayMatchContext) MatchType

// FileMayMatch determines whether the join point may match the given file raw content
FileMayMatch(ctx *context.FileMayMatchContext) MatchType

Which shoudl help reduce drastically the number of packages we parse/decorate and the number of aspects we run each time

@eliottness eliottness marked this pull request as ready for review November 28, 2024 15:23
@eliottness eliottness requested a review from a team as a code owner November 28, 2024 15:23
@eliottness eliottness marked this pull request as draft November 28, 2024 15:24
@eliottness eliottness force-pushed the eliottness/early-match branch 5 times, most recently from d9974d6 to 369e60f Compare December 4, 2024 18:29
eliottness and others added 8 commits December 5, 2024 15:08
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness eliottness force-pushed the eliottness/early-match branch from 185846b to 4786297 Compare December 5, 2024 14:13
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
@DataDog DataDog deleted a comment from codecov bot Dec 6, 2024
@eliottness eliottness marked this pull request as ready for review December 6, 2024 15:08
@eliottness eliottness changed the title feat(aspect): early match v0 feat(aspect): may match Dec 6, 2024
Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness eliottness changed the title feat(aspect): may match feat(injector): may match Dec 9, 2024
@RomainMuller RomainMuller changed the title feat(injector): may match feat(injector): early filtering of aspects Dec 17, 2024
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Copy link
Contributor

@RomainMuller RomainMuller left a comment

Choose a reason for hiding this comment

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

SAAC

@RomainMuller RomainMuller added this pull request to the merge queue Dec 19, 2024
Merged via the queue into main with commit 6f35bce Dec 19, 2024
41 checks passed
@RomainMuller RomainMuller deleted the eliottness/early-match branch December 19, 2024 17:54
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 87.25212% with 45 lines in your changes missing coverage. Please review.

Project coverage is 63.95%. Comparing base (4d4eb9b) to head (5862616).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
internal/injector/parse/parser.go 70.87% 19 Missing and 11 partials ⚠️
internal/injector/aspect/join/function.go 87.50% 4 Missing and 2 partials ⚠️
internal/injector/aspect/join/configuration.go 0.00% 4 Missing ⚠️
internal/injector/injector.go 93.47% 2 Missing and 1 partial ⚠️
internal/injector/aspect/may/match.go 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #435      +/-   ##
==========================================
- Coverage   63.96%   63.95%   -0.02%     
==========================================
  Files         184      187       +3     
  Lines       11084    13440    +2356     
==========================================
+ Hits         7090     8595    +1505     
- Misses       3461     4281     +820     
- Partials      533      564      +31     
Components Coverage Δ
Generators 71.98% <ø> (-4.18%) ⬇️
Instruments 73.03% <ø> (-0.39%) ⬇️
Go Driver 74.01% <ø> (-4.62%) ⬇️
Toolexec Driver 70.22% <100.00%> (-4.07%) ⬇️
Aspects 77.24% <93.29%> (-1.52%) ⬇️
Injector 75.65% <87.17%> (-1.63%) ⬇️
Job Server 70.93% <ø> (+3.86%) ⬆️
Integration Test Suite 57.17% <ø> (-0.32%) ⬇️
Other 63.95% <87.25%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
internal/injector/aspect/join/all-of.go 87.50% <100.00%> (+2.31%) ⬆️
internal/injector/aspect/join/declaration.go 67.08% <100.00%> (-1.88%) ⬇️
internal/injector/aspect/join/directive.go 93.75% <100.00%> (-0.54%) ⬇️
internal/injector/aspect/join/expression.go 85.00% <100.00%> (-2.10%) ⬇️
internal/injector/aspect/join/join.go 85.96% <ø> (-0.31%) ⬇️
internal/injector/aspect/join/not.go 84.21% <100.00%> (-1.51%) ⬇️
internal/injector/aspect/join/one-of.go 82.45% <100.00%> (+3.04%) ⬆️
internal/injector/aspect/join/package.go 86.04% <100.00%> (+0.86%) ⬆️
internal/injector/aspect/join/struct.go 67.78% <100.00%> (-1.86%) ⬇️
internal/injector/aspect/join/testmain.go 86.36% <100.00%> (+0.64%) ⬆️
... and 10 more

... and 152 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.

2 participants