-
Notifications
You must be signed in to change notification settings - Fork 184
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
[fix]: add test case with darwin OS #1856
base: main
Are you sure you want to change the base?
[fix]: add test case with darwin OS #1856
Conversation
🤖 SeineSailor Here is a concise summary of the pull request changes: Summary: This pull request primarily focuses on adding support for Darwin (MacOS) by removing platform-specific build restrictions, introducing test cases, and refactoring functions for consistency. The key modifications include:
Impact: These changes may affect the external interface or behavior of the code, particularly:
Suggestions:
|
@@ -454,15 +454,6 @@ func isCGroupV2(c Client) bool { | |||
return !os.IsNotExist(err) | |||
} | |||
|
|||
// Get cgroup version, return 1 or 2 |
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.
this function is no longer used.
@@ -340,7 +340,7 @@ func SetEnabledIdlePower(enabled bool) { | |||
// SetEnabledGPU enables the exposure of gpu metrics | |||
func SetEnabledGPU(enabled bool) { | |||
// set to true if any config source set it to true | |||
instance.Kepler.EnabledGPU = enabled || instance.Kepler.EnabledGPU |
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.
if the original instance.Kepler.EnabledGPU
is true, which seems the function will not set the GPU enable from true to false.
//go:build darwin | ||
// +build darwin |
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.
Kepler won't run on osx, so IMHO, we shouldn't spend time on it. WDYT?
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.
well, just because I am a mac user.
as a mac user, when I notice/make some nit fix.
I want to test those locally.
so, I made some build tag on files to make it happen.
any other suggestions?
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 am completely fine with supporting darwin as long as we don't block it in CI as OSX isn't a supported platform.
I also feel it is best to focus on linux as the platform kepler support and hence all development on OSX is expected to use linux box (lima may work well)
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.
yep, I agree currently darwin is not major platform to run kepler.
so, @sthaha , can we make an agreement as following:
kepler currently focus on linux platform.
for other platforms, to make kepler is easy for anyone contributes from any platform, we are welcome any benefits(PRs) for kepler including parts as compilable on other platform.
before the specific platform is supported, we just running CI on linux as PR merge standard and official support.
as instance, this PR, increasing test coverage on config package(benefits), with parts as compilable on darwin.
cmd/exporter/exporter.go
Outdated
@@ -152,7 +152,7 @@ func main() { | |||
platform.InitPowerImpl() | |||
defer platform.StopPower() | |||
|
|||
if config.EnabledGPU() { | |||
if config.IsEnabledGPU() { |
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.
If you want to rename this, could you please rename it as IsGPUEnabled()
?
pkg/bpf/exporter.go
Outdated
@@ -111,7 +114,7 @@ func (e *exporter) attach() error { | |||
return fmt.Errorf("error attaching sched_switch tracepoint: %v", err) | |||
} | |||
|
|||
if config.ExposeIRQCounterMetrics() { | |||
if config.IsExposeIRQCounterMetrics() { |
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.
My preference is to leave it as is ..
IsExposeIRQCounterMetrics
does not seem right. If we have to use Is
for bool functions, I think the better option is IsIRQCounterMetricsExposed
just like an English sentence.
pkg/bpf/exporter.go
Outdated
@@ -142,7 +145,7 @@ func (e *exporter) attach() error { | |||
} | |||
|
|||
// Return early if hardware counters are not enabled | |||
if !config.ExposeHardwareCounterMetrics() { | |||
if !config.IsExposeHardwareCounterMetrics() { |
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 above, lets not change it.
config.ExposeHwCounterMetrics()
reads better (proper English) than config.IsExposeHardwareCounterMetrics
bb44a64
to
6474232
Compare
ref https://github.com/sustainable-computing-io/kepler/actions/runs/12005981954/job/33464291051#step:4:75 |
Signed-off-by: Sam Yuan <[email protected]>
Signed-off-by: Sam Yuan <[email protected]>
Signed-off-by: Sam Yuan <[email protected]>
6474232
to
7c374a2
Compare
I think our commit msg check can't support Co-authored-by, as I added two commits from @maryamtahhan as suggestion change, as the suggestion LGTM. |
Signed-off-by: Sam Yuan <[email protected]>
8d1b2f9
to
5576287
Compare
@maryamtahhan , sorry, for short, I use force push to overwrite the approval for change suggestion, as webiny/action-conventional-commits#17 |
Signed-off-by: Sam Yuan <[email protected]>
@rootfs , @sthaha , @vprashar2929 please help review this PR, if it looks good, let's merge it. |
add test case for config package.
remove unused function.
refactor function name to keep same naming convention.
refactor function behavior to same with function name.