This is an automated email from the ASF dual-hosted git repository.
liuhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
The following commit(s) were added to refs/heads/main by this push:
new c9c7731 Support HTTPS E2E Testing and bug fix (#47)
c9c7731 is described below
commit c9c773147778b93b49938949eba656757555453d
Author: mrproliu <[email protected]>
AuthorDate: Thu Aug 18 11:22:43 2022 +0800
Support HTTPS E2E Testing and bug fix (#47)
---
.github/workflows/rover.yaml | 55 +++++++
CHANGES.md | 2 +
pkg/process/finders/kubernetes/finder.go | 34 ++--
pkg/profiling/task/manager.go | 5 +
pkg/profiling/task/network/runner.go | 3 +
test/e2e/base/env | 4 +-
.../cases/profiling/network/base/Dockerfile.nginx | 20 +++
.../profiling/network/base/docker-compose.yml | 70 ++++++++
.../profiling/network/base/network-profiling.yaml | 116 +++++++++++++
test/e2e/cases/profiling/network/base/nginx.conf | 35 ++++
.../profiling/network/base/rover_configs.yaml | 139 ++++++++++++++++
.../network/base/ssl/gen-selfsigned-ssl.sh | 80 +++++++++
.../profiling/network/c_plus_plus/CMakeLists.txt | 44 +++++
.../cases/profiling/network/c_plus_plus/Dockerfile | 33 ++++
.../network/c_plus_plus/docker-compose.yml | 61 +++++++
.../profiling/network/c_plus_plus/e2e.yaml} | 33 +++-
.../profiling/network/c_plus_plus/src/main.cpp | 57 +++++++
test/e2e/cases/profiling/network/envoy/e2e.yaml | 179 +++++++++++++++++++++
.../network/envoy/expected/dependency-processs.yml | 103 ++++++++++++
.../envoy/expected/metrics-has-value-label.yml} | 13 +-
.../network/envoy/expected/metrics-has-value.yml} | 9 +-
.../profiling/network/envoy/expected/process.yml | 86 ++++++++++
.../network/envoy/expected/profiling-create.yml} | 8 +-
.../network/envoy/expected/service-instance.yml} | 12 +-
.../profiling/network/envoy/expected/service.yml | 71 ++++++++
.../profiling/network/envoy/kind.yaml} | 28 +++-
test/e2e/cases/profiling/network/envoy/rover.yaml | 103 ++++++++++++
.../profiling/network/envoy/traffic-gen.yaml} | 30 +++-
.../network/expected/dependency-processs.yml | 61 +++++++
.../profiling/network/expected/instance.yml} | 12 +-
.../network/expected/metrics-has-value-label.yml} | 13 +-
.../network/expected/metrics-has-value.yml} | 9 +-
.../expected/process.yml} | 29 ++--
.../network/expected/profiling-create.yml} | 8 +-
.../profiling/network/expected/service.yml} | 21 ++-
test/e2e/cases/profiling/network/golang/Dockerfile | 26 +++
.../profiling/network/golang/docker-compose.yml | 61 +++++++
.../profiling/network/golang/e2e.yaml} | 33 +++-
test/e2e/cases/profiling/network/golang/service.go | 52 ++++++
.../e2e/cases/profiling/network/network-cases.yaml | 94 +++++++++++
test/e2e/cases/profiling/network/python/Dockerfile | 29 ++++
.../profiling/network/python/docker-compose.yml | 64 ++++++++
.../profiling/network/python/e2e.yaml} | 33 +++-
.../profiling/network/python/requirements.txt | 17 ++
test/e2e/cases/profiling/network/python/service.py | 59 +++++++
.../offcpu/expected/profiling-task-list.yml | 2 +
.../oncpu/expected/profiling-task-list.yml | 2 +
47 files changed, 1967 insertions(+), 91 deletions(-)
diff --git a/.github/workflows/rover.yaml b/.github/workflows/rover.yaml
index 342d86b..07eda2a 100644
--- a/.github/workflows/rover.yaml
+++ b/.github/workflows/rover.yaml
@@ -142,12 +142,64 @@ jobs:
name: logs
path: "${{ env.SW_INFRA_E2E_LOG_DIR }}"
+
+ https-e2e-test:
+ name: HTTPS E2E test
+ needs: [ docker ]
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ test:
+ - name: Golang Profiling
+ config: test/e2e/cases/profiling/network/golang/e2e.yaml
+ - name: Python Profiling
+ config: test/e2e/cases/profiling/network/golang/e2e.yaml
+ - name: Envoy Profiling
+ config: test/e2e/cases/profiling/network/envoy/e2e.yaml
+ env: ISTIO_VERSION=1.13.1
+ - name: C++ Profiling
+ config: test/e2e/cases/profiling/network/c_plus_plus/e2e.yaml
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - uses: actions/download-artifact@v2
+ name: Download docker images
+ with:
+ name: docker-images-skywalking-rover
+ path: docker-images
+ - name: Load docker images
+ run: find docker-images -name "*.tar" -exec docker load -i {} \;
+ - name: Setup Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: '1.16'
+ - name: Set env var
+ run: echo "${{ matrix.test.env }}" >> $GITHUB_ENV
+ - name: Setup SSL Certs
+ run: |
+ bash test/e2e/cases/profiling/network/base/ssl/gen-selfsigned-ssl.sh
service
+ bash test/e2e/cases/profiling/network/base/ssl/gen-selfsigned-ssl.sh
proxy
+ - name: ${{ matrix.test.name }}
+ uses: apache/skywalking-infra-e2e@main
+ with:
+ e2e-file: $GITHUB_WORKSPACE/${{ matrix.test.config }}
+ - uses: actions/upload-artifact@v2
+ if: ${{ failure() }}
+ name: Upload Logs
+ with:
+ name: logs
+ path: "${{ env.SW_INFRA_E2E_LOG_DIR }}"
+
required:
if: always()
name: Required
needs:
- build
- e2e-test
+ - https-e2e-test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@@ -158,4 +210,7 @@ jobs:
fi
if [[ ${{ needs.e2e-test.result }} != 'success' ]]; then
exit -1
+ fi
+ if [[ ${{ needs.https-e2e-test.result }} != 'success' ]]; then
+ exit -1
fi
\ No newline at end of file
diff --git a/CHANGES.md b/CHANGES.md
index fab4e08..5778fff 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,9 +8,11 @@ Release Notes.
* Support `NETWORK` Profiling.
* Let the logger as a configurable module.
* Support analyze the data of OpenSSL, BoringSSL library, GoTLS in `NETWORK`
Profiling.
+* Enhancing the kubernetes process finder.
#### Bug Fixes
* Fixed reading process paths incorrect when running as a container.
+* Fix the crash caused by multiple profiling tasks.
#### Issues and PR
- All issues are
[here](https://github.com/apache/skywalking/milestone/144?closed=1)
diff --git a/pkg/process/finders/kubernetes/finder.go
b/pkg/process/finders/kubernetes/finder.go
index f04897c..bf9feb1 100644
--- a/pkg/process/finders/kubernetes/finder.go
+++ b/pkg/process/finders/kubernetes/finder.go
@@ -167,12 +167,18 @@ func (f *ProcessFinder) analyzeProcesses() error {
continue
}
- cgroup, err := f.getProcessCGroup(p.Pid)
+ cgroups, err := f.getProcessCGroup(p.Pid)
if err != nil {
continue
}
- c := containers[cgroup]
+ var c *PodContainer
+ for _, cgroup := range cgroups {
+ if cc := containers[cgroup]; cc != nil {
+ c = cc
+ break
+ }
+ }
if c == nil {
continue
}
@@ -244,30 +250,34 @@ func (f *ProcessFinder) buildEntity(err error, ps
*process.Process, pc *PodConta
return renderTemplate(entity, ps, pc, f)
}
-func (f *ProcessFinder) getProcessCGroup(pid int32) (string, error) {
+func (f *ProcessFinder) getProcessCGroup(pid int32) ([]string, error) {
processCgroupFilePath :=
host.GetFileInHost(fmt.Sprintf("/proc/%d/cgroup", pid))
cgroupFile, err := os.Open(processCgroupFilePath)
if err != nil {
- return "", err
+ return nil, err
}
defer cgroupFile.Close()
+ cache := make(map[string]bool)
scanner := bufio.NewScanner(cgroupFile)
for scanner.Scan() {
infos := strings.Split(scanner.Text(), ":")
if len(infos) < 3 {
continue
}
- // find by most common type of cgroup
- if infos[1] == "memory" {
- lastPath := strings.LastIndex(infos[2], "/")
- if lastPath > 1 && lastPath != len(infos[2])-1 {
- return infos[2][lastPath+1:], nil
- }
- return "", nil
+ lastPath := strings.LastIndex(infos[2], "/")
+ if lastPath > 1 && lastPath != len(infos[2])-1 {
+ cache[infos[2][lastPath+1:]] = true
}
}
- return "", fmt.Errorf("no memory config")
+ if len(cache) == 0 {
+ return nil, fmt.Errorf("no cgroups")
+ }
+ result := make([]string, 0)
+ for k := range cache {
+ result = append(result, k)
+ }
+ return result, nil
}
func (f *ProcessFinder) Stop() error {
diff --git a/pkg/profiling/task/manager.go b/pkg/profiling/task/manager.go
index a096cb9..5f230dd 100644
--- a/pkg/profiling/task/manager.go
+++ b/pkg/profiling/task/manager.go
@@ -216,6 +216,11 @@ func (m *Manager) shutdownTask(c *Context) error {
if c.runningWg == nil {
return nil
}
+ defer func() {
+ if r := recover(); r != nil {
+ log.Warnf("recover from shutdown task, id: %s, error:
%v", c.TaskID(), r)
+ }
+ }()
err := c.runner.Stop()
c.runningWg.Wait()
c.cancel()
diff --git a/pkg/profiling/task/network/runner.go
b/pkg/profiling/task/network/runner.go
index 935aa5a..f085ffd 100644
--- a/pkg/profiling/task/network/runner.go
+++ b/pkg/profiling/task/network/runner.go
@@ -244,6 +244,9 @@ func (r *Runner) logTheMetricsConnections(traffices
[]*ProcessTraffic) {
}
func (r *Runner) Stop() error {
+ // if starting, then need to wait start finished
+ r.startLock.Lock()
+ defer r.startLock.Unlock()
if r.cancel != nil {
r.cancel()
}
diff --git a/test/e2e/base/env b/test/e2e/base/env
index a7733c4..9d417df 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=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
+SW_CTL_COMMIT=ec85225f3fc0d0d7e8a9513b828d305c7cb399ad
+SW_OAP_COMMIT=aa8ddd2587ca2499819eeb1ae4740f8ca4fbb158
SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/base/Dockerfile.nginx
b/test/e2e/cases/profiling/network/base/Dockerfile.nginx
new file mode 100644
index 0000000..e36cf38
--- /dev/null
+++ b/test/e2e/cases/profiling/network/base/Dockerfile.nginx
@@ -0,0 +1,20 @@
+# 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 nginx
+
+COPY ssl /usr/local/share/ca-certificates/ssl
+RUN update-ca-certificates
diff --git a/test/e2e/cases/profiling/network/base/docker-compose.yml
b/test/e2e/cases/profiling/network/base/docker-compose.yml
new file mode 100644
index 0000000..e51844b
--- /dev/null
+++ b/test/e2e/cases/profiling/network/base/docker-compose.yml
@@ -0,0 +1,70 @@
+# 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:
+ proxy:
+ build:
+ context: .
+ dockerfile: Dockerfile.nginx
+ networks:
+ - e2e
+ volumes:
+ - ./ssl:/ssl_data
+ - ./nginx.conf:/etc/nginx/nginx.conf
+ expose:
+ - 443
+ healthcheck:
+ test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/80" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ service:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ networks:
+ - e2e
+ volumes:
+ - ./ssl:/ssl_data
+ ports:
+ - 10443:10443
+ healthcheck:
+ test: [ "CMD", "bash", "-c", "cat < /dev/null >
/dev/tcp/127.0.0.1/10443" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ oap:
+ extends:
+ file: ../../../../base/base-compose.yml
+ service: oap
+ environment:
+ SW_METER_ANALYZER_ACTIVE_FILES: network-profiling
+ volumes:
+ -
./network-profiling.yaml:/skywalking/config/meter-analyzer-config/network-profiling.yaml
+ ports:
+ - 12800:12800
+
+ rover:
+ extends:
+ file: ../../../../base/base-compose.yml
+ service: rover
+ volumes:
+ - ./rover_configs.yaml:/skywalking/configs/rover_configs.yaml
+networks:
+ e2e:
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/base/network-profiling.yaml
b/test/e2e/cases/profiling/network/base/network-profiling.yaml
new file mode 100644
index 0000000..1c0b944
--- /dev/null
+++ b/test/e2e/cases/profiling/network/base/network-profiling.yaml
@@ -0,0 +1,116 @@
+# 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.
+
+expSuffix: |-
+ processRelation('side', ['service'], ['instance'], 'client_process_id',
'server_process_id', 'component')
+expPrefix: |-
+ forEach(['client', 'server'], { prefix, tags ->
+ if (tags[prefix + '_process_id'] != null) {
+ return
+ }
+ // only care about the nginx
+ if (tags[prefix + '_local'] == 'true'
+ || tags[prefix + '_address'].split(':')[0].endsWith('.1') // local data
+ || tags[prefix + '_address'].split(':')[1] == '53') { // dns
+ tags[prefix + '_process_id'] =
ProcessRegistry.generateVirtualLocalProcess(tags.service, tags.instance)
+ return
+ }
+ tags[prefix + '_process_id'] =
ProcessRegistry.generateVirtualRemoteProcess(tags.service, tags.instance,
tags[prefix + '_address'])
+ })
+ .forEach(['component'], { key, tags ->
+ String result = ""
+ // protocol are defined in the component-libraries.yml
+ String protocol = tags['protocol']
+ String ssl = tags['is_ssl']
+ if (protocol == 'http' && ssl == 'true') {
+ result = '129' // https
+ } else if (protocol == 'http') {
+ result = '49' // http
+ } else if (ssl == 'true') {
+ result = '130' // tls
+ } else {
+ result = '110' // tcp
+ }
+ tags[key] = result
+ })
+metricPrefix: process_relation
+metricsRules:
+ # client side
+ - name: client_write_cpm
+ exp: rover_net_p_client_write_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_write_total_bytes
+ exp: rover_net_p_client_write_bytes_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_write_avg_exe_time
+ exp: rover_net_p_client_write_exe_time_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: client_read_cpm
+ exp: rover_net_p_client_read_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_read_total_bytes
+ exp: rover_net_p_client_read_bytes_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_read_avg_exe_time
+ exp: rover_net_p_client_read_exe_time_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: client_write_avg_rtt_time
+ exp: rover_net_p_client_write_rtt_exe_time_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: client_connect_cpm
+ exp: rover_net_p_client_connect_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_connect_exe_time
+ exp: rover_net_p_client_connect_exe_time_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: client_close_cpm
+ exp: rover_net_p_client_close_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_close_avg_exe_time
+ exp: rover_net_p_client_close_exe_time_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: client_retransmit_cpm
+ exp: rover_net_p_client_retransmit_counts_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_drop_cpm
+ exp: rover_net_p_client_drop_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: client_write_rtt_time_percentile
+ exp:
rover_net_p_client_write_rtt_histogram.histogram().histogram_percentile([50,70,90,99]).downsampling(SUM)
+ - name: client_write_exe_time_percentile
+ exp:
rover_net_p_client_write_exe_time_histogram.histogram().histogram_percentile([50,70,90,99]).downsampling(SUM)
+ - name: client_read_exe_time_percentile
+ exp:
rover_net_p_client_read_exe_time_histogram.histogram().histogram_percentile([50,70,90,99]).downsampling(SUM)
+
+ # server side
+ - name: server_write_cpm
+ exp: rover_net_p_server_write_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_write_total_bytes
+ exp: rover_net_p_server_write_bytes_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_write_avg_exe_time
+ exp: rover_net_p_server_write_exe_time_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: server_read_cpm
+ exp: rover_net_p_server_read_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_read_total_bytes
+ exp: rover_net_p_server_read_bytes_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_read_avg_exe_time
+ exp: rover_net_p_server_read_exe_time_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: server_write_avg_rtt_time
+ exp: rover_net_p_server_write_rtt_exe_time_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: server_connect_cpm
+ exp: rover_net_p_server_connect_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_connect_avg_exe_time
+ exp: rover_net_p_server_connect_exe_time_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: server_close_cpm
+ exp: rover_net_p_server_close_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_close_avg_exe_time
+ exp: rover_net_p_server_close_exe_time_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id', 'component'])
+ - name: server_retransmit_cpm
+ exp: rover_net_p_server_retransmit_counts_counter.sum(['service',
'instance', 'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_drop_cpm
+ exp: rover_net_p_server_drop_counts_counter.sum(['service', 'instance',
'side', 'client_process_id', 'server_process_id',
'component']).downsampling(SUM_PER_MIN)
+ - name: server_write_rtt_time_percentile
+ exp:
rover_net_p_server_write_rtt_histogram.histogram().histogram_percentile([50,70,90,99]).downsampling(SUM)
+ - name: server_write_exe_time_percentile
+ exp:
rover_net_p_server_write_exe_time_histogram.histogram().histogram_percentile([50,70,90,99]).downsampling(SUM)
+ - name: server_read_exe_time_percentile
+ exp:
rover_net_p_server_read_exe_time_histogram.histogram().histogram_percentile([50,70,90,99]).downsampling(SUM)
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/base/nginx.conf
b/test/e2e/cases/profiling/network/base/nginx.conf
new file mode 100644
index 0000000..2de1521
--- /dev/null
+++ b/test/e2e/cases/profiling/network/base/nginx.conf
@@ -0,0 +1,35 @@
+# 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.
+
+user nginx;
+worker_processes auto;
+events {
+ worker_connections 102400;
+}
+http {
+ server {
+ listen 443 ssl;
+ server_name proxy;
+
+ ssl_certificate /ssl_data/proxy.crt;
+ ssl_certificate_key /ssl_data/proxy.key;
+
+ location /provider {
+ proxy_pass https://service:10443/provider;
+ proxy_http_version 1.1;
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/base/rover_configs.yaml
b/test/e2e/cases/profiling/network/base/rover_configs.yaml
new file mode 100644
index 0000000..adb3b7b
--- /dev/null
+++ b/test/e2e/cases/profiling/network/base/rover_configs.yaml
@@ -0,0 +1,139 @@
+#
+# 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.
+#
+
+logger:
+ # The lowest level of printing allowed.
+ level: ${ROVER_LOGGER_LEVEL:DEBUG}
+
+core:
+ backend:
+ # The backend server address
+ addr: ${ROVER_BACKEND_ADDR:localhost:11800}
+ # The TLS switch
+ enable_TLS: ${ROVER_BACKEND_ENABLE_TLS:false}
+ # The file path of client.pem. The config only works when opening the TLS
switch.
+ client_pem_path: ${ROVER_BACKEND_PEM_PATH:"client.pem"}
+ # The file path of client.key. The config only works when opening the TLS
switch.
+ client_key_path: ${ROVER_BACKEND_KEY_PATH:"client.key"}
+ # InsecureSkipVerify controls whether a client verifies the server's
certificate chain and host name.
+ insecure_skip_verify: ${ROVER_BACKEND_INSECURE_SKIP_VERIFY:false}
+ # The file path oca.pem. The config only works when opening the TLS switch.
+ ca_pem_path: ${ROVER_BACKEND_CA_PEM_PATH:"ca.pem"}
+ # How frequently to check the connection(second)
+ check_period: ${ROVER_BACKEND_CHECK_PERIOD:5}
+ # The auth value when send request
+ authentication: ${ROVER_BACKEND_AUTHENTICATION:""}
+
+process_discovery:
+ # The period of report or keep alive process(second)
+ heartbeat_period: ${ROVER_PROCESS_DISCOVERY_HEARTBEAT_PERIOD:20s}
+ # The agent sends the process properties to the backend every: heartbeart
period * properties report period
+ properties_report_period:
${ROVER_PROCESS_DISCOVERY_PROPERTIES_REPORT_PERIOD:10}
+ # Scan process from linux
+ scanner:
+ # The period to detect the process
+ period: ${ROVER_PROCESS_DISCOVERY_SCAN_PERIOD:3s}
+ # The process detection modes of the scanner. Support "REGEX",
"AGENT_SENSOR"
+ mode: ${ROVER_PROCESS_DISCOVERY_SCAN_MODE:REGEX}
+ agent:
+ # Set the agent refresh period
+ process_status_refresh_period:
${ROVER_PROCESS_DISCOVERY_AGENT_PROCESS_STATUS_REFRESH_PERIOD:1m}
+ regex:
+ # Use regex string to locate the processes
+ # Duplicate entities cannot be reported. If multiple entity are
generated, only one process will be report
+ # If the multiple finders could match the same one process, only the
first finder could be selected and report
+ - match_cmd: ${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD1:nginx}
+ # The Layer need to relate to the process entity
+ layer: ${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_LAYER1:OS_LINUX}
+ # The Service Name need to relate to the process entity
+ service_name:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME1:nginx}
+ # The Service Instance Name need to relate to the process entity
+ # By default the instance name is the host IP v4 address from "en0"
net interface
+ instance_name:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_INSTANCE_NAME1:test}
+ # The Process Name need to relate to the process entity
+ # By default, the process name is the executable name of the process
+ process_name:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_PROCESS_NAME1:{{.Process.ExeName}}-{{.Process.Pid}}}
+ # The Process Labels, used to aggregate similar process from service
entity
+ # Multiple labels split by ","
+ labels: ${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_LABELS:}
+ - match_cmd:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD2:/service$}
+ # The Layer need to relate to the process entity
+ layer: ${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_LAYER2:OS_LINUX}
+ # The Service Name need to relate to the process entity
+ service_name:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_SERVICE_NAME2:service}
+ # The Service Instance Name need to relate to the process entity
+ # By default the instance name is the host IP v4 address from "en0"
net interface
+ instance_name:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_INSTANCE_NAME2:test}
+ # The Process Name need to relate to the process entity
+ # By default, the process name is the executable name of the process
+ process_name:
${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_PROCESS_NAME2:{{.Process.ExeName}}}
+ # The Process Labels, used to aggregate similar process from service
entity
+ # Multiple labels split by ","
+ labels: ${ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_LABELS:}
+ kubernetes:
+ # Is active the kubernetes process detector
+ active: ${ROVER_PROCESS_DISCOVERY_KUBERNETES_ACTIVE:false}
+ # Current node name in kubernetes environment
+ node_name: ${ROVER_PROCESS_DISCOVERY_KUBERNETES_NODE_NAME:}
+ # include namespaces, multiple namespace split by ",", if empty means
including all namespaces
+ namespaces: ${ROVER_PROCESS_DISCOVERY_KUBERNETES_NAMESPACES:}
+ analyzers:
+ - active:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_ACTIVE:true}
+ filters:
+ -
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_HAS_ENVOY:.Pod.HasContainer
"istio-proxy"}
+ -
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_CONTAINER_IS_ENVOY:eq
.Container.Name "istio-proxy"}
+ layer:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_LAYER:MESH_DP}
+ service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_SERVICE_NAME:{{.Pod.Namespace}}::{{.Pod.LabelValue
"service.istio.io/canonical-name,app.kubernetes.io/name,app" }}}
+ instance_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_INSTANCE_NAME:{{.Pod.Name}}}
+ process_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_PROCESS_NAME:{{.Process.ExeName}}}
+ labels:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_LABELS:mesh-envoy}
+ - active:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_ACTIVE:true}
+ filters:
+ -
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_HAS_ENVOY:.Pod.HasContainer
"istio-proxy"}
+ -
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_CONTAINER_NOT_ENVOY:ne
.Container.Name "istio-proxy"}
+ layer:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_LAYER:MESH}
+ service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_SERVICE_NAME:{{.Pod.Namespace}}::{{.Pod.LabelValue
"service.istio.io/canonical-name,app.kubernetes.io/name,app" }}}
+ instance_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_INSTANCE_NAME:{{.Pod.Name}}}
+ process_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_PROCESS_NAME:{{.Process.ExeName}}}
+ labels:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_LABELS:mesh-application}
+ - active:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_ACTIVE:true}
+ filters:
+ -
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_HAS_SERVICE:.Pod.HasServiceName}
+ layer:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_LAYER:K8S_SERVICE}
+ service_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_NAME:{{.Pod.Namespace}}::{{.Pod.ServiceName}}}
+ instance_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_INSTANCE_NAME:{{.Pod.Name}}}
+ process_name:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_PROCESS_NAME:{{.Process.ExeName}}}
+ labels:
${ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_LABLES:k8s-service}
+
+profiling:
+ # Is active the process profiling
+ active: ${ROVER_PROFILING_ACTIVE:true}
+ # Check the profiling task interval
+ check_interval: ${ROVER_PROFILING_CHECK_INTERVAL:10s}
+ # Combine existing profiling data and report to the backend interval
+ flush_interval: ${ROVER_PROFILING_FLUSH_INTERVAL:5s}
+ # Customize profiling task config
+ task:
+ # The config when executing ON_CPU profiling task
+ on_cpu:
+ # The profiling stack dump period
+ dump_period: ${ROVER_PROFILING_TASK_ON_CPU_DUMP_PERIOD:9ms}
+ network:
+ # The interval of send metrics to the backend
+ report_interval:
${ROVER_PROFILING_TASK_NETWORK_TOPOLOGY_REPORT_INTERVAL:2s}
+ # The prefix of network profiling metrics name
+ meter_prefix:
${ROVER_PROFILING_TASK_NETWORK_TOPOLOGY_METER_PREFIX:rover_net_p}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/base/ssl/gen-selfsigned-ssl.sh
b/test/e2e/cases/profiling/network/base/ssl/gen-selfsigned-ssl.sh
new file mode 100755
index 0000000..1873532
--- /dev/null
+++ b/test/e2e/cases/profiling/network/base/ssl/gen-selfsigned-ssl.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+#
+# 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.
+#
+
+set -e
+
+HOST=${1:-localhost}
+PASSWORD=test
+CUR_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+root_key="$CUR_DIR/root_${HOST}.key"
+root_csr="$CUR_DIR/root_${HOST}.csr"
+root_crt="$CUR_DIR/root_${HOST}.crt"
+
+key="$CUR_DIR/${HOST}.key"
+csr="$CUR_DIR/${HOST}.csr"
+crt="$CUR_DIR/${HOST}.crt"
+
+CountryName=CN
+StateORProvinceName=beijing
+LocalityName=beijing
+OrgName=sky
+OrgUnitName=sky
+CommonName=$HOST
[email protected]
+ChallengePwd=.
+OptionalComName=.
+
+# root ca
+openssl genrsa -des3 -out $root_key -passout pass:$PASSWORD 2048
+
+openssl req -new -key $root_key -out $root_csr -passin pass:$PASSWORD -passout
pass:$PASSWORD <<EOF
+${CountryName}
+${StateORProvinceName}
+${LocalityName}
+${OrgName}
+${OrgUnitName}
+${CommonName}
+${Email}
+${ChallengePwd}
+${OptionalComName}
+EOF
+
+openssl x509 -req -days 365 -sha256 -signkey $root_key -in $root_csr -out
$root_crt -passin pass:$PASSWORD -extfile <(printf
"subjectAltName=DNS:$HOST,DNS:localhost,IP:127.0.0.1")
+
+openssl genrsa -des3 -out $key -passout pass:$PASSWORD 2048
+
+openssl rsa -in $key -out $key -passin pass:$PASSWORD
+
+openssl req -new -key $key -out $csr <<EOF
+${CountryName}
+${StateORProvinceName}
+${LocalityName}
+${OrgName}
+${OrgUnitName}
+${CommonName}
+${Email}
+${ChallengePwd}
+${OptionalComName}
+EOF
+
+openssl x509 -req -days 365 -sha256 -CA $root_crt -CAkey $root_key
-CAcreateserial -in $csr -out $crt -passin pass:$PASSWORD -extfile <(printf
"subjectAltName=DNS:$HOST,DNS:localhost,IP:127.0.0.1")
+
+# adding trusted root certificates to the server
+sudo cp $root_crt $crt /usr/local/share/ca-certificates/
+sudo update-ca-certificates
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/c_plus_plus/CMakeLists.txt
b/test/e2e/cases/profiling/network/c_plus_plus/CMakeLists.txt
new file mode 100644
index 0000000..7bf20dc
--- /dev/null
+++ b/test/e2e/cases/profiling/network/c_plus_plus/CMakeLists.txt
@@ -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.
+
+cmake_minimum_required(VERSION 3.14)
+project(service)
+
+AUX_SOURCE_DIRECTORY(src DIR_SRCS)
+add_executable(service ${DIR_SRCS})
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall ")
+set(CMAKE_BUILD_TYPE Debug)
+include_directories(include)
+
+find_package(OpenSSL REQUIRED)
+if(OPENSSL_FOUND)
+ set(HTTPLIB_IS_USING_OPENSSL TRUE)
+endif()
+
+target_link_libraries(service PUBLIC
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::SSL>
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::Crypto>)
+
+target_compile_definitions(service PUBLIC
+ $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT>
+ )
+
+include(FetchContent)
+FetchContent_Declare(httplib GIT_REPOSITORY
https://github.com/yhirose/cpp-httplib.git
+ GIT_TAG d92c31446687cfa336a6332b1015b4fe289fbdec) #
The commit hash for 0.11.1
+FetchContent_MakeAvailable(httplib)
+target_link_libraries(service PRIVATE httplib::httplib)
diff --git a/test/e2e/cases/profiling/network/c_plus_plus/Dockerfile
b/test/e2e/cases/profiling/network/c_plus_plus/Dockerfile
new file mode 100644
index 0000000..aa962dd
--- /dev/null
+++ b/test/e2e/cases/profiling/network/c_plus_plus/Dockerfile
@@ -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.
+
+FROM rikorose/gcc-cmake:gcc-8
+
+WORKDIR /
+COPY c_plus_plus /c_plus_plus
+
+COPY base/ssl /usr/local/share/ca-certificates/ssl
+RUN update-ca-certificates
+
+RUN cd /c_plus_plus/ && \
+ cmake -S . -B build && \
+ cd build && \
+ make && \
+ cp ./service /
+
+EXPOSE 10443
+
+CMD ["/service"]
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/c_plus_plus/docker-compose.yml
b/test/e2e/cases/profiling/network/c_plus_plus/docker-compose.yml
new file mode 100644
index 0000000..ea2a53d
--- /dev/null
+++ b/test/e2e/cases/profiling/network/c_plus_plus/docker-compose.yml
@@ -0,0 +1,61 @@
+# 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:
+ service:
+ build:
+ context: ../
+ dockerfile: c_plus_plus/Dockerfile
+ networks:
+ - e2e
+ volumes:
+ - ./../base/ssl:/ssl_data
+ ports:
+ - 10443:10443
+ healthcheck:
+ test: [ "CMD", "bash", "-c", "cat < /dev/null >
/dev/tcp/127.0.0.1/10443" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ proxy:
+ extends:
+ file: ../base/docker-compose.yml
+ service: proxy
+ networks:
+ - e2e
+ depends_on:
+ service:
+ condition: service_healthy
+
+ oap:
+ extends:
+ file: ../base/docker-compose.yml
+ service: oap
+ ports:
+ - 12800:12800
+
+ rover:
+ extends:
+ file: ../base/docker-compose.yml
+ service: rover
+ depends_on:
+ oap:
+ condition: service_healthy
+
+networks:
+ e2e:
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/c_plus_plus/e2e.yaml
similarity index 50%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/c_plus_plus/e2e.yaml
index a7733c4..e1bf3ab 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/c_plus_plus/e2e.yaml
@@ -13,8 +13,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
+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
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+trigger:
+ action: http
+ interval: 3s
+ times: 10
+ url: https://${service_host}:${service_10443}/consumer
+ method: GET
+
+verify:
+ # verify with retry strategy
+ retry:
+ # max retry count
+ count: 20
+ # the interval between two retries, in millisecond.
+ interval: 10s
+ cases:
+ - includes:
+ - ../network-cases.yaml
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/c_plus_plus/src/main.cpp
b/test/e2e/cases/profiling/network/c_plus_plus/src/main.cpp
new file mode 100644
index 0000000..4f3088a
--- /dev/null
+++ b/test/e2e/cases/profiling/network/c_plus_plus/src/main.cpp
@@ -0,0 +1,57 @@
+// 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.
+
+#include <httplib.h>
+#include <iostream>
+
+#define SERVER_CERT_FILE "/ssl_data/service.crt"
+#define SERVER_PRIVATE_KEY_FILE "/ssl_data/service.key"
+
+using namespace httplib;
+
+int main(void) {
+ SSLServer svr(SERVER_CERT_FILE, SERVER_PRIVATE_KEY_FILE);
+ if (!svr.is_valid()) {
+ printf("server has an error...\n");
+ return -1;
+ }
+
+ svr.Get("/consumer", [](const Request &, Response &res) {
+ httplib::SSLClient cli("proxy", 443);
+
+ if (auto httpRes = cli.Get("/provider")) {
+ if (httpRes->status == 200) {
+ res.set_content(httpRes->body, "text/plain");
+ return;
+ }
+ } else {
+ std::cout << "error code: " << httpRes.error() << std::endl;
+ auto result = cli.get_openssl_verify_result();
+ if (result) {
+ std::cout << "verify error: " <<
X509_verify_cert_error_string(result) << std::endl;
+ }
+ }
+ res.set_content("failure", "text/plain");
+ });
+
+ svr.Get("/provider", [](const Request &, Response &res) {
+ res.set_content("service provider", "text/plain");
+ });
+
+ svr.listen("0.0.0.0", 10443);
+ return 0;
+}
diff --git a/test/e2e/cases/profiling/network/envoy/e2e.yaml
b/test/e2e/cases/profiling/network/envoy/e2e.yaml
new file mode 100644
index 0000000..cab20de
--- /dev/null
+++ b/test/e2e/cases/profiling/network/envoy/e2e.yaml
@@ -0,0 +1,179 @@
+# 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.
+
+setup:
+ env: kind
+ file: kind.yaml
+ init-system-environment: ../../../../base/env
+ kind:
+ import-images:
+ - apache/skywalking-rover:latest
+ expose-ports:
+ - namespace: istio-system
+ resource: service/skywalking-ui
+ port: 80
+ steps:
+ - name: set PATH
+ command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH
+ - name: install swctl
+ command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh
swctl
+ - name: install kubectl
+ command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh
kubectl
+ - name: install istio
+ command: |
+ bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh istioctl
+ istioctl install -y --set profile=demo
+ kubectl label namespace default istio-injection=enabled
+ - name: Install helm
+ command: bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh
helm
+ - name: Install SkyWalking
+ command: |
+ rm -rf skywalking-kubernetes && git clone
https://github.com/apache/skywalking-kubernetes.git
+ cd skywalking-kubernetes
+ cd chart
+ helm dep up skywalking
+ helm -n istio-system install skywalking skywalking \
+ --set fullnameOverride=skywalking \
+ --set elasticsearch.replicas=1 \
+ --set elasticsearch.minimumMasterNodes=1 \
+ --set elasticsearch.imageTag=7.5.1 \
+ --set
oap.env.SW_METER_ANALYZER_ACTIVE_FILES='network-profiling' \
+ --set oap.envoy.als.enabled=true \
+ --set oap.replicas=1 \
+ --set ui.image.repository=ghcr.io/apache/skywalking/ui \
+ --set ui.image.tag=${SW_OAP_COMMIT} \
+ --set oap.image.tag=${SW_OAP_COMMIT} \
+ --set
oap.image.repository=ghcr.io/apache/skywalking/oap \
+ --set oap.storageType=elasticsearch
+ wait:
+ - namespace: istio-system
+ resource: deployments/skywalking-oap
+ for: condition=available
+ - name: Deploy demo services
+ command: |
+ kubectl apply -f
https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/platform/kube/bookinfo.yaml
+ kubectl apply -f
https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/networking/bookinfo-gateway.yaml
+ kubectl apply -f
https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/networking/destination-rule-all.yaml
+ kubectl apply -f
https://raw.githubusercontent.com/istio/istio/$ISTIO_VERSION/samples/bookinfo/networking/virtual-service-all-v1.yaml
+ wait:
+ - namespace: default
+ resource: pod
+ for: condition=Ready
+ - name: Install SkyWalking Rover
+ command: |
+ envsubst < test/e2e/cases/profiling/network/envoy/rover.yaml | kubectl
apply -f -
+ wait:
+ - namespace: default
+ resource: pod
+ for: condition=Ready
+ - name: Generate traffic
+ path: traffic-gen.yaml
+ wait:
+ - namespace: default
+ resource: pod
+ for: condition=Ready
+ timeout: 25m
+
+verify:
+ retry:
+ count: 20
+ interval: 10s
+ cases:
+ # service list
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
service ls
+ expected: expected/service.yml
+ # service instance list
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
instance list --service-name=default::productpage
+ expected: expected/service-instance.yml
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
process list --service-name=default::productpage --instance-name=productpage
+ expected: expected/process.yml
+
+ # create network profiling task
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
profiling ebpf create network --service-name=default::productpage
--instance-name=productpage
+ expected: expected/profiling-create.yml
+ - query: swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
dep process --service-name default::productpage --instance-name=productpage
+ expected: expected/dependency-processs.yml
+
+ # single value of process relation, client/server side read/write
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name process_relation_client_write_cpm|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name process_relation_client_write_total_bytes|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name process_relation_client_write_avg_exe_time|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name process_relation_client_read_cpm|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name process_relation_server_write_cpm|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+
+ # histogram value of process relation, client side
write_rtt/write_exe/read time
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name=process_relation_client_write_rtt_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name=process_relation_client_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name=process_relation_client_read_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name=process_relation_server_write_rtt_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name=process_relation_server_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml
--base-url=http://${service_skywalking_ui_host}:${service_skywalking_ui_80}/graphql
metrics multiple-linear \
+ --service-name default::productpage --instance-name productpage
--process-name envoy \
+ --dest-service-name default::productpage --dest-instance-name
productpage --dest-process-name /usr/local/bin/python \
+ --name=process_relation_server_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
diff --git
a/test/e2e/cases/profiling/network/envoy/expected/dependency-processs.yml
b/test/e2e/cases/profiling/network/envoy/expected/dependency-processs.yml
new file mode 100644
index 0000000..3ec39ae
--- /dev/null
+++ b/test/e2e/cases/profiling/network/envoy/expected/dependency-processs.yml
@@ -0,0 +1,103 @@
+# 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.
+
+{{- define "genProcessId" }}
+{{- with $processName := . }}
+{{- with $serviceId := "default::productpage" | b64enc | printf "%s.1" }}
+{{- with $instanceId := "productpage" | b64enc | printf "%s_%s" $serviceId }}
+{{- printf "%s" (sha256enc (printf "%s_%s" $processName $instanceId)) }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end}}
+
+# ingress pod name
+{{ $ingressProcessName := "" }}
+{{ range .nodes }}
+{{ if hasPrefix .name "istio-ingressgateway" }}
+{{ $ingressProcessName = .name }}
+{{ end }}
+{{ end }}
+
+nodes:
+{{- contains .nodes }}
+- id: {{template "genProcessId" "/usr/local/bin/python"}}
+ name: /usr/local/bin/python
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceinstancename: productpage
+ isreal: true
+- id: {{template "genProcessId" "envoy"}}
+ name: envoy
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceinstancename: productpage
+ isreal: true
+- id: {{template "genProcessId" $ingressProcessName }}
+ name: {{$ingressProcessName}}
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceinstancename: productpage
+ isreal: false
+- id: {{template "genProcessId" "kube-dns.kube-system" }}
+ name: kube-dns.kube-system
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ serviceinstanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc
"productpage" }}
+ serviceinstancename: productpage
+ isreal: false
+{{- end }}
+calls:
+{{- contains .calls }}
+- source: {{template "genProcessId" "/usr/local/bin/python"}}
+ sourcecomponents:
+ - http
+ target: {{template "genProcessId" "envoy"}}
+ targetcomponents:
+ - http
+ id: {{template "genProcessId" "/usr/local/bin/python"}}-{{template
"genProcessId" "envoy"}}
+ detectpoints:
+ - CLIENT
+ - SERVER
+- source: {{template "genProcessId" "envoy"}}
+ sourcecomponents:
+ - http
+ target: {{template "genProcessId" "/usr/local/bin/python"}}
+ targetcomponents:
+ - http
+ id: {{template "genProcessId" "envoy"}}-{{template "genProcessId"
"/usr/local/bin/python"}}
+ detectpoints:
+ - CLIENT
+ - SERVER
+- source: {{template "genProcessId" $ingressProcessName}}
+ sourcecomponents: []
+ target: {{template "genProcessId" "envoy"}}
+ targetcomponents:
+ - https
+ id: {{template "genProcessId" $ingressProcessName}}-{{template
"genProcessId" "envoy"}}
+ detectpoints:
+ - SERVER
+- source: {{template "genProcessId" "envoy"}}
+ sourcecomponents:
+ - tcp
+ target: {{template "genProcessId" "kube-dns.kube-system"}}
+ targetcomponents: []
+ id: {{template "genProcessId" "envoy"}}-{{template "genProcessId"
"kube-dns.kube-system"}}
+ detectpoints:
+ - CLIENT
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/envoy/expected/metrics-has-value-label.yml
similarity index 76%
copy from test/e2e/base/env
copy to
test/e2e/cases/profiling/network/envoy/expected/metrics-has-value-label.yml
index a7733c4..a4becdf 100644
--- a/test/e2e/base/env
+++
b/test/e2e/cases/profiling/network/envoy/expected/metrics-has-value-label.yml
@@ -13,8 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- key: {{ notEmpty .key }}
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+{{- end }}
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/envoy/expected/metrics-has-value.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/envoy/expected/metrics-has-value.yml
index a7733c4..d9c4985 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/envoy/expected/metrics-has-value.yml
@@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/envoy/expected/process.yml
b/test/e2e/cases/profiling/network/envoy/expected/process.yml
new file mode 100644
index 0000000..498938b
--- /dev/null
+++ b/test/e2e/cases/profiling/network/envoy/expected/process.yml
@@ -0,0 +1,86 @@
+# 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: /usr/local/bin/python
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ instanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ instancename: productpage
+ agentid: {{ notEmpty .agentid }}
+ detecttype: KUBERNETES
+ attributes:
+ {{- contains .attributes }}
+ - name: host_ip
+ value: {{ notEmpty .value }}
+ - name: container_ip
+ value: {{ notEmpty .value }}
+ - name: pid
+ value: {{ notEmpty .value }}
+ - name: command_line
+ value: {{ notEmpty .value }}
+ - name: support_ebpf_profiling
+ value: "false"
+ {{- end }}
+ labels:
+ - mesh-application
+- id: {{ notEmpty .id }}
+ name: envoy
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ instanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ instancename: productpage
+ agentid: {{ notEmpty .agentid }}
+ detecttype: KUBERNETES
+ attributes:
+ {{- contains .attributes }}
+ - name: host_ip
+ value: {{ notEmpty .value }}
+ - name: container_ip
+ value: {{ notEmpty .value }}
+ - name: pid
+ value: {{ notEmpty .value }}
+ - name: command_line
+ value: {{ notEmpty .value }}
+ - name: support_ebpf_profiling
+ value: true
+ {{- end }}
+ labels:
+ - mesh-envoy
+- id: {{ notEmpty .id }}
+ name: pilot-agent
+ serviceid: {{ b64enc "default::productpage" }}.1
+ servicename: default::productpage
+ instanceid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ instancename: productpage
+ agentid: {{ notEmpty .agentid }}
+ detecttype: KUBERNETES
+ attributes:
+ {{- contains .attributes }}
+ - name: host_ip
+ value: {{ notEmpty .value }}
+ - name: container_ip
+ value: {{ notEmpty .value }}
+ - name: pid
+ value: {{ notEmpty .value }}
+ - name: command_line
+ value: {{ notEmpty .value }}
+ - name: support_ebpf_profiling
+ value: "false"
+ {{- end }}
+ labels:
+ - mesh-envoy
+{{- end }}
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/envoy/expected/profiling-create.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/envoy/expected/profiling-create.yml
index a7733c4..176b195 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/envoy/expected/profiling-create.yml
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+status: true
+errorreason: null
+id: {{ notEmpty .id }}
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/envoy/expected/service-instance.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/envoy/expected/service-instance.yml
index a7733c4..45640d7 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/envoy/expected/service-instance.yml
@@ -13,8 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- id: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage" }}
+ name: productpage
+ attributes: []
+ language: UNKNOWN
+ instanceuuid: {{ b64enc "default::productpage" }}.1_{{ b64enc "productpage"
}}
+{{- end }}
diff --git a/test/e2e/cases/profiling/network/envoy/expected/service.yml
b/test/e2e/cases/profiling/network/envoy/expected/service.yml
new file mode 100644
index 0000000..40bbced
--- /dev/null
+++ b/test/e2e/cases/profiling/network/envoy/expected/service.yml
@@ -0,0 +1,71 @@
+# 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 "default::details" }}.1
+ name: default::details
+ group: default
+ shortname: details
+ layers:
+ {{- contains .layers }}
+ - MESH_DP
+ - MESH
+ {{- end }}
+ normal: true
+- id: {{ b64enc "istio-system::istio-ingressgateway" }}.1
+ name: istio-system::istio-ingressgateway
+ group: istio-system
+ shortname: istio-ingressgateway
+ layers:
+ - MESH_DP
+ normal: true
+- id: {{ b64enc "default::productpage" }}.1
+ name: default::productpage
+ group: default
+ shortname: productpage
+ layers:
+ {{- contains .layers }}
+ - MESH_DP
+ - MESH
+ {{- end }}
+ normal: true
+- id: {{ b64enc "default::ratings" }}.1
+ name: default::ratings
+ group: default
+ shortname: ratings
+ layers:
+ {{- contains .layers }}
+ - MESH_DP
+ - MESH
+ {{- end }}
+ normal: true
+- id: {{ b64enc "default::reviews" }}.1
+ name: default::reviews
+ group: default
+ shortname: reviews
+ layers:
+ {{- contains .layers }}
+ - MESH_DP
+ - MESH
+ {{- end }}
+ normal: true
+- id: {{ b64enc "istio-system::istio-egressgateway" }}.1
+ name: istio-system::istio-egressgateway
+ group: istio-system
+ shortname: istio-egressgateway
+ layers:
+ - MESH_DP
+ normal: true
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/envoy/kind.yaml
similarity index 58%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/envoy/kind.yaml
index a7733c4..f9ba27e 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/envoy/kind.yaml
@@ -13,8 +13,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+# this config file contains all config fields with comments
+# NOTE: this is not a particularly useful config file
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+ # the control plane node config
+ - role: control-plane
+ extraMounts:
+ - hostPath: /
+ containerPath: /host
+ # the three workers
+ - role: worker
+ extraMounts:
+ - hostPath: /
+ containerPath: /host
+ - role: worker
+ extraMounts:
+ - hostPath: /
+ containerPath: /host
+ - role: worker
+ extraMounts:
+ - hostPath: /
+ containerPath: /host
diff --git a/test/e2e/cases/profiling/network/envoy/rover.yaml
b/test/e2e/cases/profiling/network/envoy/rover.yaml
new file mode 100644
index 0000000..90fa0de
--- /dev/null
+++ b/test/e2e/cases/profiling/network/envoy/rover.yaml
@@ -0,0 +1,103 @@
+# 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.
+
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: skywalking-rover
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: skywalking-rover
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: skywalking-rover
+subjects:
+ - kind: ServiceAccount
+ name: skywalking-rover
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: skywalking-rover
+rules:
+ - apiGroups: [""]
+ resources: ["pods", "nodes", "services"]
+ verbs: ["get", "watch", "list"]
+---
+
+apiVersion: apps/v1
+kind: DaemonSet
+metadata:
+ name: skywalking-rover
+spec:
+ selector:
+ matchLabels:
+ name: skywalking-rover
+ template:
+ metadata:
+ labels:
+ name: skywalking-rover
+ spec:
+ serviceAccountName: skywalking-rover
+ serviceAccount: skywalking-rover
+ containers:
+ - name: skywalking-rover
+ # SkyWalking Rover image path
+ image: apache/skywalking-rover:latest
+ imagePullPolicy: IfNotPresent
+ securityContext:
+ capabilities:
+ add:
+ - SYS_PTRACE
+ - SYS_ADMIN
+ privileged: true
+ volumeMounts:
+ - name: host
+ mountPath: /host
+ readOnly: true
+ env:
+ - name: ROVER_PROCESS_DISCOVERY_KUBERNETES_ACTIVE
+ value: "true"
+ - name: ROVER_PROCESS_DISCOVERY_KUBERNETES_NODE_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: spec.nodeName
+ - name: ROVER_BACKEND_ADDR
+ # backend OAP address
+ value: skywalking-oap.istio-system:11800
+ - name:
ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_K8S_SERVICE_ACTIVE
+ value: "false"
+ - name: ROVER_HOST_MAPPING
+ value: /host
+ - name: ROVER_LOGGER_LEVEL
+ value: DEBUG
+ - name:
ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_PROCESS_NAME
+ value: "{{.Process.ExeNameInCommandLine}}"
+ - name:
ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_ENVOY_INSTANCE_NAME
+ value: "{{.Pod.LabelValue
\"service.istio.io/canonical-name,app.kubernetes.io/name,app\" }}"
+ - name:
ROVER_PROCESS_DISCOVERY_KUBERNETES_ANALYZER_ISTIO_APPLICATION_INSTANCE_NAME
+ value: "{{.Pod.LabelValue
\"service.istio.io/canonical-name,app.kubernetes.io/name,app\" }}"
+ hostPID: true
+ hostNetwork: true
+ dnsPolicy: ClusterFirstWithHostNet
+ volumes:
+ - name: host
+ hostPath:
+ path: /host
+ type: Directory
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/envoy/traffic-gen.yaml
similarity index 57%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/envoy/traffic-gen.yaml
index a7733c4..73853c7 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/envoy/traffic-gen.yaml
@@ -13,8 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: trafficgenerator
+ labels:
+ app: trafficgenerator
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: trafficgenerator
+ template:
+ metadata:
+ annotations:
+ sidecar.istio.io/inject: "false"
+ labels:
+ app: trafficgenerator
+ spec:
+ containers:
+ - name: trafficgenerator
+ image: williamyeh/wrk
+ command: ["wrk", "-t1", "-c1", "-d2000m",
"http://istio-ingressgateway.istio-system:80/productpage"]
+ resources:
+ requests:
+ cpu: 0.1
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/expected/dependency-processs.yml
b/test/e2e/cases/profiling/network/expected/dependency-processs.yml
new file mode 100644
index 0000000..f96ed41
--- /dev/null
+++ b/test/e2e/cases/profiling/network/expected/dependency-processs.yml
@@ -0,0 +1,61 @@
+# 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.
+
+{{- define "genProcessId" }}
+{{- with $processName := . }}
+{{- with $serviceId := "service" | b64enc | printf "%s.1" }}
+{{- with $instanceId := "test" | b64enc | printf "%s_%s" $serviceId }}
+{{- printf "%s" (sha256enc (printf "%s_%s" $processName $instanceId)) }}
+{{- end }}
+{{- end }}
+{{- end }}
+{{- end}}
+
+nodes:
+{{- contains .nodes }}
+- id: {{template "genProcessId" "service"}}
+ name: service
+ serviceid: {{ b64enc "service" }}.1
+ servicename: service
+ serviceinstanceid: {{ b64enc "service" }}.1_{{ b64enc "test" }}
+ serviceinstancename: test
+ isreal: true
+- id: {{template "genProcessId" "UNKNOWN_REMOTE"}}
+ name: UNKNOWN_REMOTE
+ serviceid: {{ b64enc "service" }}.1
+ servicename: service
+ serviceinstanceid: {{ b64enc "service" }}.1_{{ b64enc "test" }}
+ serviceinstancename: test
+ isreal: false
+{{- end }}
+calls:
+{{- contains .calls }}
+- source: {{template "genProcessId" "service"}}
+ sourcecomponents:
+ - https
+ target: {{template "genProcessId" "UNKNOWN_REMOTE"}}
+ targetcomponents: []
+ id: {{template "genProcessId" "service"}}-{{template "genProcessId"
"UNKNOWN_REMOTE"}}
+ detectpoints:
+ - CLIENT
+- source: {{template "genProcessId" "UNKNOWN_REMOTE"}}
+ sourcecomponents: []
+ target: {{template "genProcessId" "service"}}
+ targetcomponents:
+ - https
+ id: {{template "genProcessId" "UNKNOWN_REMOTE"}}-{{template "genProcessId"
"service"}}
+ detectpoints:
+ - SERVER
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/expected/instance.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/expected/instance.yml
index a7733c4..ada9e9d 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/expected/instance.yml
@@ -13,8 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- id: {{ b64enc "service" }}.1_{{ b64enc "test" }}
+ name: test
+ attributes: []
+ language: UNKNOWN
+ instanceuuid: {{ notEmpty .instanceuuid }}
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/expected/metrics-has-value-label.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/expected/metrics-has-value-label.yml
index a7733c4..a4becdf 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/expected/metrics-has-value-label.yml
@@ -13,8 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- key: {{ notEmpty .key }}
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+{{- end }}
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/expected/metrics-has-value.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/expected/metrics-has-value.yml
index a7733c4..d9c4985 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/expected/metrics-has-value.yml
@@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+{{- 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/network/expected/process.yml
similarity index 62%
copy from test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml
copy to test/e2e/cases/profiling/network/expected/process.yml
index 10ea7f8..869ae06 100644
--- a/test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml
+++ b/test/e2e/cases/profiling/network/expected/process.yml
@@ -14,17 +14,26 @@
# limitations under the License.
{{- contains . }}
-- taskid: {{ notEmpty .taskid }}
- serviceid: {{ b64enc "file" }}.1
- servicename: file
- processlabels:
- {{- contains .processlabels }}
+- id: {{ notEmpty .id }}
+ name: service
+ serviceid: {{ b64enc "service" }}.1
+ servicename: service
+ instanceid: {{ b64enc "service" }}.1_{{ b64enc "test" }}
+ instancename: test
+ agentid: {{ notEmpty .agentid }}
+ detecttype: VM
+ attributes:
+ {{- contains .attributes }}
+ - name: host_ip
+ value: {{ notEmpty .value }}
+ - name: pid
+ value: {{ notEmpty .value }}
+ - name: command_line
+ value: {{ notEmpty .value }}
+ {{- end }}
+ labels:
+ {{- contains .labels }}
- 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/base/env
b/test/e2e/cases/profiling/network/expected/profiling-create.yml
similarity index 76%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/expected/profiling-create.yml
index a7733c4..176b195 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/expected/profiling-create.yml
@@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+status: true
+errorreason: null
+id: {{ notEmpty .id }}
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/expected/service.yml
similarity index 74%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/expected/service.yml
index a7733c4..23e629f 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/expected/service.yml
@@ -13,8 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
-
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+{{- contains . }}
+- id: {{ b64enc "nginx" }}.1
+ name: nginx
+ group: ""
+ shortname: nginx
+ layers:
+ - OS_LINUX
+ normal: true
+- id: {{ b64enc "service" }}.1
+ name: service
+ group: ""
+ shortname: service
+ layers:
+ - OS_LINUX
+ normal: true
+{{- end }}
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/golang/Dockerfile
b/test/e2e/cases/profiling/network/golang/Dockerfile
new file mode 100644
index 0000000..c13a395
--- /dev/null
+++ b/test/e2e/cases/profiling/network/golang/Dockerfile
@@ -0,0 +1,26 @@
+# 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 golang/service.go /service.go
+RUN go build -o service service.go
+
+COPY base/ssl /usr/local/share/ca-certificates/ssl
+RUN update-ca-certificates
+
+CMD ["/service"]
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/golang/docker-compose.yml
b/test/e2e/cases/profiling/network/golang/docker-compose.yml
new file mode 100644
index 0000000..592f410
--- /dev/null
+++ b/test/e2e/cases/profiling/network/golang/docker-compose.yml
@@ -0,0 +1,61 @@
+# 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:
+ service:
+ build:
+ context: ../
+ dockerfile: golang/Dockerfile
+ networks:
+ - e2e
+ volumes:
+ - ./../base/ssl:/ssl_data
+ ports:
+ - 10443:10443
+ healthcheck:
+ test: [ "CMD", "bash", "-c", "cat < /dev/null >
/dev/tcp/127.0.0.1/10443" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ proxy:
+ extends:
+ file: ../base/docker-compose.yml
+ service: proxy
+ networks:
+ - e2e
+ depends_on:
+ service:
+ condition: service_healthy
+
+ oap:
+ extends:
+ file: ../base/docker-compose.yml
+ service: oap
+ ports:
+ - 12800:12800
+
+ rover:
+ extends:
+ file: ../base/docker-compose.yml
+ service: rover
+ depends_on:
+ oap:
+ condition: service_healthy
+
+networks:
+ e2e:
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/golang/e2e.yaml
similarity index 50%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/golang/e2e.yaml
index a7733c4..e1bf3ab 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/golang/e2e.yaml
@@ -13,8 +13,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
+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
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+trigger:
+ action: http
+ interval: 3s
+ times: 10
+ url: https://${service_host}:${service_10443}/consumer
+ method: GET
+
+verify:
+ # verify with retry strategy
+ retry:
+ # max retry count
+ count: 20
+ # the interval between two retries, in millisecond.
+ interval: 10s
+ cases:
+ - includes:
+ - ../network-cases.yaml
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/golang/service.go
b/test/e2e/cases/profiling/network/golang/service.go
new file mode 100644
index 0000000..f1bf539
--- /dev/null
+++ b/test/e2e/cases/profiling/network/golang/service.go
@@ -0,0 +1,52 @@
+// 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 main
+
+import (
+ "io/ioutil"
+ "log"
+ "net/http"
+)
+
+func provider(w http.ResponseWriter, req *http.Request) {
+ w.Header().Set("Content-Type", "text/plain")
+ _, _ = w.Write([]byte("service provider\n"))
+}
+
+func consumer(w http.ResponseWriter, req *http.Request) {
+ addr := "https://proxy/provider"
+ get, err := http.Get(addr)
+ if err != nil {
+ log.Printf("send request error: %v", err)
+ }
+ all, err := ioutil.ReadAll(get.Body)
+ _ = get.Body.Close()
+ if err != nil {
+ log.Printf("get response body error: %v", err)
+ }
+
+ w.Header().Set("Content-Type", "text/plain")
+ _, _ = w.Write(all)
+}
+
+func main() {
+ http.HandleFunc("/provider", provider)
+ http.HandleFunc("/consumer", consumer)
+ err := http.ListenAndServeTLS(":10443", "/ssl_data/service.crt",
"/ssl_data/service.key", nil)
+ log.Fatal(err)
+}
diff --git a/test/e2e/cases/profiling/network/network-cases.yaml
b/test/e2e/cases/profiling/network/network-cases.yaml
new file mode 100644
index 0000000..53c1c43
--- /dev/null
+++ b/test/e2e/cases/profiling/network/network-cases.yaml
@@ -0,0 +1,94 @@
+# 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.
+
+cases:
+ # service list
+ - query: swctl --display yaml
--base-url=http://${oap_host}:${oap_12800}/graphql service ls
+ expected: expected/service.yml
+ # service instance list
+ - query: swctl --display yaml
--base-url=http://${oap_host}:${oap_12800}/graphql instance list
--service-name=service
+ expected: expected/instance.yml
+ - query: swctl --display yaml
--base-url=http://${oap_host}:${oap_12800}/graphql process list
--service-name=service --instance-name=test
+ expected: expected/process.yml
+
+ # create network profiling task
+ - query: swctl --display yaml
--base-url=http://${oap_host}:${oap_12800}/graphql profiling ebpf create
network --service-name=service --instance-name=test
+ expected: expected/profiling-create.yml
+ - query: swctl --display yaml
--base-url=http://${oap_host}:${oap_12800}/graphql dep process --service-name
service --instance-name=test
+ expected: expected/dependency-processs.yml
+
+ # single value of process relation, client/server side read/write
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics linear \
+ --service-name service --instance-name test --process-name service \
+ --dest-service-name service --dest-instance-name test
--dest-process-name UNKNOWN_REMOTE \
+ --name process_relation_client_write_cpm|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics linear \
+ --service-name service --instance-name test --process-name service \
+ --dest-service-name service --dest-instance-name test
--dest-process-name UNKNOWN_REMOTE \
+ --name process_relation_client_write_total_bytes|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics linear \
+ --service-name service --instance-name test --process-name service \
+ --dest-service-name service --dest-instance-name test
--dest-process-name UNKNOWN_REMOTE \
+ --name process_relation_client_write_avg_exe_time|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics linear \
+ --service-name service --instance-name test --process-name service \
+ --dest-service-name service --dest-instance-name test
--dest-process-name UNKNOWN_REMOTE \
+ --name process_relation_client_read_cpm|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics linear \
+ --service-name service --instance-name test --process-name
UNKNOWN_REMOTE \
+ --dest-service-name service --dest-instance-name test
--dest-process-name service \
+ --name process_relation_server_write_cpm|yq e 'to_entries' -
+ expected: expected/metrics-has-value.yml
+
+ # histogram value of process relation, client side write_rtt/write_exe/read
time
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics multiple-linear \
+ --service-name service --instance-name test --process-name service \
+ --dest-service-name service --dest-instance-name test
--dest-process-name UNKNOWN_REMOTE \
+ --name=process_relation_client_write_rtt_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics multiple-linear \
+ --service-name service --instance-name test --process-name service \
+ --dest-service-name service --dest-instance-name test
--dest-process-name UNKNOWN_REMOTE \
+ --name=process_relation_client_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics multiple-linear \
+ --service-name service --instance-name test --process-name
UNKNOWN_REMOTE \
+ --dest-service-name service --dest-instance-name test
--dest-process-name service \
+ --name=process_relation_server_write_rtt_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics multiple-linear \
+ --service-name service --instance-name test --process-name
UNKNOWN_REMOTE \
+ --dest-service-name service --dest-instance-name test
--dest-process-name service \
+ --name=process_relation_server_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql
metrics multiple-linear \
+ --service-name service --instance-name test --process-name
UNKNOWN_REMOTE \
+ --dest-service-name service --dest-instance-name test
--dest-process-name service \
+ --name=process_relation_server_write_exe_time_percentile|yq e
'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ expected: expected/metrics-has-value-label.yml
diff --git a/test/e2e/cases/profiling/network/python/Dockerfile
b/test/e2e/cases/profiling/network/python/Dockerfile
new file mode 100644
index 0000000..debe1b8
--- /dev/null
+++ b/test/e2e/cases/profiling/network/python/Dockerfile
@@ -0,0 +1,29 @@
+# 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 python:3.8.13
+
+WORKDIR /
+COPY python/service.py /service.py
+COPY python/requirements.txt /
+RUN pip install -r /requirements.txt
+
+COPY base/ssl /usr/local/share/ca-certificates/ssl
+RUN update-ca-certificates
+
+EXPOSE 10443
+
+CMD ["python", "/service.py"]
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/python/docker-compose.yml
b/test/e2e/cases/profiling/network/python/docker-compose.yml
new file mode 100644
index 0000000..5e0e576
--- /dev/null
+++ b/test/e2e/cases/profiling/network/python/docker-compose.yml
@@ -0,0 +1,64 @@
+# 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:
+ service:
+ build:
+ context: ../
+ dockerfile: python/Dockerfile
+ networks:
+ - e2e
+ volumes:
+ - ./../base/ssl:/ssl_data
+ ports:
+ - 10443:10443
+ healthcheck:
+ test: [ "CMD", "bash", "-c", "cat < /dev/null >
/dev/tcp/127.0.0.1/10443" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ proxy:
+ extends:
+ file: ../base/docker-compose.yml
+ service: proxy
+ networks:
+ - e2e
+ depends_on:
+ service:
+ condition: service_healthy
+
+ oap:
+ extends:
+ file: ../base/docker-compose.yml
+ service: oap
+ ports:
+ - 12800:12800
+
+ rover:
+ extends:
+ file: ../base/docker-compose.yml
+ service: rover
+ environment:
+ ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_MATCH_CMD2: service.py
+ ROVER_PROCESS_DISCOVERY_REGEX_SCANNER_PROCESS_NAME2: service
+ depends_on:
+ oap:
+ condition: service_healthy
+
+networks:
+ e2e:
\ No newline at end of file
diff --git a/test/e2e/base/env
b/test/e2e/cases/profiling/network/python/e2e.yaml
similarity index 50%
copy from test/e2e/base/env
copy to test/e2e/cases/profiling/network/python/e2e.yaml
index a7733c4..e1bf3ab 100644
--- a/test/e2e/base/env
+++ b/test/e2e/cases/profiling/network/python/e2e.yaml
@@ -13,8 +13,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-SW_CTL_COMMIT=bdcba1c93b1ad702a88f30b798df5e99d963689d
-SW_OAP_COMMIT=47509715f5a76aef33d0987be6302f7b31315bf0
-SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
+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
-SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582
\ No newline at end of file
+trigger:
+ action: http
+ interval: 3s
+ times: 10
+ url: https://${service_host}:${service_10443}/consumer
+ method: GET
+
+verify:
+ # verify with retry strategy
+ retry:
+ # max retry count
+ count: 20
+ # the interval between two retries, in millisecond.
+ interval: 10s
+ cases:
+ - includes:
+ - ../network-cases.yaml
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/python/requirements.txt
b/test/e2e/cases/profiling/network/python/requirements.txt
new file mode 100644
index 0000000..fd9d703
--- /dev/null
+++ b/test/e2e/cases/profiling/network/python/requirements.txt
@@ -0,0 +1,17 @@
+# 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.
+
+requests==2.25.0
\ No newline at end of file
diff --git a/test/e2e/cases/profiling/network/python/service.py
b/test/e2e/cases/profiling/network/python/service.py
new file mode 100644
index 0000000..1ef8b6e
--- /dev/null
+++ b/test/e2e/cases/profiling/network/python/service.py
@@ -0,0 +1,59 @@
+# 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 http.server import HTTPServer, BaseHTTPRequestHandler
+import ssl
+import requests
+from contextlib import contextmanager
+from socketserver import ThreadingMixIn
+
+@contextmanager
+def disable_ssl_warnings():
+ import warnings
+ import urllib3
+
+ with warnings.catch_warnings():
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+ yield None
+
+class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
+
+ def do_GET(self):
+ if self.path == '/consumer':
+ try:
+ r = requests.get("https://proxy/provider", verify=False)
+ self.send_response(200)
+ self.end_headers()
+ self.wfile.write(r.content)
+ except:
+ self.send_response(200)
+ self.end_headers()
+ self.wfile.write(b'error')
+ return
+
+ self.send_response(200)
+ self.end_headers()
+ self.wfile.write(b'service provider')
+ return
+
+class ThreadingSimpleServer(ThreadingMixIn,HTTPServer):
+ pass
+
+httpd = ThreadingSimpleServer(('0.0.0.0', 10443), SimpleHTTPRequestHandler)
+httpd.socket = ssl.wrap_socket (httpd.socket,
+ keyfile="/ssl_data/service.key",
+ certfile='/ssl_data/service.crt', server_side=True)
+httpd.serve_forever()
\ 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
index 10ea7f8..49ea171 100644
--- a/test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml
+++ b/test/e2e/cases/profiling/offcpu/expected/profiling-task-list.yml
@@ -17,6 +17,8 @@
- taskid: {{ notEmpty .taskid }}
serviceid: {{ b64enc "file" }}.1
servicename: file
+ serviceinstanceid: null
+ serviceinstancename: null
processlabels:
{{- contains .processlabels }}
- e2e-label1
diff --git a/test/e2e/cases/profiling/oncpu/expected/profiling-task-list.yml
b/test/e2e/cases/profiling/oncpu/expected/profiling-task-list.yml
index f561c46..faa04bc 100644
--- a/test/e2e/cases/profiling/oncpu/expected/profiling-task-list.yml
+++ b/test/e2e/cases/profiling/oncpu/expected/profiling-task-list.yml
@@ -17,6 +17,8 @@
- taskid: {{ notEmpty .taskid }}
serviceid: {{ b64enc "sqrt" }}.1
servicename: sqrt
+ serviceinstanceid: null
+ serviceinstancename: null
processlabels:
{{- contains .processlabels }}
- e2e-label1