Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sunya-ch committed Jul 11, 2023
1 parent 1d9c45f commit dbf49d1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/bpfassets/attacher/bcc_attacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func bccCollectProcess() (processesData []ProcessBPFMetrics, err error) {
}
// if ebpf map batch get operation is not supported we iterate over the map
if !ebpfBatchGet {
for it := c.bpfHCMeter.Table.Iter(); it.Next(); {
for it := bccModule.Table.Iter(); it.Next(); {
key := it.Key()
value := it.Leaf()
keys = append(keys, key)
Expand All @@ -252,8 +252,9 @@ func bccCollectProcess() (processesData []ProcessBPFMetrics, err error) {
keysToDelete = append(keysToDelete, key)
} else {
err = bccModule.Table.Delete(key) // deleting the element to reset the counter values
if err != nil && !os.IsNotExist(err) {
if err != nil {
klog.Infof("could not delete bpf table elements, err: %v", err)
keysToDelete = append(keysToDelete, key)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bpfassets/attacher/bpf_perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type ProcessBPFMetrics struct {
CPUCycles uint64
CPUInstr uint64
CacheMisses uint64
VecNR [config.MaxIRQ]uint16 // irq counter, 10 is the max number of irq vectors
VecNR [10]uint16 // irq counter, 10 is the max number of irq vectors
Command [16]byte
}

Expand Down
1 change: 1 addition & 0 deletions pkg/collector/container_hc_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (c *Collector) updateBPFMetrics() {
// System process is the aggregation of all background process running outside kubernetes
// this means that the list of process might be very large, so we will not add this information to the cache
if !isSystemProcess {
klog.V(1).Infof("Command: %s (original:%s)", comm, ct.Command)
c.ContainersMetrics[containerID].SetLatestProcess(ct.CGroupID, ct.PID, comm)
} else if config.EnableProcessMetrics {
c.createProcessMetricsIfNotExist(ct.PID, comm)
Expand Down

0 comments on commit dbf49d1

Please sign in to comment.