-
Notifications
You must be signed in to change notification settings - Fork 190
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]: remove unused func #1895
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ package collector | |
|
||
import ( | ||
"os" | ||
"sync" | ||
"syscall" | ||
"time" | ||
|
||
|
@@ -63,15 +62,15 @@ type Collector struct { | |
|
||
func NewCollector(bpfExporter bpf.Exporter) *Collector { | ||
bpfSupportedMetrics := bpfExporter.SupportedMetrics() | ||
c := &Collector{ | ||
c := Collector{ | ||
NodeStats: *stats.NewNodeStats(), | ||
ContainerStats: map[string]*stats.ContainerStats{}, | ||
ProcessStats: map[uint64]*stats.ProcessStats{}, | ||
VMStats: map[string]*stats.VMStats{}, | ||
bpfExporter: bpfExporter, | ||
bpfSupportedMetrics: bpfSupportedMetrics, | ||
} | ||
return c | ||
return &c | ||
} | ||
|
||
func (c *Collector) Initialize() error { | ||
|
@@ -139,22 +138,12 @@ func (c *Collector) UpdateProcessEnergyUtilizationMetrics() { | |
} | ||
|
||
func (c *Collector) updateResourceUtilizationMetrics() { | ||
wg := &sync.WaitGroup{} | ||
wg.Add(2) | ||
go c.updateNodeResourceUtilizationMetrics(wg) | ||
go c.updateProcessResourceUtilizationMetrics(wg) | ||
wg.Wait() | ||
c.updateProcessResourceUtilizationMetrics() | ||
// aggregate processes' resource utilization metrics to containers, virtual machines and nodes | ||
c.AggregateProcessResourceUtilizationMetrics() | ||
} | ||
|
||
// update the node metrics that are not related to aggregated resource utilization of processes | ||
func (c *Collector) updateNodeResourceUtilizationMetrics(wg *sync.WaitGroup) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to keep this for TODO list when we have metrics those are not related to aggregated resource utilization of processes. @rootfs. Do you recall who introduce this function? |
||
wg.Done() | ||
} | ||
|
||
func (c *Collector) updateProcessResourceUtilizationMetrics(wg *sync.WaitGroup) { | ||
defer wg.Done() | ||
func (c *Collector) updateProcessResourceUtilizationMetrics() { | ||
// update process metrics regarding the resource utilization to be used to calculate the energy consumption | ||
// we first updates the bpf which is responsible to include new processes in the ProcessStats collection | ||
resourceBpf.UpdateProcessBPFMetrics(c.bpfExporter, c.ProcessStats) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,15 +99,15 @@ func newK8sClient() *kubernetes.Clientset { | |
} | ||
|
||
func NewObjListWatcher(bpfSupportedMetrics bpf.SupportedMetrics) (*ObjListWatcher, error) { | ||
w := &ObjListWatcher{ | ||
w := ObjListWatcher{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
stopChannel: make(chan struct{}), | ||
k8sCli: newK8sClient(), | ||
ResourceKind: podResourceType, | ||
bpfSupportedMetrics: bpfSupportedMetrics, | ||
workqueue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), | ||
} | ||
if w.k8sCli == nil || !config.IsAPIServerEnabled() { | ||
return w, nil | ||
return &w, nil | ||
} | ||
optionsModifier := func(options *metav1.ListOptions) { | ||
options.FieldSelector = fields.Set{"spec.nodeName": node.Name()}.AsSelector().String() // to filter events per node | ||
|
@@ -150,7 +150,7 @@ func NewObjListWatcher(bpfSupportedMetrics bpf.SupportedMetrics) (*ObjListWatche | |
return nil, err | ||
} | ||
IsWatcherEnabled = true | ||
return w, nil | ||
return &w, nil | ||
} | ||
|
||
func (w *ObjListWatcher) processNextItem() bool { | ||
|
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.
fix https://github.com/sustainable-computing-io/kepler/actions/runs/12288498261/job/34292384684#step:4:1041