Fix profiling issue and add logs (#38)
diff --git a/CHANGES.md b/CHANGES.md
index 858b912..f9f418b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,8 +8,10 @@
* 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 @@
# 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: **dev@skywalking.apache.org**. Mail to `dev-subscribe@skywalking.apache.org`, 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 @@
// 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 @@
// 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 @@
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) 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) 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 @@
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 @@
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 @@
}
}
+ 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 @@
result = multierror.Append(result, err)
}
}
+
+ close(r.stopChan)
})
return result
}