You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by li...@apache.org on 2025/06/23 10:42:56 UTC
(skywalking-rover) 01/01: Fix the ztunnel process id not setting to the BPF when process changed
This is an automated email from the ASF dual-hosted git repository.
liuhan pushed a commit to branch ztunnel-process-setting
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
commit 68e5caf8889705a3120651c5b7e56d8f47fa8ee9
Author: mrproliu <74...@qq.com>
AuthorDate: Mon Jun 23 18:42:41 2025 +0800
Fix the ztunnel process id not setting to the BPF when process changed
---
pkg/accesslog/collector/ztunnel.go | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/pkg/accesslog/collector/ztunnel.go b/pkg/accesslog/collector/ztunnel.go
index 550e2a9..be5c168 100644
--- a/pkg/accesslog/collector/ztunnel.go
+++ b/pkg/accesslog/collector/ztunnel.go
@@ -80,11 +80,6 @@ func (z *ZTunnelCollector) Start(_ *module.Manager, ctx *common.AccessLogContext
return nil
}
- // setting the ztunnel pid in the BPF
- if err = ctx.BPF.ZtunnelProcessPid.Set(z.collectingProcess.Pid); err != nil {
- return fmt.Errorf("failed to set ztunnel process pid: %v", err)
- }
-
ctx.BPF.ReadEventAsync(ctx.BPF.ZtunnelLbSocketMappingEventQueue, func(data interface{}) {
event := data.(*events.ZTunnelSocketMappingEvent)
localIP := z.convertBPFIPToString(event.OriginalSrcIP)
@@ -189,6 +184,7 @@ func (z *ZTunnelCollector) findZTunnelProcessAndCollect() error {
running, err := z.collectingProcess.IsRunning()
if err == nil && running {
// already collecting the process
+ log.Debugf("found the ztunnel process and collecting ztunnel data from pid: %d", z.collectingProcess.Pid)
return nil
}
log.Warnf("detected ztunnel process is not running, should re-scan process to find and collect it")
@@ -235,6 +231,11 @@ func (z *ZTunnelCollector) collectZTunnelProcess(p *process.Process) error {
uprobeFile := z.alc.BPF.OpenUProbeExeFile(pidExeFile)
uprobeFile.AddLink(trackBoundSymbol[0].Name, z.alc.BPF.ConnectionManagerTrackOutbound, nil)
+
+ // setting the ztunnel pid in the BPF
+ if err = z.alc.BPF.ZtunnelProcessPid.Set(p.Pid); err != nil {
+ return fmt.Errorf("failed to set ztunnel process pid in the BPF: %v", err)
+ }
return nil
}