-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[INS-170] Unify JDBC URL parsing across detectors and analyzers #4574
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
base: main
Are you sure you want to change the base?
[INS-170] Unify JDBC URL parsing across detectors and analyzers #4574
Conversation
amanfcp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks @mustansir14
Left a few suggestions
| postgresJDBC := &PostgresJDBC{ | ||
| Host: u.Host, | ||
| Database: dbName, | ||
| Params: params, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use a single ConnectionInfo struct across all handlers, and later clean it up from jdbc analyzer models.go.
| if h, p, found := strings.Cut(host, ":"); found { | ||
| data["host"] = h | ||
| data["port"] = p | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the coding guidelines
| if h, p, found := strings.Cut(host, ":"); found { | |
| data["host"] = h | |
| data["port"] = p | |
| } | |
| if h, p, ok := strings.Cut(host, ":"); ok { | |
| data["host"] = h | |
| data["port"] = p | |
| } |
Description:
We need to unify JDBC URL parsing across the detector and analyzer. This PR supports that by publicizing the methods required by the analyzer, and also some changes to make the methods compatible for both detector and analyzer.
The changes here will make more sense when viewed in conjunction with the corresponding integrations PR.
Checklist:
make test-community)?make lintthis requires golangci-lint)?