Skip to content

Commit

Permalink
Add metrics for conntrack and ebpf errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed Jul 9, 2019
1 parent 20e7d5d commit 5e57b0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions probe/endpoint/conntrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"
"time"

"github.com/armon/go-metrics"
log "github.com/sirupsen/logrus"
"github.com/typetypetype/conntrack"
)
Expand Down Expand Up @@ -148,6 +149,7 @@ func (c *conntrackWalker) run() {
return
}
if f.Err != nil {
metrics.IncrCounter([]string{"conntrack", "errors"}, 1)
log.Errorf("conntrack event error: %v", f.Err)
stop()
return
Expand Down
7 changes: 7 additions & 0 deletions probe/endpoint/ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"sync"
"syscall"

"github.com/armon/go-metrics"
log "github.com/sirupsen/logrus"
"github.com/weaveworks/common/fs"
"github.com/weaveworks/scope/probe/endpoint/procspy"
Expand Down Expand Up @@ -159,6 +160,9 @@ func (t *EbpfTracker) TCPEventV4(e tracer.TcpV4) {
// https://github.com/weaveworks/scope/issues/2334
log.Errorf("tcp tracer received event with timestamp %v even though the last timestamp was %v. Stopping the eBPF tracker.", e.Timestamp, t.lastTimestampV4)
t.stop()
metrics.IncrCounterWithLabels([]string{"ebpf", "errors"}, 1, []metrics.Label{
{Name: "kind", Value: "timestamp-out-of-order"},
})
return
}

Expand All @@ -181,6 +185,9 @@ func (t *EbpfTracker) TCPEventV6(e tracer.TcpV6) {
// LostV4 handles IPv4 TCP event misses from the eBPF tracer.
func (t *EbpfTracker) LostV4(count uint64) {
log.Errorf("tcp tracer lost %d events. Stopping the eBPF tracker", count)
metrics.IncrCounterWithLabels([]string{"ebpf", "errors"}, 1, []metrics.Label{
{Name: "kind", Value: "lost-events"},
})
t.stop()
}

Expand Down

0 comments on commit 5e57b0d

Please sign in to comment.