mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
ebpf tracker: add callback for lost events
Lost events were previously unnoticed. This patch adds an error in the log and stops the ebpf tracker if an event is lost.
This commit is contained in:
@@ -82,7 +82,7 @@ func newEbpfTracker() (eventTracker, error) {
|
||||
return nil, fmt.Errorf("kernel not supported: %v", err)
|
||||
}
|
||||
|
||||
t, err := tracer.NewTracer(tcpEventCbV4, tcpEventCbV6)
|
||||
t, err := tracer.NewTracer(tcpEventCbV4, tcpEventCbV6, lostCb)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -119,6 +119,12 @@ func tcpEventCbV6(e tracer.TcpV6) {
|
||||
// TODO: IPv6 not supported in Scope
|
||||
}
|
||||
|
||||
func lostCb(count uint64) {
|
||||
log.Errorf("tcp tracer lost %d events. Stopping the eBPF tracker", count)
|
||||
ebpfTracker.dead = true
|
||||
ebpfTracker.stop()
|
||||
}
|
||||
|
||||
func (t *EbpfTracker) handleConnection(ev tracer.EventType, tuple fourTuple, pid int, networkNamespace string) {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user