diff --git a/vppstats/stats.go b/vppstats/stats.go index 7e043f3..43c56b7 100644 --- a/vppstats/stats.go +++ b/vppstats/stats.go @@ -133,7 +133,7 @@ func statsRoutine(period time.Duration, callback StatsCallback) { // Query stats if connected if connected { - if !queryInterfaceStatsWithLivenessCheck(conn, statsConn, callback) { + if !queryInterfaceStats(conn, statsConn, callback) { connected = false continue } @@ -147,7 +147,7 @@ func statsRoutine(period time.Duration, callback StatsCallback) { } } -func queryInterfaceStatsWithLivenessCheck(conn *core.Connection, statsConn *core.StatsConnection, callback StatsCallback) bool { +func queryInterfaceStats(conn *core.Connection, statsConn *core.StatsConnection, callback StatsCallback) bool { // Check VPP liveness using API call if !checkVPPLiveness(conn) { logger.Printf("VPP liveness check failed") @@ -233,30 +233,3 @@ func checkVPPLiveness(conn *core.Connection) bool { return true } -// Keep the old function for compatibility -func queryInterfaceStats(c *core.StatsConnection, callback StatsCallback) { - // Create the proper struct for interface stats - stats := new(api.InterfaceStats) - - // Use the GetInterfaceStats method - this is the correct approach - if err := c.GetInterfaceStats(stats); err != nil { - logger.Printf("Failed to get interface stats: %v", err) - return - } - - // Always log basic info - logger.Printf("Retrieved stats for %d interfaces", len(stats.Interfaces)) - - // Debug logging for individual interfaces - for _, iface := range stats.Interfaces { - logger.Debugf("Interface %d (%s): RX %d pkts/%d bytes, TX %d pkts/%d bytes", - iface.InterfaceIndex, iface.InterfaceName, - iface.Rx.Packets, iface.Rx.Bytes, - iface.Tx.Packets, iface.Tx.Bytes) - } - - // Call the callback to update the MIB - if callback != nil { - callback(stats) - } -}