add some extra logs

This commit is contained in:
mlsmaycon
2026-02-03 14:00:54 +01:00
parent b20d484972
commit f4af85e130
7 changed files with 370 additions and 1 deletions

View File

@@ -208,6 +208,11 @@ func (r *SysOps) refreshLocalSubnetsCache() {
// genericAddVPNRoute adds a new route to the vpn interface, it splits the default prefix
// in two /1 prefixes to avoid replacing the existing default route
func (r *SysOps) genericAddVPNRoute(prefix netip.Prefix, intf *net.Interface) error {
startTime := time.Now()
defer func() {
log.Warnf("[TIMING] genericAddVPNRoute(%s): total %v", prefix, time.Since(startTime))
}()
nextHop := Nexthop{netip.Addr{}, intf}
switch prefix {
@@ -339,6 +344,13 @@ func (r *SysOps) setupHooks(initAddresses []net.IP, stateManager *statemanager.M
}
func GetNextHop(ip netip.Addr) (Nexthop, error) {
startTime := time.Now()
defer func() {
if elapsed := time.Since(startTime); elapsed > 10*time.Millisecond {
log.Warnf("[TIMING] GetNextHop(%s): %v", ip, elapsed)
}
}()
r, err := netroute.New()
if err != nil {
return Nexthop{}, fmt.Errorf("new netroute: %w", err)