diff --git a/.github/workflows/rover.yaml b/.github/workflows/rover.yaml index 8c32a294..342d86bb 100644 --- a/.github/workflows/rover.yaml +++ b/.github/workflows/rover.yaml @@ -75,14 +75,23 @@ jobs: fail-fast: false matrix: test: - - name: Golang Profiling - config: test/e2e/cases/profiling/golang/e2e.yaml - - name: C++ Profiling - config: test/e2e/cases/profiling/c++/e2e.yaml - - name: C Profiling - config: test/e2e/cases/profiling/c/e2e.yaml - - name: Rust Profiling - config: test/e2e/cases/profiling/rust/e2e.yaml + - name: Golang On CPU Profiling + config: test/e2e/cases/profiling/oncpu/golang/e2e.yaml + - name: C++ On CPU Profiling + config: test/e2e/cases/profiling/oncpu/c++/e2e.yaml + - name: C On CPU Profiling + config: test/e2e/cases/profiling/oncpu/c/e2e.yaml + - name: Rust On CPU Profiling + config: test/e2e/cases/profiling/oncpu/rust/e2e.yaml + + - name: Golang Off CPU Profiling + config: test/e2e/cases/profiling/offcpu/golang/e2e.yaml + - name: C++ Off CPU Profiling + config: test/e2e/cases/profiling/offcpu/c++/e2e.yaml + - name: C Off CPU Profiling + config: test/e2e/cases/profiling/offcpu/c/e2e.yaml + - name: Rust Off CPU Profiling + config: test/e2e/cases/profiling/offcpu/rust/e2e.yaml - name: go2sky Agent Sensor config: test/e2e/cases/process/agent_sensor/golang/e2e.yaml diff --git a/pkg/profiling/task/offcpu/runner.go b/pkg/profiling/task/offcpu/runner.go index 81bc0036..dca53432 100644 --- a/pkg/profiling/task/offcpu/runner.go +++ b/pkg/profiling/task/offcpu/runner.go @@ -61,7 +61,7 @@ type Runner struct { kernelProfiling *profiling.Info // runtime - previousStacks map[ProcessStack]*StackCounter + previousStacks map[ProcessStack]StackCounter bpf *bpfObjects kprobe link.Link stopChan chan bool @@ -82,7 +82,7 @@ func (r *Runner) Init(task *base.ProfilingTask, process api.ProcessInterface) er log.Warnf("could not analyze kernel profiling stats: %v", err) } r.kernelProfiling = kernelProfiling - r.previousStacks = make(map[ProcessStack]*StackCounter) + r.previousStacks = make(map[ProcessStack]StackCounter) r.stopChan = make(chan bool, 1) return nil } @@ -153,9 +153,6 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, error) { if r.bpf == nil { return nil, nil } - if r.flushDataNotify == nil { - return nil, nil - } var stack ProcessStack var counter StackCounter iterate := r.bpf.Counts.Iterate() @@ -183,11 +180,11 @@ func (r *Runner) FlushData() ([]*v3.EBPFProfilingData, error) { switchCount := int32(counter.Times) duration := int64(counter.Deltas) existCounter := r.previousStacks[stack] - if existCounter != nil { + if existCounter.Times > 0 && existCounter.Deltas > 0 { switchCount -= int32(existCounter.Times) duration -= int64(existCounter.Deltas) } - r.previousStacks[stack] = &counter + r.previousStacks[stack] = counter result = append(result, &v3.EBPFProfilingData{ Profiling: &v3.EBPFProfilingData_OffCPU{ diff --git a/pkg/tools/operator/distribution.go b/pkg/tools/operator/distribution.go index c63831e2..4ea93041 100644 --- a/pkg/tools/operator/distribution.go +++ b/pkg/tools/operator/distribution.go @@ -132,5 +132,7 @@ func normalizeContent(d string) string { d = strings.TrimSpace(d) d = strings.ToLower(d) d = strings.ReplaceAll(d, "-", "_") + d = strings.TrimPrefix(d, "\"") + d = strings.TrimSuffix(d, "\"") return d } diff --git a/test/e2e/base/env b/test/e2e/base/env index f07f3195..a7733c4c 100644 --- a/test/e2e/base/env +++ b/test/e2e/base/env @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -SW_CTL_COMMIT=03dbdcf8cecc3abdef661efaa5734c01ac49adea -SW_OAP_COMMIT=91b94cfc105276897c82e2d0f8d4bb8bd3952660 +SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d +SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0 SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5 SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582 \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c++/Dockerfile.file b/test/e2e/cases/profiling/offcpu/c++/Dockerfile.file new file mode 100644 index 00000000..5c603215 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c++/Dockerfile.file @@ -0,0 +1,23 @@ +# Licensed to the 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. The 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. + +FROM gcc:latest + +WORKDIR / +COPY file.cpp /file.cpp +RUN g++ file.cpp -o file + +CMD ["/file"] \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c++/docker-compose.yml b/test/e2e/cases/profiling/offcpu/c++/docker-compose.yml new file mode 100644 index 00000000..49aee4e3 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c++/docker-compose.yml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +version: '2.1' + +services: + oap: + extends: + file: ../../../../base/base-compose.yml + service: oap + ports: + - 12800:12800 + + rover: + extends: + file: ../../../../base/base-compose.yml + service: rover + environment: + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD: /file + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME: file + depends_on: + oap: + condition: service_healthy + + file_c_plus_plus: + build: + context: . + dockerfile: Dockerfile.file + networks: + - e2e + +networks: + e2e: \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c++/e2e.yaml b/test/e2e/cases/profiling/offcpu/c++/e2e.yaml new file mode 100644 index 00000000..8c9d512e --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c++/e2e.yaml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +setup: + env: compose + file: docker-compose.yml + timeout: 20m + init-system-environment: ../../../../base/env + steps: + - name: set PATH + command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH + - name: install yq + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh swctl + +verify: + # verify with retry strategy + retry: + # max retry count + count: 20 + # the interval between two retries, in millisecond. + interval: 10s + cases: + - includes: + - ../profiling-cases.yaml + - query: | + taskid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf list --service-name file |yq e '.[0].taskid' -) + scheduleid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid |yq e '.[0].scheduleid' -); + start=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].starttime' -) + end=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].endtime' -) + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf analysis --schedule-id=$scheduleid --time-ranges=$start-$end + expected: profiling-analysis.yml \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c++/file.cpp b/test/e2e/cases/profiling/offcpu/c++/file.cpp new file mode 100644 index 00000000..f0cfa2aa --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c++/file.cpp @@ -0,0 +1,36 @@ +// Licensed to the 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. The 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. + +#include +#include +using namespace std; + +void fileCPlusPlus() +{ + for (;;) + { + ofstream myfile; + myfile.open ("/tmp/skywalking-rover-e2e-test"); + myfile << "e2e test.\n"; + myfile.close(); + } +} + +int main() +{ + fileCPlusPlus(); + return 0; +} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c++/profiling-analysis.yml b/test/e2e/cases/profiling/offcpu/c++/profiling-analysis.yml new file mode 100644 index 00000000..07ca02c4 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c++/profiling-analysis.yml @@ -0,0 +1,27 @@ +# Licensed to the 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. +# The 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. + +tip: null +trees: +{{- contains .trees }} +- elements: + {{- contains .elements }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + symbol: "fileCPlusPlus()" + stacktype: USER_SPACE + dumpcount: {{ gt .dumpcount 0 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c/Dockerfile.file b/test/e2e/cases/profiling/offcpu/c/Dockerfile.file new file mode 100644 index 00000000..e1758365 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c/Dockerfile.file @@ -0,0 +1,23 @@ +# Licensed to the 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. The 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. + +FROM gcc:latest + +WORKDIR / +COPY file.c /file.c +RUN gcc file.c -o file + +CMD ["/file"] \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c/docker-compose.yml b/test/e2e/cases/profiling/offcpu/c/docker-compose.yml new file mode 100644 index 00000000..816e685f --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c/docker-compose.yml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +version: '2.1' + +services: + oap: + extends: + file: ../../../../base/base-compose.yml + service: oap + ports: + - 12800:12800 + + rover: + extends: + file: ../../../../base/base-compose.yml + service: rover + environment: + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD: /file + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME: file + depends_on: + oap: + condition: service_healthy + + file_c: + build: + context: . + dockerfile: Dockerfile.file + networks: + - e2e + +networks: + e2e: \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c/e2e.yaml b/test/e2e/cases/profiling/offcpu/c/e2e.yaml new file mode 100644 index 00000000..8c9d512e --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c/e2e.yaml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +setup: + env: compose + file: docker-compose.yml + timeout: 20m + init-system-environment: ../../../../base/env + steps: + - name: set PATH + command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH + - name: install yq + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh swctl + +verify: + # verify with retry strategy + retry: + # max retry count + count: 20 + # the interval between two retries, in millisecond. + interval: 10s + cases: + - includes: + - ../profiling-cases.yaml + - query: | + taskid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf list --service-name file |yq e '.[0].taskid' -) + scheduleid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid |yq e '.[0].scheduleid' -); + start=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].starttime' -) + end=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].endtime' -) + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf analysis --schedule-id=$scheduleid --time-ranges=$start-$end + expected: profiling-analysis.yml \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c/file.c b/test/e2e/cases/profiling/offcpu/c/file.c new file mode 100644 index 00000000..5ba3ae6d --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c/file.c @@ -0,0 +1,38 @@ +// Licensed to the 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. The 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. + +#include +#include + +int main() { + while (1) + { + FILE *fptr; + + // use appropriate location if you are using MacOS or Linux + fptr = fopen("/tmp/skywalking-rover-e2e-test","w"); + + if(fptr == NULL) + { + printf("Error!"); + exit(1); + } + + fprintf(fptr,"%d",1); + fclose(fptr); + } + return 0; +} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/c/profiling-analysis.yml b/test/e2e/cases/profiling/offcpu/c/profiling-analysis.yml new file mode 100644 index 00000000..3f03f03d --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/c/profiling-analysis.yml @@ -0,0 +1,27 @@ +# Licensed to the 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. +# The 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. + +tip: null +trees: +{{- contains .trees }} +- elements: + {{- contains .elements }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + symbol: "fprintf" + stacktype: USER_SPACE + dumpcount: {{ gt .dumpcount 0 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/expected/instance.yml b/test/e2e/cases/profiling/offcpu/expected/instance.yml new file mode 100644 index 00000000..db0638d2 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/expected/instance.yml @@ -0,0 +1,22 @@ +# Licensed to the 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. +# The 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. + +{{- contains . }} +- id: {{ b64enc "file" }}.1_{{ b64enc "test-instance" }} + name: test-instance + attributes: [] + language: UNKNOWN + instanceuuid: {{ notEmpty .instanceuuid }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/expected/process.yml b/test/e2e/cases/profiling/offcpu/expected/process.yml new file mode 100644 index 00000000..69c1ae98 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/expected/process.yml @@ -0,0 +1,39 @@ +# Licensed to the 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. +# The 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. + +{{- contains . }} +- id: {{ notEmpty .id }} + name: file + serviceid: {{ b64enc "file" }}.1 + servicename: file + instanceid: {{ b64enc "file" }}.1_{{ b64enc "test-instance" }} + instancename: test-instance + agentid: {{ notEmpty .agentid }} + detecttype: VM + attributes: + {{- contains .attributes }} + - name: host_ip + value: {{ notEmpty .value }} + - name: pid + value: {{ notEmpty .value }} + - name: command_line + value: /file + {{- end }} + labels: + {{- contains .labels }} + - e2e-label1 + - e2e-label2 + {{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/expected/profiling-create.yml b/test/e2e/cases/profiling/offcpu/expected/profiling-create.yml similarity index 100% rename from test/e2e/cases/profiling/expected/profiling-create.yml rename to test/e2e/cases/profiling/offcpu/expected/profiling-create.yml diff --git a/test/e2e/cases/profiling/offcpu/expected/profiling-schedule-list.yml b/test/e2e/cases/profiling/offcpu/expected/profiling-schedule-list.yml new file mode 100644 index 00000000..1e3eff60 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/expected/profiling-schedule-list.yml @@ -0,0 +1,44 @@ +# Licensed to the 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. +# The 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. + + {{- contains . }} +- scheduleid: {{ notEmpty .scheduleid }} + taskid: {{ notEmpty .taskid }} + process: + id: {{ notEmpty .process.id }} + name: file + serviceid: {{ b64enc "file" }}.1 + servicename: file + instanceid: {{ b64enc "file" }}.1_{{ b64enc "test-instance" }} + instancename: test-instance + agentid: {{ notEmpty .process.agentid }} + detecttype: VM + attributes: + {{- contains .process.attributes }} + - name: host_ip + value: {{ notEmpty .value }} + - name: pid + value: {{ notEmpty .value }} + - name: command_line + value: /file + {{- end }} + labels: + {{- contains .process.labels }} + - e2e-label1 + - e2e-label2 + {{- end }} + starttime: {{ gt .starttime 0 }} + endtime: {{ gt .endtime 0 }} + {{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml b/test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml new file mode 100644 index 00000000..10ea7f84 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml @@ -0,0 +1,30 @@ +# Licensed to the 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. +# The 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. + +{{- contains . }} +- taskid: {{ notEmpty .taskid }} + serviceid: {{ b64enc "file" }}.1 + servicename: file + processlabels: + {{- contains .processlabels }} + - e2e-label1 + - e2e-label2 + {{- end }} + taskstarttime: {{ gt .taskstarttime 0 }} + triggertype: FIXED_TIME + fixedtriggerduration: 60 + targettype: OFF_CPU + createtime: {{ gt .createtime 0 }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/expected/service.yml b/test/e2e/cases/profiling/offcpu/expected/service.yml new file mode 100644 index 00000000..814563c1 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/expected/service.yml @@ -0,0 +1,24 @@ +# Licensed to the 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. +# The 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. + +{{- contains . }} +- id: {{ b64enc "file" }}.1 + name: file + group: "" + shortname: file + layers: + - OS_LINUX + normal: true +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/golang/Dockerfile.file b/test/e2e/cases/profiling/offcpu/golang/Dockerfile.file new file mode 100644 index 00000000..eb6f5598 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/golang/Dockerfile.file @@ -0,0 +1,23 @@ +# Licensed to the 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. The 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. + +FROM golang:1.17 + +WORKDIR / +COPY file.go /file.go +RUN go build -o file file.go + +CMD ["/file"] \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/golang/docker-compose.yml b/test/e2e/cases/profiling/offcpu/golang/docker-compose.yml new file mode 100644 index 00000000..e1aa5722 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/golang/docker-compose.yml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +version: '2.1' + +services: + oap: + extends: + file: ../../../../base/base-compose.yml + service: oap + ports: + - 12800:12800 + + rover: + extends: + file: ../../../../base/base-compose.yml + service: rover + environment: + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD: /file + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME: file + depends_on: + oap: + condition: service_healthy + + file_go: + build: + context: . + dockerfile: Dockerfile.file + networks: + - e2e + +networks: + e2e: \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/golang/e2e.yaml b/test/e2e/cases/profiling/offcpu/golang/e2e.yaml new file mode 100644 index 00000000..8c9d512e --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/golang/e2e.yaml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +setup: + env: compose + file: docker-compose.yml + timeout: 20m + init-system-environment: ../../../../base/env + steps: + - name: set PATH + command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH + - name: install yq + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh swctl + +verify: + # verify with retry strategy + retry: + # max retry count + count: 20 + # the interval between two retries, in millisecond. + interval: 10s + cases: + - includes: + - ../profiling-cases.yaml + - query: | + taskid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf list --service-name file |yq e '.[0].taskid' -) + scheduleid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid |yq e '.[0].scheduleid' -); + start=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].starttime' -) + end=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].endtime' -) + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf analysis --schedule-id=$scheduleid --time-ranges=$start-$end + expected: profiling-analysis.yml \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/golang/file.go b/test/e2e/cases/profiling/offcpu/golang/file.go new file mode 100644 index 00000000..128f1832 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/golang/file.go @@ -0,0 +1,33 @@ +// Licensed to the 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. The 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 main + +import ( + "fmt" + "os" +) + +func main() { + d1 := []byte("e2e-test") + for { + err := os.WriteFile("/tmp/skywalking-rover-e2e-test", d1, 0600) + if err != nil { + fmt.Printf("error: %v", err) + break + } + } +} diff --git a/test/e2e/cases/profiling/offcpu/golang/profiling-analysis.yml b/test/e2e/cases/profiling/offcpu/golang/profiling-analysis.yml new file mode 100644 index 00000000..fc75aff0 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/golang/profiling-analysis.yml @@ -0,0 +1,27 @@ +# Licensed to the 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. +# The 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. + +tip: null +trees: +{{- contains .trees }} +- elements: + {{- contains .elements }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + symbol: "os.WriteFile" + stacktype: USER_SPACE + dumpcount: {{ gt .dumpcount 0 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/profiling-cases.yaml b/test/e2e/cases/profiling/offcpu/profiling-cases.yaml new file mode 100644 index 00000000..b2c72859 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/profiling-cases.yaml @@ -0,0 +1,34 @@ +# Licensed to the 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. +# The 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. + +# This file is used to show how to write configuration files and can be used to test. + +cases: + - query: swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml service ls + expected: expected/service.yml + - query: swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml instance ls --service-name file + expected: expected/instance.yml + - query: swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml process ls --service-name file --instance-name test-instance + expected: expected/process.yml + - query: | + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf create fixed --service-name file --labels e2e-label1,e2e-label2 --duration 1m --target-type OFF_CPU + expected: expected/profiling-create.yml + - query: swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf list --service-name file + expected: expected/profiling-task-list.yml + - query: | + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$( \ + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf list --service-name file |yq e '.[0].taskid' - + ) + expected: expected/profiling-schedule-list.yml \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/rust/Dockerfile.file b/test/e2e/cases/profiling/offcpu/rust/Dockerfile.file new file mode 100644 index 00000000..18f76800 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/rust/Dockerfile.file @@ -0,0 +1,23 @@ +# Licensed to the 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. The 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. + +FROM rust:1.60 + +WORKDIR / +COPY file.rs /file.rs +RUN rustc -o file file.rs + +CMD ["/file"] \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/rust/docker-compose.yml b/test/e2e/cases/profiling/offcpu/rust/docker-compose.yml new file mode 100644 index 00000000..723e51e6 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/rust/docker-compose.yml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +version: '2.1' + +services: + oap: + extends: + file: ../../../../base/base-compose.yml + service: oap + ports: + - 12800:12800 + + rover: + extends: + file: ../../../../base/base-compose.yml + service: rover + environment: + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD: /file + ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME: file + depends_on: + oap: + condition: service_healthy + + file_rust: + build: + context: . + dockerfile: Dockerfile.file + networks: + - e2e + +networks: + e2e: \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/rust/e2e.yaml b/test/e2e/cases/profiling/offcpu/rust/e2e.yaml new file mode 100644 index 00000000..8c9d512e --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/rust/e2e.yaml @@ -0,0 +1,45 @@ +# Licensed to the 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. +# The 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. + +setup: + env: compose + file: docker-compose.yml + timeout: 20m + init-system-environment: ../../../../base/env + steps: + - name: set PATH + command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH + - name: install yq + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh swctl + +verify: + # verify with retry strategy + retry: + # max retry count + count: 20 + # the interval between two retries, in millisecond. + interval: 10s + cases: + - includes: + - ../profiling-cases.yaml + - query: | + taskid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf list --service-name file |yq e '.[0].taskid' -) + scheduleid=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid |yq e '.[0].scheduleid' -); + start=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].starttime' -) + end=$(swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf schedules --task-id=$taskid | yq e '.[0].endtime' -) + swctl --base-url=http://${oap_host}:${oap_12800}/graphql --display yaml profiling ebpf analysis --schedule-id=$scheduleid --time-ranges=$start-$end + expected: profiling-analysis.yml \ No newline at end of file diff --git a/test/e2e/cases/profiling/offcpu/rust/file.rs b/test/e2e/cases/profiling/offcpu/rust/file.rs new file mode 100644 index 00000000..988d6f66 --- /dev/null +++ b/test/e2e/cases/profiling/offcpu/rust/file.rs @@ -0,0 +1,25 @@ +// Licensed to the 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. The 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. + +use std::fs::File; +use std::io::prelude::*; + +fn main() -> std::io::Result<()> { + loop { + let mut file = File::create("foo.txt")?; + file.write_all(b"Hello, world!")?; + } +} \ No newline at end of file diff --git a/test/e2e/cases/profiling/rust/profiling-analysis.yml b/test/e2e/cases/profiling/offcpu/rust/profiling-analysis.yml similarity index 100% rename from test/e2e/cases/profiling/rust/profiling-analysis.yml rename to test/e2e/cases/profiling/offcpu/rust/profiling-analysis.yml diff --git a/test/e2e/cases/profiling/c++/Dockerfile.sqrt b/test/e2e/cases/profiling/oncpu/c++/Dockerfile.sqrt similarity index 100% rename from test/e2e/cases/profiling/c++/Dockerfile.sqrt rename to test/e2e/cases/profiling/oncpu/c++/Dockerfile.sqrt diff --git a/test/e2e/cases/profiling/c++/docker-compose.yml b/test/e2e/cases/profiling/oncpu/c++/docker-compose.yml similarity index 92% rename from test/e2e/cases/profiling/c++/docker-compose.yml rename to test/e2e/cases/profiling/oncpu/c++/docker-compose.yml index ff5f760b..613092c0 100644 --- a/test/e2e/cases/profiling/c++/docker-compose.yml +++ b/test/e2e/cases/profiling/oncpu/c++/docker-compose.yml @@ -18,14 +18,14 @@ version: '2.1' services: oap: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: oap ports: - 12800:12800 rover: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: rover depends_on: oap: diff --git a/test/e2e/cases/profiling/golang/e2e.yaml b/test/e2e/cases/profiling/oncpu/c++/e2e.yaml similarity index 97% rename from test/e2e/cases/profiling/golang/e2e.yaml rename to test/e2e/cases/profiling/oncpu/c++/e2e.yaml index 0d79f559..f607abdb 100644 --- a/test/e2e/cases/profiling/golang/e2e.yaml +++ b/test/e2e/cases/profiling/oncpu/c++/e2e.yaml @@ -17,7 +17,7 @@ setup: env: compose file: docker-compose.yml timeout: 20m - init-system-environment: ../../../base/env + init-system-environment: ../../../../base/env steps: - name: set PATH command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH diff --git a/test/e2e/cases/profiling/c++/profiling-analysis.yml b/test/e2e/cases/profiling/oncpu/c++/profiling-analysis.yml similarity index 100% rename from test/e2e/cases/profiling/c++/profiling-analysis.yml rename to test/e2e/cases/profiling/oncpu/c++/profiling-analysis.yml diff --git a/test/e2e/cases/profiling/c++/sqrt.cpp b/test/e2e/cases/profiling/oncpu/c++/sqrt.cpp similarity index 100% rename from test/e2e/cases/profiling/c++/sqrt.cpp rename to test/e2e/cases/profiling/oncpu/c++/sqrt.cpp diff --git a/test/e2e/cases/profiling/c/Dockerfile.sqrt b/test/e2e/cases/profiling/oncpu/c/Dockerfile.sqrt similarity index 100% rename from test/e2e/cases/profiling/c/Dockerfile.sqrt rename to test/e2e/cases/profiling/oncpu/c/Dockerfile.sqrt diff --git a/test/e2e/cases/profiling/c/docker-compose.yml b/test/e2e/cases/profiling/oncpu/c/docker-compose.yml similarity index 92% rename from test/e2e/cases/profiling/c/docker-compose.yml rename to test/e2e/cases/profiling/oncpu/c/docker-compose.yml index 4742e132..ed629234 100644 --- a/test/e2e/cases/profiling/c/docker-compose.yml +++ b/test/e2e/cases/profiling/oncpu/c/docker-compose.yml @@ -18,14 +18,14 @@ version: '2.1' services: oap: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: oap ports: - 12800:12800 rover: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: rover depends_on: oap: diff --git a/test/e2e/cases/profiling/c++/e2e.yaml b/test/e2e/cases/profiling/oncpu/c/e2e.yaml similarity index 97% rename from test/e2e/cases/profiling/c++/e2e.yaml rename to test/e2e/cases/profiling/oncpu/c/e2e.yaml index 0d79f559..f607abdb 100644 --- a/test/e2e/cases/profiling/c++/e2e.yaml +++ b/test/e2e/cases/profiling/oncpu/c/e2e.yaml @@ -17,7 +17,7 @@ setup: env: compose file: docker-compose.yml timeout: 20m - init-system-environment: ../../../base/env + init-system-environment: ../../../../base/env steps: - name: set PATH command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH diff --git a/test/e2e/cases/profiling/c/profiling-analysis.yml b/test/e2e/cases/profiling/oncpu/c/profiling-analysis.yml similarity index 100% rename from test/e2e/cases/profiling/c/profiling-analysis.yml rename to test/e2e/cases/profiling/oncpu/c/profiling-analysis.yml diff --git a/test/e2e/cases/profiling/c/sqrt.c b/test/e2e/cases/profiling/oncpu/c/sqrt.c similarity index 100% rename from test/e2e/cases/profiling/c/sqrt.c rename to test/e2e/cases/profiling/oncpu/c/sqrt.c diff --git a/test/e2e/cases/profiling/expected/instance.yml b/test/e2e/cases/profiling/oncpu/expected/instance.yml similarity index 100% rename from test/e2e/cases/profiling/expected/instance.yml rename to test/e2e/cases/profiling/oncpu/expected/instance.yml diff --git a/test/e2e/cases/profiling/expected/process-estimate-scale.yml b/test/e2e/cases/profiling/oncpu/expected/process-estimate-scale.yml similarity index 100% rename from test/e2e/cases/profiling/expected/process-estimate-scale.yml rename to test/e2e/cases/profiling/oncpu/expected/process-estimate-scale.yml diff --git a/test/e2e/cases/profiling/expected/process.yml b/test/e2e/cases/profiling/oncpu/expected/process.yml similarity index 100% rename from test/e2e/cases/profiling/expected/process.yml rename to test/e2e/cases/profiling/oncpu/expected/process.yml diff --git a/test/e2e/cases/profiling/expected/profiling-create-prepare.yml b/test/e2e/cases/profiling/oncpu/expected/profiling-create-prepare.yml similarity index 100% rename from test/e2e/cases/profiling/expected/profiling-create-prepare.yml rename to test/e2e/cases/profiling/oncpu/expected/profiling-create-prepare.yml diff --git a/test/e2e/cases/profiling/oncpu/expected/profiling-create.yml b/test/e2e/cases/profiling/oncpu/expected/profiling-create.yml new file mode 100644 index 00000000..176b195a --- /dev/null +++ b/test/e2e/cases/profiling/oncpu/expected/profiling-create.yml @@ -0,0 +1,18 @@ +# Licensed to the 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. +# The 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. + +status: true +errorreason: null +id: {{ notEmpty .id }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/expected/profiling-schedule-list.yml b/test/e2e/cases/profiling/oncpu/expected/profiling-schedule-list.yml similarity index 100% rename from test/e2e/cases/profiling/expected/profiling-schedule-list.yml rename to test/e2e/cases/profiling/oncpu/expected/profiling-schedule-list.yml diff --git a/test/e2e/cases/profiling/expected/profiling-task-list.yml b/test/e2e/cases/profiling/oncpu/expected/profiling-task-list.yml similarity index 100% rename from test/e2e/cases/profiling/expected/profiling-task-list.yml rename to test/e2e/cases/profiling/oncpu/expected/profiling-task-list.yml diff --git a/test/e2e/cases/profiling/expected/service.yml b/test/e2e/cases/profiling/oncpu/expected/service.yml similarity index 100% rename from test/e2e/cases/profiling/expected/service.yml rename to test/e2e/cases/profiling/oncpu/expected/service.yml diff --git a/test/e2e/cases/profiling/golang/Dockerfile.sqrt b/test/e2e/cases/profiling/oncpu/golang/Dockerfile.sqrt similarity index 100% rename from test/e2e/cases/profiling/golang/Dockerfile.sqrt rename to test/e2e/cases/profiling/oncpu/golang/Dockerfile.sqrt diff --git a/test/e2e/cases/profiling/golang/docker-compose.yml b/test/e2e/cases/profiling/oncpu/golang/docker-compose.yml similarity index 92% rename from test/e2e/cases/profiling/golang/docker-compose.yml rename to test/e2e/cases/profiling/oncpu/golang/docker-compose.yml index 1f5369f9..0df418fd 100644 --- a/test/e2e/cases/profiling/golang/docker-compose.yml +++ b/test/e2e/cases/profiling/oncpu/golang/docker-compose.yml @@ -18,14 +18,14 @@ version: '2.1' services: oap: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: oap ports: - 12800:12800 rover: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: rover depends_on: oap: diff --git a/test/e2e/cases/profiling/rust/e2e.yaml b/test/e2e/cases/profiling/oncpu/golang/e2e.yaml similarity index 97% rename from test/e2e/cases/profiling/rust/e2e.yaml rename to test/e2e/cases/profiling/oncpu/golang/e2e.yaml index 0d79f559..f607abdb 100644 --- a/test/e2e/cases/profiling/rust/e2e.yaml +++ b/test/e2e/cases/profiling/oncpu/golang/e2e.yaml @@ -17,7 +17,7 @@ setup: env: compose file: docker-compose.yml timeout: 20m - init-system-environment: ../../../base/env + init-system-environment: ../../../../base/env steps: - name: set PATH command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH diff --git a/test/e2e/cases/profiling/golang/profiling-analysis.yml b/test/e2e/cases/profiling/oncpu/golang/profiling-analysis.yml similarity index 100% rename from test/e2e/cases/profiling/golang/profiling-analysis.yml rename to test/e2e/cases/profiling/oncpu/golang/profiling-analysis.yml diff --git a/test/e2e/cases/profiling/golang/sqrt.go b/test/e2e/cases/profiling/oncpu/golang/sqrt.go similarity index 100% rename from test/e2e/cases/profiling/golang/sqrt.go rename to test/e2e/cases/profiling/oncpu/golang/sqrt.go diff --git a/test/e2e/cases/profiling/profiling-cases.yaml b/test/e2e/cases/profiling/oncpu/profiling-cases.yaml similarity index 100% rename from test/e2e/cases/profiling/profiling-cases.yaml rename to test/e2e/cases/profiling/oncpu/profiling-cases.yaml diff --git a/test/e2e/cases/profiling/rust/Dockerfile.sqrt b/test/e2e/cases/profiling/oncpu/rust/Dockerfile.sqrt similarity index 100% rename from test/e2e/cases/profiling/rust/Dockerfile.sqrt rename to test/e2e/cases/profiling/oncpu/rust/Dockerfile.sqrt diff --git a/test/e2e/cases/profiling/rust/docker-compose.yml b/test/e2e/cases/profiling/oncpu/rust/docker-compose.yml similarity index 92% rename from test/e2e/cases/profiling/rust/docker-compose.yml rename to test/e2e/cases/profiling/oncpu/rust/docker-compose.yml index 0fc3d94c..405731da 100644 --- a/test/e2e/cases/profiling/rust/docker-compose.yml +++ b/test/e2e/cases/profiling/oncpu/rust/docker-compose.yml @@ -18,14 +18,14 @@ version: '2.1' services: oap: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: oap ports: - 12800:12800 rover: extends: - file: ../../../base/base-compose.yml + file: ../../../../base/base-compose.yml service: rover depends_on: oap: diff --git a/test/e2e/cases/profiling/c/e2e.yaml b/test/e2e/cases/profiling/oncpu/rust/e2e.yaml similarity index 97% rename from test/e2e/cases/profiling/c/e2e.yaml rename to test/e2e/cases/profiling/oncpu/rust/e2e.yaml index 0d79f559..f607abdb 100644 --- a/test/e2e/cases/profiling/c/e2e.yaml +++ b/test/e2e/cases/profiling/oncpu/rust/e2e.yaml @@ -17,7 +17,7 @@ setup: env: compose file: docker-compose.yml timeout: 20m - init-system-environment: ../../../base/env + init-system-environment: ../../../../base/env steps: - name: set PATH command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH diff --git a/test/e2e/cases/profiling/oncpu/rust/profiling-analysis.yml b/test/e2e/cases/profiling/oncpu/rust/profiling-analysis.yml new file mode 100644 index 00000000..0475b247 --- /dev/null +++ b/test/e2e/cases/profiling/oncpu/rust/profiling-analysis.yml @@ -0,0 +1,27 @@ +# Licensed to the 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. +# The 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. + +tip: null +trees: +{{- contains .trees }} +- elements: + {{- contains .elements }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + symbol: {{if ne .symbol "[MISSING]" }}{{.symbol}}{{else}}contains not missing{{end}} + stacktype: USER_SPACE + dumpcount: {{ gt .dumpcount 0 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e/cases/profiling/rust/sqrt.rs b/test/e2e/cases/profiling/oncpu/rust/sqrt.rs similarity index 100% rename from test/e2e/cases/profiling/rust/sqrt.rs rename to test/e2e/cases/profiling/oncpu/rust/sqrt.rs