Skip to content

Commit 9a1beab

Browse files
authored
support pprof cli feature (#226)
1 parent 3b675df commit 9a1beab

File tree

18 files changed

+585
-4
lines changed

18 files changed

+585
-4
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Release Notes.
1515
* Add the `trace-v2 list` command for adapt the new trace query API by @mrproliu in https://github.com/apache/skywalking-cli/pull/225
1616
* Add the duration field in the `trace list` command by @mrproliu in https://github.com/apache/skywalking-cli/pull/225
1717
* Remove the oldest `queryTraceFromColdStage` query call in the `trace list` command by @mrproliu in https://github.com/apache/skywalking-cli/pull/225
18+
* Add the sub-command `profiling pprof` for pprof query API by @JophieQu in https://github.com/apache/skywalking-cli/pull/226
1819

1920
### Bug Fixes
2021

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Licensed to Apache Software Foundation (ASF) under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Apache Software Foundation (ASF) licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
mutation ($condition: PprofTaskCreationRequest!) {
19+
result: createPprofTask(pprofTaskCreationRequest: $condition) {
20+
errorReason
21+
code
22+
id
23+
}
24+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to Apache Software Foundation (ASF) under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Apache Software Foundation (ASF) licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
query ($condition: PprofAnalyzationRequest!) {
19+
result: queryPprofAnalyze(request: $condition) {
20+
tree {
21+
elements {
22+
id
23+
parentId
24+
codeSignature
25+
total
26+
self
27+
}
28+
}
29+
}
30+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Licensed to Apache Software Foundation (ASF) under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Apache Software Foundation (ASF) licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
query ($condition: PprofTaskListRequest!) {
19+
result: queryPprofTaskList(request: $condition) {
20+
errorReason
21+
tasks {
22+
serviceId
23+
serviceInstanceIds
24+
createTime
25+
events
26+
duration
27+
dumpPeriod
28+
id
29+
}
30+
}
31+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Licensed to Apache Software Foundation (ASF) under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Apache Software Foundation (ASF) licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
query ($taskId: String!){
19+
result: queryPprofTaskProgress(taskId: $taskId) {
20+
errorInstanceIds
21+
successInstanceIds
22+
logs {
23+
id
24+
instanceId
25+
instanceName
26+
operationType
27+
operationTime
28+
}
29+
}
30+
}

dist/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ The text of each license is also included at licenses/license-[project].txt.
213213
sigs.k8s.io/controller-runtime v0.20.4 Apache-2.0
214214
sigs.k8s.io/randfill v1.0.0 Apache-2.0
215215
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 Apache-2.0
216-
skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc Apache-2.0
216+
skywalking.apache.org/repo/goapi v0.0.0-20251011100214-efff910f2031 Apache-2.0
217217

218218
========================================================================
219219
Apache-2.0 and BSD-3-Clause licenses

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
gopkg.in/yaml.v2 v2.4.0
1919
k8s.io/apimachinery v0.33.1
2020
sigs.k8s.io/controller-runtime v0.20.4
21-
skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc
21+
skywalking.apache.org/repo/goapi v0.0.0-20251011100214-efff910f2031
2222
)
2323

2424
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,5 +543,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxg
543543
sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
544544
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
545545
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
546-
skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc h1:HhlLDl0aOIgiIdJl9p0a7PHHdZbs9epKEnewB7AWdZs=
547-
skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc/go.mod h1:Vj9vINJYsTQASPsbQ1i81YgH8nFC/Xds4GjcXvmRYwM=
546+
skywalking.apache.org/repo/goapi v0.0.0-20251011100214-efff910f2031 h1:iMd6gzltWrWOtV3COm0mWydeXhpy7r1vkNlTsm7Co0g=
547+
skywalking.apache.org/repo/goapi v0.0.0-20251011100214-efff910f2031/go.mod h1:Vj9vINJYsTQASPsbQ1i81YgH8nFC/Xds4GjcXvmRYwM=

internal/commands/interceptor/instance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func parseInstanceList(required bool, idListFlagName, nameListFlagName, serviceI
106106

107107
if idsArg == "" && namesArgs == "" {
108108
if required {
109+
_ = cli.ShowSubcommandHelp(ctx)
109110
return fmt.Errorf(`either flags "--%s" or "--%s" must be given`, idListFlagName, nameListFlagName)
110111
}
111112
return nil

internal/commands/interceptor/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func parseService(required bool, idFlagName, nameFlagName string, nodeType nodeT
7474

7575
if id == "" && name == "" {
7676
if required {
77+
_ = cli.ShowSubcommandHelp(ctx)
7778
return fmt.Errorf(`either flags "--%s" or "--%s" must be given`, idFlagName, nameFlagName)
7879
}
7980
return nil

0 commit comments

Comments
 (0)