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

Match on process suffix instead of contains #73

Merged
merged 2 commits into from
Apr 20, 2023

Conversation

grcevski
Copy link
Contributor

This PR changes the name matcher for the instrumented process to look for the suffix in the full path, instead of matching a partial path. This should avoid false positives on matching the name of a process accidentally, e.g:

We shouldn't match /server in here /home/user/.vscode/extensions/rust-lang.rust-analyzer-0.3.1472-linux-x64/server/rust-analyzer, but we should match it here ./server

@grcevski grcevski added the bug Something isn't working label Apr 20, 2023
@grcevski grcevski requested a review from mariomac April 20, 2023 13:58
@codecov-commenter
Copy link

Codecov Report

Merging #73 (d3103f7) into main (a5769e0) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main      #73   +/-   ##
=======================================
  Coverage   46.82%   46.82%           
=======================================
  Files          15       15           
  Lines        1119     1119           
=======================================
  Hits          524      524           
  Misses        548      548           
  Partials       47       47           
Flag Coverage Δ
unittests 46.82% <0.00%> (ø)

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

Impacted Files Coverage Δ
pkg/goexec/file.go 36.95% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

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

LGTM. Just a minor comment that can be done later.

BTW the integration test failed because GRPC integration tests are flaky. I recorded an issue: #65

@@ -51,7 +51,7 @@ func ProcessNamed(pathContains string) ProcessFinder {
continue
}

if strings.Contains(exePath, pathContains) {
if strings.HasSuffix(exePath, pathContains) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NitPick: maybe renaming pathContains by pathSuffix?

@grcevski
Copy link
Contributor Author

LGTM. Just a minor comment that can be done later.

BTW the integration test failed because GRPC integration tests are flaky. I recorded an issue: #65

Thanks Mario! I'll take a look at that grpc flakiness.

@grcevski grcevski merged commit 4406914 into grafana:main Apr 20, 2023
2 checks passed
@grcevski grcevski deleted the fix_name_match branch April 20, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants