Skip to content

Commit

Permalink
Merge pull request alibaba#160 from Lyt99/fix/probes-dashboard
Browse files Browse the repository at this point in the history
format metric names & dashboard use new metrics
  • Loading branch information
BSWANG authored Jan 26, 2024
2 parents 6163ff6 + db9f8ff commit 5971379
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 115 deletions.
158 changes: 79 additions & 79 deletions deploy/resource/kubeskoop-exporter-dashboard.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion deploy/skoopbundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ data:
- name: tcp
- name: tcpext
- name: udp
- name: packetloss
- name: flow
event:
probes:
Expand Down
1 change: 1 addition & 0 deletions pkg/exporter/cmd/eventserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (m *EventProbeManager) CreateProbe(config ProbeConfig) (probe.EventProbe, e
}

func (m *EventProbeManager) StartProbe(ctx context.Context, probe probe.EventProbe) error {
log.Infof("start event probe %s", probe.Name())
return probe.Start(ctx)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/exporter/probe/procio/procio.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
)

const (
IOReadSyscall = "ioreadsyscall"
IOWriteSyscall = "iowritesyscall"
IOReadBytes = "ioreadbytes"
IOWriteBytes = "iowritebytes"
IOReadSyscall = "readsyscall"
IOWriteSyscall = "writesyscall"
IOReadBytes = "readbytes"
IOWriteBytes = "writebytes"

probeName = "io" // nolint
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/exporter/probe/tracekernel/tracekernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const (
HOOK_IPOUTPUT = "ip_output"
HOOK_IPOUTPUTFIN = "ip_finish_output2"

RXKERNEL_SLOW_METRIC = "kernellatency_rxslow"
TXKERNEL_SLOW_METRIC = "kernellatency_txslow"
RXKERNEL_SLOW100MS_METRIC = "kernellatency_rxslow100ms"
TXKERNEL_SLOW100MS_METRIC = "kernellatency_txslow100ms"
RXKERNEL_SLOW_METRIC = "rxslow"
TXKERNEL_SLOW_METRIC = "txslow"
RXKERNEL_SLOW100MS_METRIC = "rxslow100ms"
TXKERNEL_SLOW100MS_METRIC = "txslow100ms"

probeTypeEvent = 0
probeTypeMetrics = 1
Expand Down
4 changes: 2 additions & 2 deletions pkg/exporter/probe/tracenetiftxlatency/tracenetiftxlatency.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
//
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -cflags $BPF_CFLAGS -type insp_nftxlat_event_t -type insp_nftxlat_metric_t bpf ../../../../bpf/netiftxlatency.c -- -I../../../../bpf/headers -D__TARGET_ARCH_x86
const (
TXLAT_QDISC_SLOW = "netiftxlat_qdiscslow100ms"
TXLAT_NETDEV_SLOW = "netiftxlat_netdevslow100ms"
TXLAT_QDISC_SLOW = "qdiscslow100ms"
TXLAT_NETDEV_SLOW = "netdevslow100ms"
)

var (
Expand Down
12 changes: 7 additions & 5 deletions pkg/exporter/probe/tracenetsoftirq/tracenetsoftirq.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ import (

//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -cflags $BPF_CFLAGS -type insp_softirq_event_t bpf ../../../../bpf/net_softirq.c -- -I../../../../bpf/headers -D__TARGET_ARCH_x86
const (
NETSOFTIRQ_SCHED_SLOW = "net_softirq_schedslow" //nolint
NETSOFTIRQ_SCHED_100MS = "net_softirq_schedslow100ms" //nolint
NETSOFTIRQ_EXCUTE_SLOW = "net_softirq_excuteslow" //nolint
NETSOFTIRQ_EXCUTE_100MS = "net_softirq_excuteslow100ms" //nolint
NETSOFTIRQ_SCHED_SLOW = "schedslow" //nolint
NETSOFTIRQ_SCHED_100MS = "schedslow100ms" //nolint
NETSOFTIRQ_EXCUTE_SLOW = "excuteslow" //nolint
NETSOFTIRQ_EXCUTE_100MS = "excuteslow100ms" //nolint
)

var (
metrics = []string{NETSOFTIRQ_SCHED_SLOW, NETSOFTIRQ_SCHED_100MS, NETSOFTIRQ_EXCUTE_SLOW, NETSOFTIRQ_EXCUTE_100MS}
probeName = "netsoftirq"
_netSoftirqProbe = &netSoftirqProbe{}
_netSoftirqProbe = &netSoftirqProbe{
metricsMap: make(map[string]map[uint32]uint64),
}
)

func init() {
Expand Down
22 changes: 11 additions & 11 deletions pkg/exporter/probe/tracepacketloss/packetloss.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ func (p *packetLossProbe) start(ctx context.Context, probeType probe.Type) (err
_ = p.cleanup()
return
}
}

if p.refcnt[probe.ProbeTypeEvent] == 1 {
p.perfReader, err = perf.NewReader(p.objs.bpfMaps.InspPlEvent, int(unsafe.Sizeof(bpfInspPlEventT{})))
if err != nil {
log.Errorf("%s error create perf reader, err: %v", probeName, err)
_ = p.stop(ctx, probeType)
return
}

go p.perfLoop()
if p.refcnt[probe.ProbeTypeEvent] == 1 {
p.perfReader, err = perf.NewReader(p.objs.bpfMaps.InspPlEvent, int(unsafe.Sizeof(bpfInspPlEventT{})))
if err != nil {
log.Errorf("%s error create perf reader, err: %v", probeName, err)
_ = p.stop(ctx, probeType)
return
}

go p.perfLoop()
}
return nil
}
Expand Down Expand Up @@ -343,9 +343,9 @@ func (p *packetLossProbe) perfLoop() {
strs = append(strs, sym.GetExpr())
}

stackStr := strings.Join(strs, " ")
stackStr := strings.Join(strs, "\n")

evt.Message = fmt.Sprintf("%s stacktrace:%s", tuple, stackStr)
evt.Message = fmt.Sprintf("%s\nstacktrace:\n%s", tuple, stackStr)

if p.sink != nil {
log.Debugf("%s sink event %s", probeName, util.ToJSONString(evt))
Expand Down
10 changes: 5 additions & 5 deletions pkg/exporter/probe/tracesocketlatency/socketlatency.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const (
SOCKETLAT_READSLOW = "SOCKETLAT_READSLOW"
SOCKETLAT_SENDSLOW = "SOCKETLAT_SENDSLOW"

READ100MS = "socketlatencyread100ms"
READ300MS = "socketlatencyread300ms"
READ1MS = "socketlatencyread1ms"
WRITE100MS = "socketlatencywrite100ms"
WRITE1MS = "socketlatencywrite1ms"
READ100MS = "read100ms"
READ300MS = "read300ms"
READ1MS = "read1ms"
WRITE100MS = "write100ms"
WRITE1MS = "write1ms"

/*
#define ACTION_READ 1
Expand Down
10 changes: 6 additions & 4 deletions pkg/exporter/probe/tracevirtcmdlat/tracevirtcmdlat.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ import (
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -cflags $BPF_CFLAGS -type insp_virtcmdlat_event_t bpf ../../../../bpf/virtcmdlatency.c -- -I../../../../bpf/headers -D__TARGET_ARCH_x86

const (
VIRTCMD100MS = "virtcmdlatency100ms"
VIRTCMD = "virtcmdlatency"
VIRTCMD100MS = "latency100ms"
VIRTCMD = "latency"
VIRTCMDEXCUTE = "VIRTCMDEXCUTE"

fn = "virtnet_send_command"
probeName = "virtcmdLatency"
probeName = "virtcmdlatency"
)

var (
metrics = []string{VIRTCMD100MS, VIRTCMD}
_virtcmdLatencyProbe = &virtcmdLatencyProbe{}
_virtcmdLatencyProbe = &virtcmdLatencyProbe{
metricsMap: make(map[string]map[uint32]uint64),
}
)

func init() {
Expand Down

0 comments on commit 5971379

Please sign in to comment.