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 41e0ad4 cache ip more time
41e0ad4 is described below
commit 41e0ad4277782946e81b0e6a3718a874bb2ad8ac
Author: mrproliu <[email protected]>
AuthorDate: Sat Dec 28 18:19:57 2024 +0800
cache ip more time
---
pkg/accesslog/common/connection.go | 17 ++++++++---------
pkg/tools/ip/conntrack.go | 2 +-
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/pkg/accesslog/common/connection.go
b/pkg/accesslog/common/connection.go
index cbcb925..ca185ff 100644
--- a/pkg/accesslog/common/connection.go
+++ b/pkg/accesslog/common/connection.go
@@ -265,12 +265,6 @@ func (c *ConnectionManager) Find(event events.Event)
*ConnectionInfo {
}
// is current is connected event, then getting the socket pair
if e, socket := getSocketPairFromConnectEvent(event); e != nil &&
socket != nil {
- // if the remote connection is need to use conntrack, then
update the real peer address
- if socket.NeedConnTrack {
- if err :=
c.ConnectTracker.UpdateRealPeerAddress(socket, false); err != nil {
- log.Warnf("cannot update the real peer address,
%v", err)
- }
- }
var localAddress, remoteAddress *v3.ConnectionAddress
localPID, _ := events.ParseConnectionID(event.GetConnectionID())
localAddress = c.buildLocalAddress(localPID, socket.SrcPort,
socket)
@@ -518,11 +512,16 @@ func (c *ConnectionManager) OnConnectEvent(event
*events.SocketConnectEvent, pai
}
func (c *ConnectionManager) isLocalTarget(pair *ip.SocketPair)
addressProcessType {
- destIP := pair.DestIP
- if tools.IsLocalHostAddress(destIP) {
+ if tools.IsLocalHostAddress(pair.DestIP) {
return addressProcessTypeLocal
}
- if _, exist := c.localIPWithPid[destIP]; exist {
+ // if the remote connection is need to use conntrack, then update the
real peer address
+ if pair.NeedConnTrack {
+ if err := c.ConnectTracker.UpdateRealPeerAddress(pair, false);
err != nil {
+ log.Debugf("cannot update the real peer address, %v",
err)
+ }
+ }
+ if _, exist := c.localIPWithPid[pair.DestIP]; exist {
return addressProcessTypeKubernetes
}
return addressProcessTypeUnknown
diff --git a/pkg/tools/ip/conntrack.go b/pkg/tools/ip/conntrack.go
index 99a453a..69d25a1 100644
--- a/pkg/tools/ip/conntrack.go
+++ b/pkg/tools/ip/conntrack.go
@@ -205,7 +205,7 @@ func (c *ConnTrack) UpdateRealPeerAddress(addr *SocketPair,
fromCacheOnly bool)
if err != nil {
return err
}
- log.Infof("update real peer address from conntrack: %s:%d",
get.TupleReply.IP.SourceAddress.String(), get.TupleReply.Proto.SourcePort)
+ log.Debugf("update real peer address from conntrack: %s:%d",
get.TupleReply.IP.SourceAddress.String(), get.TupleReply.Proto.SourcePort)
addr.DestIP = get.TupleReply.IP.SourceAddress.String()
addr.DestPort = get.TupleReply.Proto.SourcePort