Skip to content

Commit

Permalink
Merge pull request #393 from askuy/feature/optimizecontextcancel
Browse files Browse the repository at this point in the history
EnableConnTcpMetric
  • Loading branch information
askuy authored Jun 7, 2024
2 parents 5f8e627 + 3951fc2 commit 87aa236
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/emetric/tcpstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ func NewTCPStatCollector() (*TcpStatCollector, error) {

func (c *TcpStatCollector) Update() error {
go func() {
statsFile := path.Join("/proc", strconv.Itoa(os.Getpid()), "net", "tcp")
tcpStats, err := getTCPStats(statsFile)
if err != nil {
elog.EgoLogger.Error(fmt.Errorf("couldn't get tcpstats: %w", err).Error())
return
}
for {
statsFile := path.Join("/proc", strconv.Itoa(os.Getpid()), "net", "tcp")
tcpStats, err := getTCPStats(statsFile)
if err != nil {
elog.EgoLogger.Error(fmt.Errorf("couldn't get tcpstats: %w", err).Error())
return
}
for index, value := range tcpStats {
for addr, number := range value {
ClientStatsGauge.WithLabelValues(
Expand All @@ -83,8 +83,8 @@ func (c *TcpStatCollector) Update() error {
index.String(),
).Set(number)
}
time.Sleep(5 * time.Second)
}
time.Sleep(5 * time.Second)
}
}()

Expand Down

0 comments on commit 87aa236

Please sign in to comment.