This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch reduce-handle-connect-time
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/reduce-handle-connect-time by 
this push:
     new 1dd3b39  add conntrack new probes
1dd3b39 is described below

commit 1dd3b39deace6946ba84ab1838935dd94fd853e7
Author: mrproliu <[email protected]>
AuthorDate: Fri Dec 27 22:20:31 2024 +0800

    add conntrack new probes
---
 pkg/tools/ip/conntrack.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/pkg/tools/ip/conntrack.go b/pkg/tools/ip/conntrack.go
index 2ba0fb6..b9a35ad 100644
--- a/pkg/tools/ip/conntrack.go
+++ b/pkg/tools/ip/conntrack.go
@@ -49,10 +49,13 @@ func NewConnTrack() (*ConnTrack, error) {
                return nil, err
        }
        go func() {
-               nfct.RegisterFiltered(context.Background(), 
conntrack.Conntrack, conntrack.NetlinkCtNew|conntrack.NetlinkCtUpdate, nil, 
func(event conntrack.Con) int {
-                       log.Infof("conntrack event: %+v", event)
-                       return 0
-               })
+               nfct.RegisterFiltered(context.Background(), conntrack.Conntrack,
+                       
conntrack.NetlinkCtNew|conntrack.NetlinkCtUpdate|conntrack.NetlinkCtExpectedNew|conntrack.NetlinkCtExpectedUpdate,
 nil, func(event conntrack.Con) int {
+                               log.Infof("conntrack event: origin: 
%s:%d->%s:%d, reply: %s:%d->%s:%d",
+                                       event.Origin.Src.String(), 
event.Origin.Proto.SrcPort, event.Origin.Dst.String(), 
event.Origin.Proto.DstPort,
+                                       event.Reply.Src.String(), 
event.Reply.Proto.SrcPort, event.Reply.Dst.String(), event.Reply.Proto.DstPort)
+                               return 0
+                       })
        }()
        return &ConnTrack{tracker: nfct}, nil
 }
@@ -71,7 +74,7 @@ func (c *ConnTrack) UpdateRealPeerAddress(addr *SocketPair) 
bool {
                session, e := c.tracker.Get(conntrack.Conntrack, family, 
conntrack.Con{Origin: tuple})
                if e != nil {
                        // try to get the reply session, if the info not exists 
or from accept events, have error is normal
-                       log.Debugf("cannot get the conntrack session, type: %s, 
family: %d, origin src: %s:%d, origin dest: %s:%d, error: %v", info.name,
+                       log.Errorf("cannot get the conntrack session, type: %s, 
family: %d, origin src: %s:%d, origin dest: %s:%d, error: %v", info.name,
                                family, tuple.Src, *tuple.Proto.SrcPort, 
tuple.Dst, *tuple.Proto.DstPort, e)
                        continue
                }

Reply via email to