-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support eBPF profiling related commands (#138)
- Loading branch information
Showing
40 changed files
with
1,401 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
assets/graphqls/profiling/ebpf/CreateEBPFProfilingFixedTimeTask.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
# the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
mutation ($request: EBPFProfilingTaskFixedTimeCreationRequest!){ | ||
result: createEBPFProfilingFixedTimeTask(request: $request) { | ||
status | ||
id | ||
errorReason | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
assets/graphqls/profiling/ebpf/QueryEBPFProfilingScheduleList.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
# the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
query ($taskID: ID!, $duration: Duration!){ | ||
result: queryEBPFProfilingSchedules(taskId: $taskID, duration: $duration) { | ||
scheduleId | ||
taskId | ||
startTime | ||
endTime | ||
process { | ||
id | ||
name | ||
serviceId | ||
serviceName | ||
instanceId | ||
instanceName | ||
layer | ||
agentId | ||
detectType | ||
attributes { | ||
name | ||
value | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
assets/graphqls/profiling/ebpf/QueryEBPFProfilingTaskList.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
# the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
query ($query: EBPFProfilingTaskCondition){ | ||
result: queryEBPFProfilingTasks(query: $query) { | ||
taskId | ||
processFinderType | ||
serviceId | ||
serviceName | ||
instanceId | ||
instanceName | ||
processId | ||
processName | ||
taskStartTime | ||
triggerType | ||
fixedTriggerDuration | ||
targetType | ||
createTime | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
assets/graphqls/profiling/ebpf/QueryEBPFProflingAnalyzation.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
# the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
query ($taskID: ID!, $timeRanges: [EBPFProfilingAnalyzeTimeRange!]!){ | ||
result: getEBPFProfilingAnalyzation(taskId: $taskID, timeRanges: $timeRanges) { | ||
tip | ||
trees { | ||
elements { | ||
id | ||
parentId | ||
symbol | ||
stackType | ||
dumpCount | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package ebpf | ||
|
||
import ( | ||
"strconv" | ||
"strings" | ||
|
||
api "skywalking.apache.org/repo/goapi/query" | ||
|
||
"github.com/urfave/cli/v2" | ||
|
||
"github.com/apache/skywalking-cli/internal/flags" | ||
"github.com/apache/skywalking-cli/pkg/display" | ||
"github.com/apache/skywalking-cli/pkg/display/displayable" | ||
"github.com/apache/skywalking-cli/pkg/graphql/profiling" | ||
) | ||
|
||
var AnalyzationCommand = &cli.Command{ | ||
Name: "analysis", | ||
Aliases: []string{"as"}, | ||
Usage: `analyze ebpf profiling task`, | ||
UsageText: `This command analysis profiling task, via id of task and time ranges. | ||
Example: | ||
1. Analysis profiling tasks of task id "abc" and time range in 1648020042869 to 1648020100764. | ||
$ swctl profiling ebpf analysis --task-id=abc --time-ranges=1648020042869-1648020100764 | ||
`, | ||
Flags: flags.Flags( | ||
flags.DurationFlags, | ||
[]cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "task-id", | ||
Usage: "the `task-id` by which task are scheduled", | ||
Required: true, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "time-ranges", | ||
Usage: "need to analyze time ranges in the segment: start-end,start-end", | ||
}, | ||
}, | ||
), | ||
Action: func(ctx *cli.Context) error { | ||
taskID := ctx.String("task-id") | ||
|
||
timeRangeStr := ctx.String("time-ranges") | ||
var timeRanges []*api.EBPFProfilingAnalyzeTimeRange = nil | ||
if timeRangeStr != "" { | ||
tagArr := strings.Split(timeRangeStr, ",") | ||
for _, tag := range tagArr { | ||
kv := strings.Split(tag, "-") | ||
start, err := strconv.ParseInt(kv[0], 10, 64) | ||
if err != nil { | ||
return err | ||
} | ||
end, err := strconv.ParseInt(kv[1], 10, 64) | ||
if err != nil { | ||
return err | ||
} | ||
timeRanges = append(timeRanges, &api.EBPFProfilingAnalyzeTimeRange{Start: start, End: end}) | ||
} | ||
} | ||
|
||
analyzation, err := profiling.QueryEBPFProfilingAnalyzation(ctx, taskID, timeRanges) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return display.Display(ctx, &displayable.Displayable{Data: analyzation}) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package create | ||
|
||
import "github.com/urfave/cli/v2" | ||
|
||
var CreateCommand = &cli.Command{ | ||
Name: "create", | ||
Usage: "eBPF Profiling task create related sub-command", | ||
Subcommands: []*cli.Command{ | ||
FixedTimeCreateCommand, | ||
}, | ||
} |
Oops, something went wrong.