-
Notifications
You must be signed in to change notification settings - Fork 200
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: NGINX Version #1462
feat: NGINX Version #1462
Conversation
@@ -119,10 +120,15 @@ func runtimeInspection(pods []corev1.Pod, ignoredContainers []string) ([]odigosv | |||
} | |||
} | |||
|
|||
runtimeVersion := "" |
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.
runtimeVersion := "" | |
var runtimeVersion string |
|
||
func (g *GolangInspector) GetRuntimeVersion(p *process.Details, containerURL string) *version.Version { | ||
file := fmt.Sprintf("/proc/%d/exe", p.ProcessID) | ||
buildInfo, err := buildinfo.ReadFile(file) |
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.
nit: We are calling ReadFile twice for each Go process, if it is possible to reuse the buildInfo from the Inspect function it will be better
return programLanguageDetails, true | ||
func (j *JavaInspector) GetRuntimeVersion(proc *process.Details, containerURL string) *version.Version { | ||
if value, exists := proc.GetDetailedEnvsValue(process.JavaVersionConst); exists { | ||
re := regexp.MustCompile(JavaVersionRegex) |
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.
define as a global const, avoiding re-compiliong the regex each time
return "", nil | ||
} | ||
|
||
re := regexp.MustCompile(NginxVersionRegex) |
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.
Same as the comment for the other regex - use as a const
} | ||
match := re.FindStringSubmatch(buildInfo.GoVersion) |
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.
I'm not sure why we need this regex here. The buildinfo package is an official go package which should provide a valid go version if one exists.
No description provided.