81 Commits

Author SHA1 Message Date
hengyoush
a57788406f feat(protocol): support dns protocol 2025-04-10 10:30:04 +08:00
AvaIon
8b8fe640b7 feat: Support MongoDB protocol (#275)
* The preliminary parsing of the MongoDB protocol has been completed, but there are still issues such as incorrect end times.

* Mongodb Unit test done

* The preliminary parsing of the MongoDB protocol has been completed, but there are still issues such as incorrect end times.

* Mongodb Unit test done

* feat: support mongo

* fix: install mongsh failed

* fix: install mongodb shell

---------

Signed-off-by: 烈香 <hengyoush1@163.com>
Co-authored-by: xiaoweihao <xiaoweihao@tp-link.com.hk>
Co-authored-by: 烈香 <hengyoush1@163.com>
2025-02-27 22:29:55 +08:00
烈香
1512bf36f5 fix: fix wrong param name (#296) 2025-02-25 20:30:26 +08:00
hengyoush
8ca51dbc38 feat: add "max-allow-stuck-time-mills option 2025-01-31 14:04:18 +08:00
烈香
1bf214922d feat: add options to control whether trace dev/socket/ssl events (#277)
* feat: add options to control whether trace dev/socket/ssl events

* refactor: adjust watch render
2025-01-26 17:49:20 +08:00
烈香
782e138667 feat: add an option to control whether to start gops for purpose of debugging (#276) 2025-01-24 11:17:48 +08:00
hengyoush
06c7267c61 feat(protocol): support filter by apikeys and topic
fix: fix test

fix: fix test
2025-01-19 21:34:11 +08:00
hengyoush
31b3410598 feat: support kafka protocol
fix(bpf): fix stack size limit exceeded

fix(bpf): fix stack size limit exceeded

fix(bpf): fix stack size limit exceeded

fix(bpf): fix stack size limit exceeded
2025-01-19 21:34:11 +08:00
Laitron
6653fef907 feat: new version detection (#256) 2025-01-08 14:43:29 +08:00
烈香
3f6a44c753 feat: support for parsing ipip packet (#257)
* feat: support for parsing ipip packet

    This PR introduces a new feature for parsing IPIP packets and correctly associating them.

    Additionally, this PR improves the current logic in processor.go to prevent the incorrect association of syscall and kernel events. When new events arrive, they are first enqueued and then processed only if they have been in the queue longer than a specified time limit. This is necessary because when many short connections use the same tgid-fd, syscall and kernel events may arrive asynchronously in user space. As a result, events from a new connection might reach user space before the connection event itself, causing the new connection's events to be incorrectly associated with the old connection and leading to erroneous time calculations.

  And to ensure that the total time calculation is not negative, the syscall event will report the syscall start time and the syscall duration. By adding the start time and the duration, we can determine the end time. This way, when calculating the client's elapsed time, we can subtract the start time of the write syscall from the end time of the read syscall.

  Additionally, to ensure that DEV_IN and TCP_IN events are present when the server receives the first request, the concept of a first packet event is introduced. Even if the kernel does not find conn_info or other information when reporting the event, as long as its seq=1, it will be considered a first packet. This allows it to be directly reported to user space. In user space, the connection is found based on its sock key, and then it is converted into a kernevent for processing. This way, even for the server's first request, we can see the total time and read from socket time.

* fix: remove bpf_printk statements

* feat: add first-packet-event-map-page-num option

* refactor: translate comments to english
2025-01-08 12:38:35 +08:00
xmchx
8ff2696e1d feat: support rocketMQ (#231)
feat: support rocketMQ

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
Co-authored-by: Spencer Cai <spencercjh@gmail.com>
Co-authored-by: 烈香 <hengyoush1@163.com>
2025-01-07 19:42:33 +08:00
mannkafai
141c810edd user: add command-line options to set perf event buffer size (#247)
* user: add command-line  options to set perf event buffer size

add  `syscall-mapsize` , `ssl-mapsize`, `conn-mapsize`,  `kern-mapsize` command-line options to set `pageNum` of  `PullSyscallDataEvents`, `PullSslDataEvents`, `PullConnDataEvents` and `PullKernEvents`.

* user: add command-line options to set pageNum of perf event buffer

add `syscall-perf-event-map-page-num`, `ssl-perf-event-map-page-num`, `conn-perf-event-map-page-num`, `kern-perf-event-map-page-num` command-line options to set pageNum of `SyscallDataEvents`, `SslDataEvents`, `ConnDataEvents` and `KernEvents`.

* mark `*-perf-event-map-page-num` options  hidden
2025-01-05 18:22:23 +08:00
AS!
1c0dd7288a feat: Add json-output params to watch command (#235)
* feat: Add json-output params to watch command

* docs: modify some field explain

* docs: modify column name
2025-01-02 18:46:46 +08:00
Spencer Cai
041e8ac286 feat: introduce version cmd (#234)
* feat: add more ldflags to the goreleaser cfg for version cmd

Signed-off-by: spencercjh <spencercjh@gmail.com>

* docs: add comments

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-31 17:46:49 +08:00
Spencer Cai
d22c466db2 feat: Introduce more flags to filter HTTP records (#220)
* feat: introduce path-regex and path-prefix to sub cmd http

Signed-off-by: spencercjh <spencercjh@gmail.com>

* style: reformat with goimports

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: save FilterByRequest's result as HttpFilter's field

Signed-off-by: spencercjh <spencercjh@gmail.com>

* docs: update docs about HttpFilter

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-27 11:34:55 +08:00
烈香
7a4c410d28 fix(stat): elapsed time is negative (#213)
* fix(stat): elapsed time is negative

introduce a new option `conntrack-close-wait-time-mills` which control how long time before a
connection turn into `closed` state. If too long, new connection with same tgidfd 's data may come
into old connection  event stream or syscall data buffer. Set it  to a relatively small value  will
prevent  this situation.

* fix: add missing argument
2024-12-25 03:11:42 +08:00
hengyoush
453260e885 fix(cli): when executing a currently unsupported protocol, an error is returned directly 2024-12-11 23:14:40 +08:00
hengyoush
a4613ced1f feat(filter): support filter traffic by process name 2024-12-11 01:14:19 +08:00
hengyoush
680122662a refactor(cli): change stat fast mode option to not wait 10s 2024-11-12 13:58:25 +08:00
hengyoush
fc081156a6 refactor: optimize help message 2024-11-09 22:18:33 +08:00
hengyoush
fbc88bccad feat(loader): add performance-mode option can skip non critical step when attach failed 2024-11-01 22:38:14 +08:00
hengyoush
7d28c02c11 refactor(cli): adjust cmd line help message 2024-10-28 10:46:25 +08:00
hengyoush
359276c854 fix: set log to file after bpf load success 2024-10-26 15:59:43 +08:00
hengyoush
e6ca66873c feat(cli): add stat metrics option long metric name 2024-10-26 14:59:59 +08:00
hengyoush
6af8160243 feat(cli): add --max-records option to limit max records number of watch table 2024-10-26 11:50:45 +08:00
hengyoush
dd65879b40 feat(cli): add max-print-bytes" option to control watch record print max bytes 2024-10-23 12:55:35 +08:00
hengyoush
972f2cdc39 feat(cli): add time option to specify time 2024-10-22 21:59:22 +08:00
hengyoush
c768cb5124 feat(cli): add overview subcommand to overview the dependencies like mysql/redis/ in one cmd line 2024-10-22 21:58:49 +08:00
hengyoush
6273b28b19 feat(cli): support specify two level group-by options 2024-10-22 21:58:36 +08:00
烈香
b158ff423e feat(ci): add e2e test workflow and goreleaser integration (#60)
* support watch record print to console

* support watch record print to console

* fix. fix npe issue

* fix. fix pid filter not works

* feat. support filter pid for forked child proc

* test. add some e2e tests

* test. add test workflow

* update btf file & print more info when find btf file failed

* fix. fix test issue

* fix. fix test issue

* fix. fix test issue

* test. add Test filter by l3/l4 info to e2e test

* test. add install dig command before test

* test. use /sys/kernel/btf/vmlinux as default btf

* test. fix workflow bug

* test. fix workflow bug

* test. fix workflow bug

* test. fix workflow issue

* test. fix workflow issue

* test. uncomment testdata/run_e2e.sh

* test. uncomment testdata/run_e2e.sh

* test. add test docker filter by container id

* test. uncomment testdata/run_e2e.sh

* test. add Test filter by pid

* test. add log options

* test. add log options

* ci. add go release config

* ci. fix ci config bug

* ci. fix ci config bug

* ci. fix ci config bug

* ci. fix ci config bug

* ci. fix ci config bug

* ci. fix ci config bug

* ci. fix ci config bug

* ci. fix bug

* test. add some log

---------

Co-authored-by: root <root@kind-4.19>
2024-10-19 23:21:41 +08:00
hengyoush
fd890bed67 [Feature] support batch model 2024-10-14 15:07:32 +08:00
hengyoush
ca7876643a [Feature] Visualize watch record time detail 2024-10-13 19:00:21 +08:00
hengyoush
845b57a6ec [Feature] Beautify stat command 2024-10-13 15:09:48 +08:00
hengyoush
97459fb376 [Feature] beautify watch command 2024-10-12 04:28:41 +08:00
hengyoush
70c53b0dfe feat. beautify watch command 2024-10-11 21:21:57 +08:00
hengyoush
068e84b99f [Improvement] code refactor: extract bpf load logic from agent mod to loader mod 2024-10-07 17:03:44 +08:00
hengyoush
5cadefaf98 [Feature] Support filter by container-id & container-name & pod name 2024-10-03 17:48:33 +08:00
hengyoush
6319ea6fe1 [Feature] Openssl Support 2024-09-30 23:40:14 +08:00
hengyoush
c4ff3fa1ea [Improvement] Optimize cmdline output 2024-09-16 23:55:56 +08:00
hengyoush
8bf9dc3b92 [Fix] fix local to local connection issue 2024-09-15 22:42:48 +08:00
hengyoush
64cc0fff7d [Improvement] Support setting different log levels for different modules. 2024-09-15 12:07:08 +08:00
hengyoush
0f231f8b92 [Improvement] Add perf event size cmd option 2024-09-14 17:15:11 +08:00
hengyoush
775a8a0e5c [Feature] support use btfhub to improve portablity 2024-09-13 00:43:20 +08:00
hengyoush
24ef0490f3 [Feature] Add verify file log size option 2024-09-11 22:21:01 +08:00
烈香
02db5a9015 Improve portability (#30)
1. Reduced the number of loop iterations.
2. Added support for loading external BTF files.
3. Added unroll pragma to the for loop.
4. Temporarily removed raw tracepoints.
5. Cast `ctx` to `void*` first when accessing variables from tracepoints (due to the absence of the `ctx` type in the 3.10 BTF file).
6. Replaced syscalls like `sendmsg` and `recvmsg` with a custom `user_msghdr` (due to the absence of the `user_msghdr` type in the 3.10 BTF file).
7. Modified some system calls from using kprobe to tracepoint/syscalls.
8. Fixed issues with `__skb_datagram_iter` and `__ip_queue_xmit` not being found in the 3.10 kernel.
2024-09-11 02:03:28 +08:00
hengyoush
9da2322c66 [Doc] Update Readme.md 2024-09-09 01:16:53 +08:00
hengyoush
6019ef49d0 [Improvement] make compatible flags as PersistentFlags 2024-09-08 12:21:00 +08:00
hengyoush
1b7f2ce3ad [Feature] Support specify xdp interface name 2024-09-08 11:45:49 +08:00
hengyoush
47c0d3a3ea [Feature] Add Flag --full-body to control whether print record body 2024-09-07 23:02:23 +08:00
hengyoush
2c4d74cbc4 [Feature] Support sort by some latency metric at stat command 2024-09-07 22:57:21 +08:00