Skip to content

Commit

Permalink
refactor: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Siumauricio committed Jan 4, 2025
1 parent 198cdf0 commit e9adf9a
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions apps/golang/containers/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func (cm *ContainerMonitor) collectMetrics() {

serviceName := GetServiceName(container.Name)

log.Printf("Processing container: %+v", container)
if seenServices[serviceName] {
continue
}
Expand All @@ -136,16 +135,13 @@ func (cm *ContainerMonitor) collectMetrics() {
}

func processContainerMetrics(container Container) *database.ContainerMetric {
// log.Printf("Raw container data: %+v", container)

// Procesar CPU
cpu, _ := strconv.ParseFloat(strings.TrimSuffix(container.CPUPerc, "%"), 64)
log.Printf("CPU: %v from %v", cpu, container.CPUPerc)

// Procesar Memoria
memPerc, _ := strconv.ParseFloat(strings.TrimSuffix(container.MemPerc, "%"), 64)
memParts := strings.Split(container.MemUsage, " / ")
// log.Printf("Memory parts: %v from %v", memParts, container.MemUsage)

var usedValue, totalValue float64
var usedUnit, totalUnit string
Expand Down Expand Up @@ -178,11 +174,8 @@ func processContainerMetrics(container Container) *database.ContainerMetric {
}
}

// log.Printf("Memory processed: used=%v%v, total=%v%v", usedValue, usedUnit, totalValue, totalUnit)

// Procesar Network I/O
netParts := strings.Split(container.NetIO, " / ")
// log.Printf("Network parts: %v from %v", netParts, container.NetIO)

var netInValue, netOutValue float64
var netInUnit, netOutUnit string
Expand All @@ -203,11 +196,8 @@ func processContainerMetrics(container Container) *database.ContainerMetric {
}
}

// log.Printf("Network processed: in=%v%v, out=%v%v", netInValue, netInUnit, netOutValue, netOutUnit)

// Procesar Block I/O
blockParts := strings.Split(container.BlockIO, " / ")
// log.Printf("Block IO parts: %v from %v", blockParts, container.BlockIO)

var blockReadValue, blockWriteValue float64
var blockReadUnit, blockWriteUnit string
Expand All @@ -228,8 +218,6 @@ func processContainerMetrics(container Container) *database.ContainerMetric {
}
}

// log.Printf("Block IO processed: read=%v%v, write=%v%v", blockReadValue, blockReadUnit, blockWriteValue, blockWriteUnit)

return &database.ContainerMetric{
Timestamp: time.Now().UTC().Format(time.RFC3339Nano),
CPU: cpu,
Expand Down

0 comments on commit e9adf9a

Please sign in to comment.