Skip to content

Commit 4952936

Browse files
authored
Fix profiling issue and add logs (#38)
1 parent 271e2cd commit 4952936

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ Release Notes.
88
* Support `OFF_CPU` Profiling.
99
* Introduce the `BTFHub` module.
1010
* Update to using frequency mode to `ON_CPU` Profiling.
11+
* Add logs in the profiling module logical.
1112

1213
#### Bug Fixes
14+
* Fix `docker` based process could not be detected.
1315

1416
#### Issues and PR
1517
- All issues are [here](https://github.com/apache/skywalking/milestone/134?closed=1)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Apache SkyWalking Rover
1313

1414
# Download
1515

16+
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.
17+
1618
# Contact Us
1719
* Mail list: **[email protected]**. Mail to `[email protected]`, follow the reply to subscribe the mail list.
1820
* 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).

pkg/process/finders/kubernetes/container.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func (c *PodContainer) CGroupID() string {
6969
// delete the container runtime prefix is the cgroupid
7070
cgroupID = strings.TrimPrefix(cgroupID, "containerd://")
7171
cgroupID = strings.TrimPrefix(cgroupID, "dockerd://")
72+
cgroupID = strings.TrimPrefix(cgroupID, "docker://")
7273
return cgroupID
7374
}
7475

pkg/profiling/task/manager.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ func (m *Manager) StartTask(c *Context) {
9898
// shutdown task if exists
9999
taskIdentity := c.BuildTaskIdentity()
100100
if m.tasks[taskIdentity] != nil {
101+
id := m.tasks[taskIdentity].TaskID()
102+
log.Infof("existing profiling task: %s, so need to stop it", id)
101103
if err := m.shutdownAndRemoveTask(m.tasks[taskIdentity]); err != nil {
102104
log.Warnf("shutdown existing profiling task failure, so cannot to start new profiling task: %v. reason: %v", c.task.TaskID, err)
103105
return
@@ -118,6 +120,7 @@ func (m *Manager) StartTask(c *Context) {
118120
go func() {
119121
select {
120122
case <-time.After(afterRun):
123+
log.Infof("the profiling task need to wait %fmin to run: %s", afterRun.Minutes(), c.TaskID())
121124
m.runTask(c)
122125
case <-c.ctx.Done():
123126
return
@@ -126,6 +129,7 @@ func (m *Manager) StartTask(c *Context) {
126129
}
127130

128131
func (m *Manager) runTask(c *Context) {
132+
log.Infof("ready to starting profiling task: %s", c.TaskID())
129133
var wg sync.WaitGroup
130134
wg.Add(1)
131135
c.runningWg = &wg
@@ -148,7 +152,7 @@ func (m *Manager) runTask(c *Context) {
148152
}
149153

150154
func (m *Manager) afterProfilingStartSuccess(c *Context) {
151-
log.Infof("starting the profiling task. taskId: %s, pid: %d", c.task.TaskID, c.process.Pid())
155+
log.Infof("profiling task has been started. taskId: %s, pid: %d", c.task.TaskID, c.process.Pid())
152156
go func() {
153157
select {
154158
// shutdown task when arrived task running task
@@ -223,6 +227,7 @@ func (m *Manager) flushProfilingData() error {
223227
return err
224228
}
225229
currentMilli := time.Now().UnixMilli()
230+
totalSendCount := make(map[string]int)
226231
for _, t := range m.tasks {
227232
data, err1 := t.runner.FlushData()
228233
if err1 != nil {
@@ -234,6 +239,7 @@ func (m *Manager) flushProfilingData() error {
234239
continue
235240
}
236241

242+
totalSendCount[t.TaskID()] += len(data)
237243
// only the first data have task metadata
238244
data[0].Task = &profiling_v3.EBPFProfilingTaskMetadata{
239245
TaskId: t.task.TaskID,
@@ -250,6 +256,7 @@ func (m *Manager) flushProfilingData() error {
250256
}
251257
}
252258

259+
log.Infof("send profiling data summary: %v", totalSendCount)
253260
_, err = stream.CloseAndRecv()
254261
return err
255262
}

pkg/profiling/task/oncpu/runner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ func (r *Runner) Stop() error {
197197
result = multierror.Append(result, err)
198198
}
199199
}
200+
201+
close(r.stopChan)
200202
})
201203
return result
202204
}

0 commit comments

Comments
 (0)