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

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


The following commit(s) were added to refs/heads/main by this push:
     new 4952936  Fix profiling issue and add logs (#38)
4952936 is described below

commit 49529367b9efce580852294603f1f7dac28622a3
Author: mrproliu <[email protected]>
AuthorDate: Wed Jun 1 17:00:16 2022 +0800

    Fix profiling issue and add logs (#38)
---
 CHANGES.md                                  | 2 ++
 README.md                                   | 2 ++
 pkg/process/finders/kubernetes/container.go | 1 +
 pkg/profiling/task/manager.go               | 9 ++++++++-
 pkg/profiling/task/oncpu/runner.go          | 2 ++
 5 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 858b912..f9f418b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,8 +8,10 @@ Release Notes.
 * Support `OFF_CPU` Profiling.
 * Introduce the `BTFHub` module.
 * Update to using frequency mode to `ON_CPU` Profiling.
+* Add logs in the profiling module logical.
 
 #### Bug Fixes
+* Fix `docker` based process could not be detected.
 
 #### Issues and PR
 - All issues are 
[here](https://github.com/apache/skywalking/milestone/134?closed=1)
diff --git a/README.md b/README.md
index 3456657..9a15dcd 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@ Apache SkyWalking Rover
 
 # Download
 
+Follow the [releases 
page](https://skywalking.apache.org/downloads/#SkyWalkingRover) or [docker 
image](https://hub.docker.com/r/apache/skywalking-rover) to download a release 
of Apache SkyWalking Rover.
+
 # Contact Us
 * Mail list: **[email protected]**. Mail to 
`[email protected]`, follow the reply to subscribe the mail 
list.
 * Join `skywalking` channel at [Apache 
Slack](http://s.apache.org/slack-invite). If the link is not working, find the 
latest one at [Apache INFRA 
WIKI](https://cwiki.apache.org/confluence/display/INFRA/Slack+Guest+Invites).
diff --git a/pkg/process/finders/kubernetes/container.go 
b/pkg/process/finders/kubernetes/container.go
index c2a3a62..94dabb3 100644
--- a/pkg/process/finders/kubernetes/container.go
+++ b/pkg/process/finders/kubernetes/container.go
@@ -69,6 +69,7 @@ func (c *PodContainer) CGroupID() string {
        // delete the container runtime prefix is the cgroupid
        cgroupID = strings.TrimPrefix(cgroupID, "containerd://")
        cgroupID = strings.TrimPrefix(cgroupID, "dockerd://")
+       cgroupID = strings.TrimPrefix(cgroupID, "docker://")
        return cgroupID
 }
 
diff --git a/pkg/profiling/task/manager.go b/pkg/profiling/task/manager.go
index 8057870..5af4b30 100644
--- a/pkg/profiling/task/manager.go
+++ b/pkg/profiling/task/manager.go
@@ -98,6 +98,8 @@ func (m *Manager) StartTask(c *Context) {
        // shutdown task if exists
        taskIdentity := c.BuildTaskIdentity()
        if m.tasks[taskIdentity] != nil {
+               id := m.tasks[taskIdentity].TaskID()
+               log.Infof("existing profiling task: %s, so need to stop it", id)
                if err := m.shutdownAndRemoveTask(m.tasks[taskIdentity]); err 
!= nil {
                        log.Warnf("shutdown existing profiling task failure, so 
cannot to start new profiling task: %v. reason: %v", c.task.TaskID, err)
                        return
@@ -118,6 +120,7 @@ func (m *Manager) StartTask(c *Context) {
        go func() {
                select {
                case <-time.After(afterRun):
+                       log.Infof("the profiling task need to wait %fmin to 
run: %s", afterRun.Minutes(), c.TaskID())
                        m.runTask(c)
                case <-c.ctx.Done():
                        return
@@ -126,6 +129,7 @@ func (m *Manager) StartTask(c *Context) {
 }
 
 func (m *Manager) runTask(c *Context) {
+       log.Infof("ready to starting profiling task: %s", c.TaskID())
        var wg sync.WaitGroup
        wg.Add(1)
        c.runningWg = &wg
@@ -148,7 +152,7 @@ func (m *Manager) runTask(c *Context) {
 }
 
 func (m *Manager) afterProfilingStartSuccess(c *Context) {
-       log.Infof("starting the profiling task. taskId: %s, pid: %d", 
c.task.TaskID, c.process.Pid())
+       log.Infof("profiling task has been started. taskId: %s, pid: %d", 
c.task.TaskID, c.process.Pid())
        go func() {
                select {
                // shutdown task when arrived task running task
@@ -223,6 +227,7 @@ func (m *Manager) flushProfilingData() error {
                return err
        }
        currentMilli := time.Now().UnixMilli()
+       totalSendCount := make(map[string]int)
        for _, t := range m.tasks {
                data, err1 := t.runner.FlushData()
                if err1 != nil {
@@ -234,6 +239,7 @@ func (m *Manager) flushProfilingData() error {
                        continue
                }
 
+               totalSendCount[t.TaskID()] += len(data)
                // only the first data have task metadata
                data[0].Task = &profiling_v3.EBPFProfilingTaskMetadata{
                        TaskId:             t.task.TaskID,
@@ -250,6 +256,7 @@ func (m *Manager) flushProfilingData() error {
                }
        }
 
+       log.Infof("send profiling data summary: %v", totalSendCount)
        _, err = stream.CloseAndRecv()
        return err
 }
diff --git a/pkg/profiling/task/oncpu/runner.go 
b/pkg/profiling/task/oncpu/runner.go
index 8051ce6..4f490bc 100644
--- a/pkg/profiling/task/oncpu/runner.go
+++ b/pkg/profiling/task/oncpu/runner.go
@@ -197,6 +197,8 @@ func (r *Runner) Stop() error {
                                result = multierror.Append(result, err)
                        }
                }
+
+               close(r.stopChan)
        })
        return result
 }

Reply via email to