github / glb-director

GitHub Load Balancer Director and supporting tooling.
Other
2.37k stars 227 forks source link

Add glb-redirect metrics and export them via /proc #52

Closed lmb closed 5 years ago

lmb commented 5 years ago

Make some basic metrics available via /proc/glb_redirect_stats. The output is as follows:

vagrant@proxy2:~$ cat /proc/glb_redirect_stats
total_packets: 88
accepted_syn_packets: 2
accepted_last_resort_packets: 2
accepted_established_packets: 2
accepted_conntracked_packets: 0
accepted_syn_cookie_packets: 0
forwarded_to_self_packets: 0
forwarded_to_alternate_packets: 2

The second commit makes a subtle change to the order in which is_valid_locally is checked, with the following rationale:

Instead of immediately accepting locally when there are no more suitable next hops, we check for is_valid_locally first.

This makes the no-next-hop case more expensive but gives us a very important metric: accepted_last_resort_packets now becomes an indicator for a malformed forwarding table, since the packet will most likely be dropped by the local network stack.

theojulienne commented 5 years ago

This looks great now, thanks again!