diff --git a/.github/actions/infra-e2e-test/action.yml b/.github/actions/infra-e2e-test/action.yml new file mode 100644 index 0000000000000000000000000000000000000000..9eb9a36ea3339475ae954d3d1efdc2995db37676 --- /dev/null +++ b/.github/actions/infra-e2e-test/action.yml @@ -0,0 +1,65 @@ +# +# 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. +# +name: 'Run Infra E2E Test' +description: 'Common steps when running an E2E Test' +inputs: + config-file: + description: 'The e2e test config file path' + required: true +runs: + using: "composite" + steps: + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Check License + uses: apache/skywalking-eyes@a63f4afcc287dfb3727ecc45a4afc55a5e69c15f + - name: Setup E2E env + shell: bash + run: | + function export_env() { + echo "$1=$2" >> $GITHUB_ENV + } + + export_env SW_AGENT_JAVA_COMMIT 3997f0256056788bd054ee37e4603c11c0fd6756 + export_env SW_AGENT_SATELLITE_COMMIT 1f3c08a5af19f8522f2a40d9339c45fa816bfe07 + - name: Build Docker Image + shell: bash + env: + SKIP_TEST: "true" + run: | + echo "::group::Build Docker Image" + # Retry one more time due to frequent "maven connection reset" + make docker || make docker + echo "::endgroup::" + - name: Build Java Test Services + shell: bash + run: | + echo "::group::build java test services" + # Retry one more time due to frequent "maven connection reset" + ./mvnw --batch-mode -f test/e2e-v2/java-test-service/pom.xml clean package + echo "::endgroup::" + - name: Run E2E Test + uses: apache/skywalking-infra-e2e@main + with: + e2e-file: $GITHUB_WORKSPACE/test/e2e-v2/cases/${{ inputs.config-file }} diff --git a/.github/workflows/e2e.satellite.yaml b/.github/workflows/e2e.satellite.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8e47e3c853bc1478273ef212184b05331fa5ce2d --- /dev/null +++ b/.github/workflows/e2e.satellite.yaml @@ -0,0 +1,50 @@ +# 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. + +name: E2E + +on: + pull_request: + paths: + - '**' + - '!**.md' + schedule: + - cron: '0 18 * * *' + +env: + SW_AGENT_JDK_VERSION: 8 + SW_STORAGE: h2 + +concurrency: + group: e2e-satellite-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + Satellite: + if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule') + name: Satellite + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set Skip Env Var + uses: ./.github/actions/skip + - name: Run E2E Test + if: env.SKIP_CI != 'true' + uses: ./.github/actions/infra-e2e-test + with: + config-file: satellite/native-protocols/e2e.yaml \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/Dockerfile.satellite b/test/e2e-v2/cases/satellite/Dockerfile.satellite new file mode 100644 index 0000000000000000000000000000000000000000..60aace55073dfc8f22542d18e79686487248f4fd --- /dev/null +++ b/test/e2e-v2/cases/satellite/Dockerfile.satellite @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG SW_AGENT_SATELLITE_COMMIT=1f3c08a5af19f8522f2a40d9339c45fa816bfe07 +FROM ghcr.io/apache/skywalking-satellite/skywalking-satellite:v${SW_AGENT_SATELLITE_COMMIT} as base + +FROM alpine:3.10 + +COPY --from=base /skywalking-satellite /sw-satellite +COPY --from=base /skywalking/configs /skywalking/ + +ENTRYPOINT ["/sw-satellite", "start", "--config", "/skywalking/configs/satellite_config.yaml"] \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml b/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..eab6804975a1c15e3d90c166dfc9e19e0865073c --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml @@ -0,0 +1,111 @@ +# 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: + + etcd: + hostname: etcd + image: quay.io/coreos/etcd:v3.5.0 + ports: + - 2379 + networks: + - e2e + environment: + ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 + ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 + ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380 + ETCD_INITIAL_ADVERTISE_PEER_URLS: http://0.0.0.0:2380 + ETCD_INITIAL_CLUSTER: s1=http://0.0.0.0:2380 + ETCD_NAME: s1 + ETCD_DATA_DIR: /etcd-data + healthcheck: + test: ["CMD", "sh", "-c", "etcdctl endpoint health" ] + interval: 5s + timeout: 60s + retries: 120 + + oap: + extends: + file: ../../../script/docker-compose/base-compose.yml + service: oap + environment: + SW_LOG_LAL_FILES: test + SW_CLUSTER: etcd + SW_METER_ANALYZER_ACTIVE_FILES: spring-sleuth + SW_CONFIGURATION: etcd + volumes: + - ./lal.yaml:/skywalking/config/lal/test.yaml + ports: + - 12800 + depends_on: + etcd: + condition: service_healthy + + satellite: + build: + context: ../ + dockerfile: Dockerfile.satellite + args: + - SW_AGENT_SATELLITE_COMMIT=${SW_AGENT_SATELLITE_COMMIT} + expose: + - 11800 + environment: + SATELLITE_GRPC_CLIENT: oap:11800 + SATELLITE_LOGPIPE_SENDER_MIN_FLUSH_EVENTS: 1 + SW_AGENT_SATELLITE_COMMIT: ${SW_AGENT_SATELLITE_COMMIT} + volumes: + - ./satellite_config.yaml:/skywalking/configs/satellite_config.yaml + networks: + - e2e + healthcheck: + test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 11800" ] + interval: 5s + timeout: 60s + retries: 120 + + provider: + extends: + file: ../../../script/docker-compose/base-compose.yml + service: provider + environment: + SW_AGENT_COLLECTOR_BACKEND_SERVICES: satellite:11800 + SW_GRPC_LOG_SERVER_HOST: satellite + SW_GRPC_LOG_SERVER_PORT: 11800 + ports: + - 9090 + depends_on: + satellite: + condition: service_healthy + + consumer: + extends: + file: ../../../script/docker-compose/base-compose.yml + service: consumer + environment: + SW_AGENT_COLLECTOR_BACKEND_SERVICES: satellite:11800 + SW_GRPC_LOG_SERVER_HOST: satellite + SW_GRPC_LOG_SERVER_PORT: 11800 + ports: + - 9092 + depends_on: + satellite: + condition: service_healthy + provider: + condition: service_healthy + +networks: + e2e: \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml b/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml new file mode 100644 index 0000000000000000000000000000000000000000..98f98290a98385fc9b9c8ba5ce06a229a74ad789 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml @@ -0,0 +1,126 @@ +# 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: compose + file: docker-compose.yml + timeout: 1200 + steps: + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + - name: install etcdctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh etcdctl + +cleanup: + # always never success failure + on: no + +trigger: + action: http + interval: 10s + times: 10 + url: http://${consumer_host}:${consumer_9092}/info + method: POST + +verify: + # verify with retry strategy + retry: + # max retry count + count: 20 + # the interval between two retries, in millisecond. + interval: 10000 + cases: + # basic check: service list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls + expected: expected/service.yml + # basic check: service metrics + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name service_sla --service=e2e-service-provider |yq e 'to_entries' - + expected: expected/metrics-has-value.yml + # basic check: service endpoint + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint list --keyword=info --service-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls|grep -B 1 'provider'|yq e '.[0].id' -) + expected: expected/service-endpoint.yml + # basic check: service endpoint metrics + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint=POST:/info --service=e2e-service-provider |yq e 'to_entries' - + expected: expected/metrics-has-value.yml + # basic check: dependency service + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql dependency service $(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls|grep -B 1 'provider'|yq e '.[0].id' -) + expected: expected/dependency-services.yml + + # native management: service instance list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance list --service-name=e2e-service-provider + expected: expected/service-instance.yml + + # native jvm: service instance jvm metrics + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name instance_jvm_thread_live_count --instance=provider1 --service=e2e-service-provider |yq e 'to_entries' - + expected: expected/metrics-has-value.yml + + # native tracing: trace segment list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls + expected: expected/traces-list.yml + # native tracing: trace detail + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace $(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls|grep -A 5 '/info'|tail -n1|awk -F ' ' '{print $2}') + expected: expected/trace-info-detail.yml + + # native meter: instance meter + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name meter_jvm_classes_loaded --instance=provider1 --service=e2e-service-provider |yq e 'to_entries' - + expected: expected/metrics-has-value.yml + + # native event: event list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql event list + expected: expected/event-list.yml + + # native log: logs list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql logs list --service-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls|grep -B 1 'provider'|yq e '.[0].id' -) --trace-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls|grep -A 5 '/info'|tail -n1|awk -F ' ' '{print $2}') + expected: expected/logs-list.yml + + # native profile: create task + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile create --service-name=e2e-service-provider --endpoint=POST:/info --start-time=$((($(date +%s)+5)*1000)) --duration=1 --min-duration-threshold=0 --dump-period=10 --max-sampling-count=9 + expected: expected/profile-create.yml + # native profile: sleep to wait agent notices and query profile list + - query: sleep 10 && swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list -service-name=e2e-service-provider --endpoint=POST:/info + expected: expected/profile-list.yml + # native profile: sleep to wait segment report and query profiled segment list + - query: | + curl -X POST http://${consumer_host}:${consumer_9092}/info > /dev/null; + sleep 5; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint=POST:/info|yq e '.[0].id' -) + expected: expected/profile-segment-list.yml + # native profile: query profiled segment + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-segment --segment-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint=POST:/info|yq e '.[0].id' -) | yq e '.[0].segmentid' -) + expected: expected/profile-segment-detail.yml + # native profile: query profiled segment + - query: | + segmentid=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint=POST:/info|yq e '.[0].id' -) |yq e '.[0].segmentid' -); + start=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-segment --segment-id=$segmentid|yq e '.spans.[0].starttime' -); + end=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-segment --segment-id=$segmentid|yq e '.spans.[0].endtime' -); + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-analyze --segment-id=$segmentid --time-ranges=$(echo $start"-"$end) + expected: expected/profile-segment-analyze.yml + + # native CDS: using etcdctl to update trace span limit, "/users" should have more than one span because it need DB save + - query: | + etcdctl --endpoints http://${etcd_host}:${etcd_2379}/ put /skywalking/configuration-discovery.default.agentConfigurations 'configurations: + e2e-service-provider: + agent.span_limit_per_segment: 1' | yq e '{"message": .}' - + expected: expected/etcd-put.yml + - query: | + sleep 5; + curl -X POST http://${provider_host}:${provider_9090}/users -d '{}' -H "Content-Type: application/json" > /dev/null; + sleep 5; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace $(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace list --step=SECOND --service-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls|grep -B 1 'provider'|yq e '.[0].id' -)|grep -A 5 "/users"|head -n 6|tail -n1|awk -F ' ' '{print $2}') + expected: expected/trace-users-detail.yml \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/dependency-services.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/dependency-services.yml new file mode 100644 index 0000000000000000000000000000000000000000..8ec023dc9f0b9e4580e1d8a1e8a324b4fd964b7d --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/dependency-services.yml @@ -0,0 +1,58 @@ +# 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. + +nodes: +{{- range .nodes }} +{{- if eq .name "User" }} +- id: {{ b64enc "User" }}.0 + name: User + type: USER + isreal: false +{{- end }} +{{- if eq .name "e2e-service-provider" }} +- id: {{ b64enc "e2e-service-provider"}}.1 + name: e2e-service-provider + type: Tomcat + isreal: true +{{- end }} +{{- if eq .name "e2e-service-consumer" }} +- id: {{ b64enc "e2e-service-consumer"}}.1 + name: e2e-service-consumer + type: Tomcat + isreal: true +{{- end }} +{{- end }} +calls: +{{- range .calls }} +{{- if eq .source "ZTJlLXNlcnZpY2UtY29uc3VtZXI=.1" }} +- source: {{ b64enc "e2e-service-consumer"}}.1 + sourcecomponents: [] + target: {{ b64enc "e2e-service-provider"}}.1 + targetcomponents: [] + id: {{ b64enc "e2e-service-consumer"}}.1-{{ b64enc "e2e-service-provider"}}.1 + detectpoints: + - CLIENT + - SERVER +{{- end }} +{{- if eq .source "VXNlcg==.0" }} +- source: {{ b64enc "User" }}.0 + sourcecomponents: [] + target: {{ b64enc "e2e-service-consumer"}}.1 + targetcomponents: [] + id: {{ b64enc "User" }}.0-{{ b64enc "e2e-service-consumer"}}.1 + detectpoints: + - SERVER +{{- end }} +{{- end }} diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/etcd-put.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/etcd-put.yml new file mode 100644 index 0000000000000000000000000000000000000000..3279e72e775add5283cc733bbe6bcfe8d2783ae5 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/etcd-put.yml @@ -0,0 +1,16 @@ +# 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. + +message: OK \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/event-list.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/event-list.yml new file mode 100644 index 0000000000000000000000000000000000000000..08b48797c843ff97c5a1997577ad6cf8630b5bc7 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/event-list.yml @@ -0,0 +1,42 @@ +# 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. + +events: +{{- range .events }} +- uuid: {{ notEmpty .uuid }} + source: + {{- if eq .source.service "e2e-service-provider" }} + service: e2e-service-provider + serviceinstance: provider1 + {{- end }} + {{- if eq .source.service "e2e-service-consumer" }} + service: e2e-service-consumer + serviceinstance: consumer1 + {{- end }} + endpoint: "" + name: Start + type: Normal + message: Start Java Application + parameters: + {{- range .parameters }} + {{- if eq .key "OPTS"}} + - key: OPTS + value: {{ notEmpty .value }} + {{- end }} + {{- end }} + starttime: {{ gt .starttime 0 }} + endtime: {{ gt .endtime 0 }} +{{- end }} +total: {{ gt .total 0 }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/logs-list.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/logs-list.yml new file mode 100644 index 0000000000000000000000000000000000000000..c13422dba7ce8bf8ef3af731ef65b004b61aac27 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/logs-list.yml @@ -0,0 +1,45 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +logs: +{{- range .logs }} + - servicename: e2e-service-provider + serviceid: {{ b64enc "e2e-service-provider" }}.1 + serviceinstancename: provider1 + serviceinstanceid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} + endpointname: null + endpointid: null + traceid: {{ .traceid }} + timestamp: {{ gt .timestamp 0 }} + contenttype: TEXT + content: | + {{ notEmpty .content }} + tags: + {{- range .tags }} + {{- if eq .key "level"}} + - key: level + value: INFO + {{- end }} + {{- if eq .key "logger" }} + - key: logger + value: {{ notEmpty .value }} + {{- end }} + {{- if eq .key "thread" }} + - key: thread + value: {{ notEmpty .value }} + {{- end }} + {{- end }} +{{- end }} +total: {{ gt .total 0 }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/metrics-has-value.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/metrics-has-value.yml new file mode 100644 index 0000000000000000000000000000000000000000..27ae47c8ffdca7dbedea229a0553223f46035dbe --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/metrics-has-value.yml @@ -0,0 +1,21 @@ +# 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 . }} +- key: {{ notEmpty .key }} + value: {{ ge .value 0 }} +- key: {{ notEmpty .key }} + value: {{ ge .value 1 }} +{{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/profile-create.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-create.yml new file mode 100644 index 0000000000000000000000000000000000000000..cec45288e59eda68b64942c3ddb4fd25ff432d86 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-create.yml @@ -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. + +id: {{ notEmpty .id }} +errorreason: null \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/profile-list.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-list.yml new file mode 100644 index 0000000000000000000000000000000000000000..f4144196d1763e6224b0a7aabd9a0084a0f5fff5 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-list.yml @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- range . }} +- id: {{ notEmpty .id }} + serviceid: {{ b64enc "e2e-service-provider" }}.1 + servicename: "" + endpointname: POST:/info + starttime: {{ gt .starttime 0 }} + duration: 1 + mindurationthreshold: 0 + dumpperiod: 10 + maxsamplingcount: 9 + logs: + {{- range .logs }} + - id: {{ notEmpty .id }} + instanceid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} + operationtype: {{ notEmpty .operationtype }} + instancename: "" + operationtime: {{ gt .operationtime 0 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-analyze.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-analyze.yml new file mode 100644 index 0000000000000000000000000000000000000000..2ce6611adf6fd27a0ad93828e382913dd06d5b36 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-analyze.yml @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +tip: null +trees: + {{- range .trees }} + - elements: + {{- contains .elements }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + codesignature: + {{- if eq .codesignature "java.lang.Thread.sleep:-2" }} + java.lang.Thread.sleep:-2 + {{- end }} + duration: {{ gt .duration 0 }} + durationchildexcluded: {{ gt .durationchildexcluded 0 }} + count: {{ gt .count 0 }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + codesignature: + {{- if ne .codesignature "java.lang.Thread.sleep:-2" }} + {{ notEmpty .codesignature }} + {{- end}} + duration: {{ ge .duration 0 }} + durationchildexcluded: {{ ge .durationchildexcluded 0 }} + count: {{ gt .count 0 }} + {{- end }} + {{- end }} diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-detail.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-detail.yml new file mode 100644 index 0000000000000000000000000000000000000000..28aeaefa8b4104b150e0cc5ea27c1135e2f9d4c9 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-detail.yml @@ -0,0 +1,42 @@ +# 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. + +spans: +{{- range .spans }} +- spanid: 0 + parentspanid: -1 + servicecode: e2e-service-provider + serviceinstancename: "" + starttime: {{ gt .starttime 0 }} + endtime: {{ gt .endtime 0 }} + endpointname: POST:/info + type: Entry + peer: "" + component: Tomcat + iserror: false + layer: Http + tags: + {{- range .tags }} + {{- if eq .key "url" }} + - key: url + value: {{ notEmpty .value }} + {{- end }} + {{- if eq .key "http.method" }} + - key: http.method + value: POST + {{- end }} + {{- end }} + logs: [] +{{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-list.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-list.yml new file mode 100644 index 0000000000000000000000000000000000000000..6c54147a23a4801b92f5859a1a7cb650f03aaac2 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-list.yml @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- range . }} +- segmentid: {{ notEmpty .segmentid }} + endpointnames: + - POST:/info + duration: {{ gt .duration 0 }} + start: "{{ notEmpty .start }}" + iserror: false + traceids: + {{- range .traceids }} + - {{ notEmpty . }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/service-endpoint.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/service-endpoint.yml new file mode 100644 index 0000000000000000000000000000000000000000..30b1efb4c70c444bbee5fbb6ea1ac7587b6c49ee --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/service-endpoint.yml @@ -0,0 +1,21 @@ +# 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. + +{{- range .}} +{{- if eq .name "POST:/info" }} +- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "POST:/info" }} + name: POST:/info +{{- end}} +{{- end}} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/service-instance.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/service-instance.yml new file mode 100644 index 0000000000000000000000000000000000000000..ef74087afa9d830bf3591c99b7a5bdc8e3c36d1a --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/service-instance.yml @@ -0,0 +1,54 @@ +# 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. + +{{- range .}} +- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} + name: {{ notEmpty .name }} + attributes: + {{- range .attributes }} + {{- if eq .name "OS Name" }} + - name: OS Name + value: Linux + {{- end }} + {{- if eq .name "hostname" }} + - name: hostname + value: {{ notEmpty .value }} + {{- end }} + {{- if eq .name "Process No." }} + - name: Process No. + value: "1" + {{- end }} + {{- if eq .name "Start Time" }} + - name: Start Time + value: {{ notEmpty .value }} + {{- end }} + {{- if eq .name "JVM Arguments" }} + - name: JVM Arguments + value: '{{ notEmpty .value }}' + {{- end }} + {{- if eq .name "Jar Dependencies" }} + - name: Jar Dependencies + value: '{{ notEmpty .value }}' + {{- end }} + {{- if eq .name "ipv4s" }} + - name: ipv4s + value: {{ notEmpty .value }} + {{- end }} + {{- end}} + language: JAVA + instanceuuid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} +{{- end}} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/service.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/service.yml new file mode 100644 index 0000000000000000000000000000000000000000..e299d8b97eca2aa2718fb0dbbc3fd2f2abcc23cf --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/service.yml @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- range . }} +{{- if eq .name "e2e-service-provider" }} +- id: {{ b64enc "e2e-service-provider" }}.1 + name: e2e-service-provider + group: "" +{{- end }} +{{- if eq .name "e2e-service-consumer" }} +- id: {{ b64enc "e2e-service-consumer" }}.1 + name: e2e-service-consumer + group: "" +{{- end }} +{{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/trace-info-detail.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/trace-info-detail.yml new file mode 100644 index 0000000000000000000000000000000000000000..836705a63ceace1cfa502ae350c1675f71bee9e9 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/trace-info-detail.yml @@ -0,0 +1,72 @@ +# 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. + +spans: + {{- range .spans}} + - traceid: {{ notEmpty .traceid }} + segmentid: {{ notEmpty .segmentid }} + spanid: {{ .spanid }} + parentspanid: {{ .parentspanid }} + refs: + {{- if eq .servicecode "e2e-service-provider" }} + {{- range .refs }} + - traceid: {{ notEmpty .traceid }} + parentsegmentid: {{ notEmpty .parentsegmentid }} + parentspanid: 1 + type: CROSS_PROCESS + {{- end }} + {{- end }} + {{- if eq .servicecode "e2e-service-consumer" }} + [] + {{- end }} + servicecode: {{ notEmpty .servicecode }} + serviceinstancename: {{ notEmpty .serviceinstancename }} + starttime: {{ gt .starttime 0 }} + endtime: {{ gt .endtime 0 }} + endpointname: + {{- if eq .type "Exit" }} + /info + {{ else }} + POST:/info + {{- end }} + type: {{ notEmpty .type }} + peer: + {{- if eq .type "Exit" }} + provider:9090 + {{ else }} + "" + {{- end }} + component: + {{- if eq .type "Exit" }} + SpringRestTemplate + {{- end }} + {{- if eq .type "Entry" }} + Tomcat + {{- end }} + iserror: false + layer: Http + tags: + {{- range .tags }} + {{- if eq .key "http.method" }} + - key: http.method + value: POST + {{- end }} + {{- if eq .key "url" }} + - key: url + value: {{ notEmpty .value }} + {{- end }} + {{- end }} + logs: [] + {{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/trace-users-detail.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/trace-users-detail.yml new file mode 100644 index 0000000000000000000000000000000000000000..b46479e24cbc1371c4cc7c6360ea6088e04afece --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/trace-users-detail.yml @@ -0,0 +1,45 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +spans: + {{- range .spans}} + - traceid: {{ notEmpty .traceid }} + segmentid: {{ notEmpty .segmentid }} + spanid: 0 + parentspanid: -1 + refs: [] + servicecode: {{ notEmpty .servicecode }} + serviceinstancename: {{ notEmpty .serviceinstancename }} + starttime: {{ gt .starttime 0 }} + endtime: {{ gt .endtime 0 }} + endpointname: POST:/users + type: Entry + peer: "" + component: Tomcat + iserror: false + layer: Http + tags: + {{- range .tags }} + {{- if eq .key "http.method" }} + - key: http.method + value: POST + {{- end }} + {{- if eq .key "url" }} + - key: url + value: {{ notEmpty .value }} + {{- end }} + {{- end }} + logs: [] + {{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/expected/traces-list.yml b/test/e2e-v2/cases/satellite/native-protocols/expected/traces-list.yml new file mode 100644 index 0000000000000000000000000000000000000000..0bbf661a0dcdb727b144d655a048a72ef7c04c24 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/expected/traces-list.yml @@ -0,0 +1,41 @@ +# 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. + +traces: +{{- range .traces }} +- segmentid: {{ notEmpty .segmentid }} + endpointnames: + {{- if eq (index .endpointnames 0) "H2/JDBI/Statement/execute" }} + - H2/JDBI/Statement/execute + {{- end}} + {{- if eq (index .endpointnames 0) "H2/JDBI/Statement/executeQuery" }} + - H2/JDBI/Statement/executeQuery + {{- end}} + {{- if eq (index .endpointnames 0) "H2/JDBI/PreparedStatement/executeQuery" }} + - H2/JDBI/PreparedStatement/executeQuery + {{- end }} + {{- if eq (index .endpointnames 0) "POST:/info" }} + - POST:/info + {{- end }} + {{- if eq (index .endpointnames 0) "POST:/users" }} + - POST:/users + {{- end }} + duration: {{ ge .duration 0 }} + start: "{{ notEmpty .start}}" + iserror: false + traceids: + - {{ (index .traceids 0) }} +{{- end }} +total: {{ gt .total 0 }} \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/lal.yaml b/test/e2e-v2/cases/satellite/native-protocols/lal.yaml new file mode 100644 index 0000000000000000000000000000000000000000..aa0922d9889798901f20a84ac04e9deb6e081267 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/lal.yaml @@ -0,0 +1,28 @@ +# 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. + +rules: + - name: example + dsl: | + filter { + text { + abortOnFailure false // for test purpose, we want to persist all logs + regexp $/(?s)(?\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}) \[TID:(?.+?)] \[(?.+?)] (?\w{4,}) (?.{1,36}) (?.+)/$ + } + extractor { + } + sink { + } + } diff --git a/test/e2e-v2/cases/satellite/native-protocols/satellite_config.yaml b/test/e2e-v2/cases/satellite/native-protocols/satellite_config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b61c265a8a4a6b74a22993ec850c210c0994df42 --- /dev/null +++ b/test/e2e-v2/cases/satellite/native-protocols/satellite_config.yaml @@ -0,0 +1,249 @@ +# +# 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. +# + +# The logger configuration. +logger: + # The log format pattern configuration. + log_pattern: ${SATELLITE_LOGGER_LOG_PATTERN:%time [%level][%field] - %msg} + # The time format pattern configuration. + time_pattern: ${SATELLITE_LOGGER_TIME_PATTERN:2006-01-02 15:04:05.000} + # The lowest level of printing allowed. + level: ${SATELLITE_LOGGER_LEVEL:info} + +# The Satellite self telemetry configuration. +telemetry: + # The space concept for the deployment, such as the namespace concept in the Kubernetes. + cluster: ${SATELLITE_TELEMETRY_CLUSTER:satellite-cluster} + # The group concept for the deployment, such as the service resource concept in the Kubernetes. + service: ${SATELLITE_TELEMETRY_SERVICE:satellite-service} + # The minimum running unit, such as the pod concept in the Kubernetes. + instance: ${SATELLITE_TELEMETRY_SERVICE:satellite-instance} + +# The sharing plugins referenced by the specific plugins in the different pipes. +sharing: + clients: + - plugin_name: "grpc-client" + # The gRPC server address (default localhost:11800). + server_addr: ${SATELLITE_GRPC_CLIENT:127.0.0.1:11800} + # The TLS switch + enable_TLS: ${SATELLITE_GRPC_ENABLE_TLS:false} + # The file path of client.pem. The config only works when opening the TLS switch. + client_pem_path: ${SATELLITE_GRPC_CLIENT_PEM_PATH:"client.pem"} + # The file path of client.key. The config only works when opening the TLS switch. + client_key_path: ${SATELLITE_GRPC_CLIENT_KEY_PATH:"client.key"} + # InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name. + insecure_skip_verify: ${SATELLITE_GRPC_INSECURE_SKIP_VERIFY:false} + # The file path oca.pem. The config only works when opening the TLS switch. + ca_pem_path: ${SATELLITE_grpc_CA_PEM_PATH:"ca.pem"} + # How frequently to check the connection(second) + check_period: ${SATELLITE_GRPC_CHECK_PERIOD:5} + # The auth value when send request + authentication: ${SATELLITE_GRPC_AUTHENTICATION:""} + servers: + - plugin_name: "grpc-server" + # The address of grpc server. + address: ${SATELLITE_GRPC_ADDRESS:":11800"} + # The TLS cert file path. + tls_cert_file: ${SATELLITE_GRPC_TLS_KEY_FILE:""} + # The TLS key file path. + tls_key_file: ${SATELLITE_GRPC_TLS_KEY_FILE:""} + - plugin_name: "prometheus-server" + # The prometheus server address. + address: ${SATELLITE_PROMETHEUS_ADDRESS:":1234"} + # The prometheus server metrics endpoint. + endpoint: ${SATELLITE_PROMETHEUS_ENDPOINT:"/metrics"} + +# The working pipe configurations. +pipes: + - common_config: + pipe_name: logpipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativelog-receiver" + queue: + plugin_name: "memory-queue" + # The maximum buffer event size. + event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_LOGPIPE_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_LOGPIPE_SENDER_MAX_BUFFER_SIZE:200} + # The minimum flush elements. + min_flush_events: ${SATELLITE_LOGPIPE_SENDER_MIN_FLUSH_EVENTS:100} + client_name: grpc-client + forwarders: + - plugin_name: nativelog-grpc-forwarder + - common_config: + pipe_name: managementpipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativemanagement-receiver" + queue: + plugin_name: "memory-queue" + # The maximum buffer event size. + event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_LOGMANAGEMENT_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_LOGMANAGEMENT_SENDER_MAX_BUFFER_SIZE:20} + # The minimum flush elements. + min_flush_events: ${SATELLITE_LOGMANAGEMENT_SENDER_MIN_FLUSH_EVENTS:1} + client_name: grpc-client + forwarders: + - plugin_name: nativemanagement-grpc-forwarder + - common_config: + pipe_name: tracingpipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativetracing-receiver" + queue: + plugin_name: "memory-queue" + # The maximum buffer event size. + event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_TRACINGPIPE_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_TRACINGPIPE_SENDER_MAX_BUFFER_SIZE:200} + # The minimum flush elements. + min_flush_events: ${SATELLITE_TRACINGPIPE_SENDER_MIN_FLUSH_EVENTS:1} + client_name: grpc-client + forwarders: + - plugin_name: nativetracing-grpc-forwarder + - common_config: + pipe_name: profilepipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativeprofile-receiver" + queue: + plugin_name: "memory-queue" + # The maximum buffer event size. + event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_PROFILEPIPE_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_PROFILEPIPE_SENDER_MAX_BUFFER_SIZE:200} + # The minimum flush elements. + min_flush_events: ${SATELLITE_PROFILEPIPE_SENDER_MIN_FLUSH_EVENTS:1} + client_name: grpc-client + forwarders: + - plugin_name: nativeprofile-grpc-forwarder + - common_config: + pipe_name: cdspipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativecds-receiver" + queue: + plugin_name: "none-queue" + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + client_name: grpc-client + forwarders: + - plugin_name: nativecds-grpc-forwarder + - common_config: + pipe_name: eventpipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativeevent-receiver" + queue: + plugin_name: "memory-queue" + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_EVENTPIPE_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_EVENTPIPE_SENDER_MAX_BUFFER_SIZE:200} + # The minimum flush elements. + min_flush_events: ${SATELLITE_EVENTPIPE_SENDER_MIN_FLUSH_EVENTS:1} + client_name: grpc-client + forwarders: + - plugin_name: nativeevent-grpc-forwarder + - common_config: + pipe_name: jvmpipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativejvm-receiver" + queue: + plugin_name: "memory-queue" + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_JVMPIPE_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_JVMPIPE_SENDER_MAX_BUFFER_SIZE:200} + # The minimum flush elements. + min_flush_events: ${SATELLITE_JVMPIPE_SENDER_MIN_FLUSH_EVENTS:1} + client_name: grpc-client + forwarders: + - plugin_name: nativejvm-grpc-forwarder + - common_config: + pipe_name: meterpipe + gatherer: + server_name: "grpc-server" + receiver: + plugin_name: "grpc-nativemeter-receiver" + queue: + plugin_name: "memory-queue" + processor: + filters: + sender: + fallbacker: + plugin_name: none-fallbacker + # The time interval between two flush operations. And the time unit is millisecond. + flush_time: ${SATELLITE_METERPIPE_SENDER_FLUSH_TIME:1000} + # The maximum buffer elements. + max_buffer_size: ${SATELLITE_METERPIPE_SENDER_MAX_BUFFER_SIZE:200} + # The minimum flush elements. + min_flush_events: ${SATELLITE_METERPIPE_SENDER_MIN_FLUSH_EVENTS:1} + client_name: grpc-client + forwarders: + - plugin_name: nativemeter-grpc-forwarder diff --git a/test/e2e-v2/java-test-service/Dockerfile.consumer b/test/e2e-v2/java-test-service/Dockerfile.consumer new file mode 100644 index 0000000000000000000000000000000000000000..a9926c267561822db661b25f72d8341fc35e591f --- /dev/null +++ b/test/e2e-v2/java-test-service/Dockerfile.consumer @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG SW_AGENT_JDK_VERSION=8 +ARG SW_AGENT_JAVA_COMMIT=1f3c08a5af19f8522f2a40d9339c45fa816bfe07 + +FROM ghcr.io/apache/skywalking-java/skywalking-java:${SW_AGENT_JAVA_COMMIT}-java${SW_AGENT_JDK_VERSION} + +VOLUME /services + +ENV SW_LOGGING_OUTPUT=CONSOLE + +ADD e2e-service-consumer/target/e2e-service-consumer-2.0.0.jar /services/ + +CMD ["sh", "-c", "java -jar /services/e2e-service-consumer-2.0.0.jar"] diff --git a/test/e2e-v2/java-test-service/Dockerfile.provider b/test/e2e-v2/java-test-service/Dockerfile.provider new file mode 100644 index 0000000000000000000000000000000000000000..f8572886d5b0fed3ca04c4be6c7b987cbce64535 --- /dev/null +++ b/test/e2e-v2/java-test-service/Dockerfile.provider @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG SW_AGENT_JDK_VERSION=8 +ARG SW_AGENT_JAVA_COMMIT=3997f0256056788bd054ee37e4603c11c0fd6756 + +FROM ghcr.io/apache/skywalking-java/skywalking-java:${SW_AGENT_JAVA_COMMIT}-java${SW_AGENT_JDK_VERSION} + +VOLUME /services + +ENV SW_LOGGING_OUTPUT=CONSOLE + +ADD e2e-service-provider/target/e2e-service-provider-2.0.0.jar /services/ + +CMD ["sh", "-c", "java -jar /services/e2e-service-provider-2.0.0.jar"] diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/pom.xml b/test/e2e-v2/java-test-service/e2e-service-consumer/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a57938df71552cd0e00814893551b567392e589a --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/pom.xml @@ -0,0 +1,66 @@ + + + + + + + apache-skywalking-e2e + org.apache.skywalking + 2.0.0 + + + 4.0.0 + + jar + + e2e-service-consumer + + + + org.apache.skywalking + apm-toolkit-trace + ${sw.version} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + true + true + + + + + repackage + + + + + + + + diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..2e7bda2f710d22cfb4c158fc61f1efe33d4ac1b6 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties("e2e") +public class E2EConfiguration { + private String providerBaseUrl; +} diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/Service1Application.java b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/Service1Application.java new file mode 100644 index 0000000000000000000000000000000000000000..138f9f88e2b96890f896696cfed17b5d1ccaa8a3 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/Service1Application.java @@ -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. + * + */ + +package org.apache.skywalking.e2e; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Service1Application { + public static void main(String[] args) { + SpringApplication.run(Service1Application.class, args); + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/User.java b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/User.java new file mode 100644 index 0000000000000000000000000000000000000000..66d7c0d6b29f64b534def188c09ee441ba219ff4 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/User.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e; + +import lombok.Data; + +@Data +public class User { + private Long id; + private String name; +} diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/HealthController.java b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/HealthController.java new file mode 100644 index 0000000000000000000000000000000000000000..999a0155d2f83ee0d3d117b19680bb1ccd5b1c50 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/HealthController.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +public class HealthController { + @GetMapping("/health") + @SuppressWarnings("EmptyMethod") + @ResponseStatus(code = HttpStatus.OK) + public void hello() { + } + +} diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/UserController.java b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/UserController.java new file mode 100644 index 0000000000000000000000000000000000000000..40cb7c9967a9561736aab8d6b9fc8a397baaeabe --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/java/org/apache/skywalking/e2e/controller/UserController.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e.controller; + +import com.google.common.base.Strings; +import lombok.RequiredArgsConstructor; +import org.apache.skywalking.apm.toolkit.trace.TraceContext; +import org.apache.skywalking.e2e.E2EConfiguration; +import org.apache.skywalking.e2e.User; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +import java.util.Optional; +import java.util.Random; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@RestController +@RequiredArgsConstructor +public class UserController { + private final RestTemplate restTemplate = new RestTemplate(); + + private final E2EConfiguration configuration; + + private final int sleepMin = 500; + + private final int sleepMax = 1000; + + @PostMapping("/info") + public String info() throws InterruptedException { + Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + + Optional> optionalResponseEntity = Stream.of( + Strings.nullToEmpty(configuration.getProviderBaseUrl()).split(",")) + .map(baseUrl -> restTemplate.postForEntity( + baseUrl + "/info", null, String.class)) + .findFirst(); + if (optionalResponseEntity.isPresent() && optionalResponseEntity.get().getStatusCodeValue() == 200) { + return optionalResponseEntity.get().getBody(); + } + throw new RuntimeException(); + } + + @PostMapping("/users") + public Object createAuthor(@RequestBody final User user) throws InterruptedException { + Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + + return Stream.of(Strings.nullToEmpty(configuration.getProviderBaseUrl()).split(",")) + .map(baseUrl -> restTemplate.postForEntity(baseUrl + "/users", user, User.class)) + .collect(Collectors.toList()); + } + + @PostMapping("/correlation") + public String correlation() throws InterruptedException { + Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + TraceContext.putCorrelation("CONSUMER_KEY", "consumer"); + + String baseUrl = configuration.getProviderBaseUrl(); + ResponseEntity resp = restTemplate.postForEntity(baseUrl + "/correlation", null, String.class); + return resp.getBody(); + } + + private long randomSleepLong(int min, int max) { + Random rand = new Random(); + int randomNumber = rand.nextInt((max - min) + 1) + min; + return randomNumber; + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/resources/application.yml b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..d85955be48e738f6e18a8f11a234f72029afa54e --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-consumer/src/main/resources/application.yml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +server: + port: 9092 + +spring: + main: + banner-mode: 'off' + +e2e: + provider-base-url: ${PROVIDER_URL:http://127.0.0.1:9090} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/pom.xml b/test/e2e-v2/java-test-service/e2e-service-provider/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..3e44264f0cb1dbe2e92dc7f329871ff8c9d7da91 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/pom.xml @@ -0,0 +1,127 @@ + + + + + + + apache-skywalking-e2e + org.apache.skywalking + 2.0.0 + + + 4.0.0 + + jar + + e2e-service-provider + + + 1.2.17 + 2.7 + 1.2.3 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring.boot.version} + + + com.h2database + h2 + ${h2.version} + + + org.springframework.boot + spring-boot-starter-actuator + + + log4j-to-slf4j + org.apache.logging.log4j + + + + + org.apache.skywalking + apm-toolkit-micrometer-registry + 8.2.0 + + + log4j + log4j + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + provided + + + ch.qos.logback + logback-classic + ${logback.version} + + + org.apache.skywalking + apm-toolkit-logback-1.x + ${sw.version} + + + org.apache.skywalking + apm-toolkit-log4j-1.x + ${sw.version} + + + org.apache.skywalking + apm-toolkit-log4j-2.x + ${sw.version} + + + org.apache.skywalking + apm-toolkit-trace + ${sw.version} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + true + true + + + + + repackage + + + + + + + diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/KeyValue.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/KeyValue.java new file mode 100644 index 0000000000000000000000000000000000000000..64bb447d16db83b7542876e532a4800b4915b27f --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/KeyValue.java @@ -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. + */ + +package org.apache.skywalking.e2e; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class KeyValue { + + private String key; + private String value; +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/Service0Application.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/Service0Application.java new file mode 100644 index 0000000000000000000000000000000000000000..c5f87977ed21ccbd1d4ebfbc3be1b38c076764ac --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/Service0Application.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e; + +import org.apache.skywalking.apm.meter.micrometer.SkywalkingMeterRegistry; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@EnableJpaRepositories +@SpringBootApplication +@ComponentScan({"org.apache.skywalking", "test.apache.skywalking"}) +public class Service0Application { + public static void main(String[] args) { + SpringApplication.run(Service0Application.class, args); + } + + @Bean + SkywalkingMeterRegistry skywalkingMeterRegistry() { + return new SkywalkingMeterRegistry(); + } + +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/User.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/User.java new file mode 100644 index 0000000000000000000000000000000000000000..2acc78a797adad74df964e690f66f5298da945d6 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/User.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.RequiredArgsConstructor; + +@Data +@Entity +@Builder +@AllArgsConstructor +@RequiredArgsConstructor +public class User { + @Id + @GeneratedValue + private Long id; + + @Column + private String name; +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/UserRepo.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/UserRepo.java new file mode 100644 index 0000000000000000000000000000000000000000..bafea9b301c7b184d8c012a4427f4117370ed86e --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/UserRepo.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserRepo extends JpaRepository { +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/AlarmController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/AlarmController.java new file mode 100644 index 0000000000000000000000000000000000000000..fd446702894e0f6ddb6bba9b9acf42777be4e524 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/AlarmController.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.skywalking.e2e.controller; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.skywalking.e2e.KeyValue; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/alarm") +public class AlarmController { + + // Save all received alarm message from oap + private List alarmMessages = new ArrayList<>(); + + @PostMapping("/receive") + public String receiveAlarmMessage(@RequestBody List data) { + alarmMessages.addAll(data); + return "success"; + } + + @PostMapping("/read") + public Alarms readMessages() { + return Alarms.builder().messages(alarmMessages).build(); + } + + /** + * Alarm message represents the details of each alarm. + */ + @Setter + @Getter + @NoArgsConstructor + public static class AlarmMessage { + private int scopeId; + private String scope; + private String name; + private String id0; + private String id1; + private String ruleName; + private String alarmMessage; + private long startTime; + private List tags; + } + + /** + * Alarm wrapper + */ + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Alarms { + private List messages; + } + +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/FileLogController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/FileLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..34e293e57757b54b177ad55d235d425c6283aed0 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/FileLogController.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.skywalking.e2e.controller; + +import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.skywalking.apm.toolkit.trace.TraceContext; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class FileLogController { + + private static final Logger LOG4J_LOGGER = Logger.getLogger("fileLogger"); + private static final org.apache.logging.log4j.Logger LOG4J2_LOGGER = LogManager.getLogger("fileLogger"); + private static final org.slf4j.Logger LOGBACK_LOGGER = LoggerFactory.getLogger("fileLogger"); + + @RequestMapping(value = "/file/logs/trigger") + public String trigger() { + LOG4J_LOGGER.info("log4j fileLogger ==> mills: " + System.currentTimeMillis()); + LOG4J2_LOGGER.info("log4j2 fileLogger ==> mills: " + System.currentTimeMillis()); + LOGBACK_LOGGER.info("logback fileLogger ==> mills: {}", System.currentTimeMillis()); + return TraceContext.traceId(); + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/HealthController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/HealthController.java new file mode 100644 index 0000000000000000000000000000000000000000..9871773430846164bcf7b1af3b00627b043bb818 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/HealthController.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@SuppressWarnings("SameReturnValue") +public class HealthController { + @GetMapping("/health") + public String hello() { + return "healthy"; + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/LogController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/LogController.java new file mode 100644 index 0000000000000000000000000000000000000000..a84d99b04aac376be8fdb81dac4370000799e033 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/LogController.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.skywalking.e2e.controller; + +import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.skywalking.apm.toolkit.trace.TraceContext; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class LogController { + + private static final Logger LOG4J_LOGGER = Logger.getLogger(LogController.class); + private static final org.apache.logging.log4j.Logger LOG4J2_LOGGER = LogManager.getLogger( + LogController.class); + private static final org.slf4j.Logger LOGBACK_LOGGER = LoggerFactory.getLogger(LogController.class); + + @RequestMapping(value = "/logs/trigger") + public String trigger() { + LOG4J_LOGGER.info("log4j message==> now: " + System.currentTimeMillis()); + LOG4J2_LOGGER.info("log4j2 message==> now: " + System.currentTimeMillis()); + LOGBACK_LOGGER.info("logback message==> now: {}", System.currentTimeMillis()); + return TraceContext.traceId(); + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java new file mode 100644 index 0000000000000000000000000000000000000000..2a84865beca96ba35498a99ecb77e3bc51d4184f --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/controller/UserController.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e.controller; + +import lombok.RequiredArgsConstructor; +import org.apache.skywalking.apm.toolkit.trace.TraceContext; +import org.apache.skywalking.e2e.User; +import org.apache.skywalking.e2e.UserRepo; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import org.slf4j.LoggerFactory; + +import java.util.Random; + +@RestController +@RequiredArgsConstructor +@SuppressWarnings("SameReturnValue") +public class UserController { + private static final org.slf4j.Logger LOGBACK_LOGGER = LoggerFactory.getLogger(UserController.class); + + private final UserRepo userRepo; + private final int sleepMin = 500; + private final int sleepMax = 1000; + + @PostMapping("/info") + public String info() throws InterruptedException { + Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + LOGBACK_LOGGER.info("logback message==> now: {}", System.currentTimeMillis()); + return "whatever"; + } + + @PostMapping("/users") + public User createAuthor(@RequestBody final User user) throws InterruptedException { + Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + return userRepo.save(user); + } + + @PostMapping("/correlation") + public String correlation() throws InterruptedException { + Thread.sleep(randomSleepLong(sleepMin, sleepMax)); + TraceContext.putCorrelation("PROVIDER_KEY", "provider"); + return TraceContext.getCorrelation("CONSUMER_KEY").orElse("") + "_" + + TraceContext.getCorrelation("MIDDLE_KEY").orElse("") + "_" + + TraceContext.getCorrelation("PROVIDER_KEY").orElse(""); + } + + private long randomSleepLong(int min, int max) { + Random rand = new Random(); + int randomNumber = rand.nextInt((max - min) + 1) + min; + return randomNumber; + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java new file mode 100644 index 0000000000000000000000000000000000000000..4e11cf320b9381187f28111886fff28144da7c0b --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/org/apache/skywalking/e2e/lua/LuaController.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.e2e.lua; + +import lombok.RequiredArgsConstructor; +import org.apache.skywalking.apm.toolkit.trace.TraceContext; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.concurrent.TimeUnit; + +@RestController +@RequiredArgsConstructor +public class LuaController { + protected final RestTemplate restTemplate = new RestTemplate(); + + @PostMapping("/nginx/entry/info") + private String nginxEntry(String backend) throws MalformedURLException, URISyntaxException { + final URL url = new URL("http://nginx:8080/nginx/info"); + TraceContext.putCorrelation("entry", "entry_value"); + final ResponseEntity response = restTemplate.postForEntity(url.toURI(), null, String.class); + return response.getBody(); + } + + @PostMapping("/nginx/end/info") + private String nginxEnd() throws InterruptedException { + TimeUnit.SECONDS.sleep(1); + + return TraceContext.getCorrelation("entry").orElse("") + + "_" + TraceContext.getCorrelation("nginx").orElse(""); + } + +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/test/apache/skywalking/e2e/profile/CreateUser.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/test/apache/skywalking/e2e/profile/CreateUser.java new file mode 100644 index 0000000000000000000000000000000000000000..30cb74ae2eb16c8876cb72298e2f00f52cf4d18f --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/test/apache/skywalking/e2e/profile/CreateUser.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package test.apache.skywalking.e2e.profile; + +import lombok.Data; +import org.apache.skywalking.e2e.User; + +@Data +public class CreateUser { + private String name; + private boolean enableProfiling; + + public User toUser() { + return User.builder().name(name).build(); + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/test/apache/skywalking/e2e/profile/ProfileController.java b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/test/apache/skywalking/e2e/profile/ProfileController.java new file mode 100644 index 0000000000000000000000000000000000000000..b939a84269949fece9e588c2be8aded793874625 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/java/test/apache/skywalking/e2e/profile/ProfileController.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package test.apache.skywalking.e2e.profile; + +import java.util.concurrent.TimeUnit; +import lombok.RequiredArgsConstructor; +import org.apache.skywalking.e2e.User; +import org.apache.skywalking.e2e.UserRepo; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +public class ProfileController { + private final UserRepo userRepo; + + @PostMapping("/profile/{name}") + public User createAuthor(@RequestBody final CreateUser createUser) throws InterruptedException { + final User user = userRepo.save(createUser.toUser()); + if (createUser.isEnableProfiling()) { + TimeUnit.MILLISECONDS.sleep(6200); + } + return user; + } +} diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/application.yml b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..360c10c4b74f0c174b7249bddac6c224b8d73c8a --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/application.yml @@ -0,0 +1,43 @@ +# 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. + +server: + port: 9090 + +spring: + main: + banner-mode: 'off' + datasource: + url: jdbc:h2:mem:testdb + driver-class-name: org.h2.Driver + data-username: sa + password: sa + platform: org.hibernate.dialect.H2Dialect + jpa: + generate-ddl: true + hibernate: + ddl-auto: create-drop + properties: + hibernate.format_sql: true + show-sql: true + +management: + metrics: + use-global-registry: true + web: + server: + request: + autotime: + enabled: true diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/log4j.properties b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/log4j.properties new file mode 100644 index 0000000000000000000000000000000000000000..56a721e0adfd4efb28e4a01f8907ced6d1fdd416 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/log4j.properties @@ -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. +log4j.rootLogger=info,CustomAppender +log4j.appender.CustomAppender=org.apache.skywalking.apm.toolkit.log.log4j.v1.x.log.GRPCLogClientAppender +log4j.appender.CustomAppender.layout=org.apache.log4j.PatternLayout +log4j.appender.CustomAppender.layout.ConversionPattern=[%t] %-5p %c %x - %m%n + +log4j.logger.fileLogger=info,FileAppender +log4j.appender.FileAppender=org.apache.log4j.FileAppender +log4j.appender.FileAppender.ImmediateFlush=true +log4j.appender.FileAppender.Append=true +log4j.appender.FileAppender.File=/tmp/skywalking-logs/log4j1/e2e-service-provider.log +log4j.appender.FileAppender.layout=org.apache.skywalking.apm.toolkit.log.log4j.v1.x.TraceIdPatternLayout +log4j.appender.FileAppender.layout.ConversionPattern=[%T{SW_CTX}] [%p] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c:%L - %m%n \ No newline at end of file diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/log4j2.xml b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/log4j2.xml new file mode 100644 index 0000000000000000000000000000000000000000..65b0bbd431ee4b344b96ffe7f6bcae379196ea71 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/log4j2.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + [%sw_ctx] [%p] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c:%L - %m%n + + + + + + + + + + + + + + + + diff --git a/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/logback.xml b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/logback.xml new file mode 100644 index 0000000000000000000000000000000000000000..e091cdac16a5b287a8e68667f131234bcb237651 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-service-provider/src/main/resources/logback.xml @@ -0,0 +1,52 @@ + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n + + + + + + /tmp/skywalking-logs/logback/e2e-service-provider.log + + + [%sw_ctx] [%level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger:%line - %msg%n + + + + + + + + + + + + diff --git a/test/e2e-v2/java-test-service/pom.xml b/test/e2e-v2/java-test-service/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a2f3659646a84e081f1887287fac53e95e5f87ed --- /dev/null +++ b/test/e2e-v2/java-test-service/pom.xml @@ -0,0 +1,181 @@ + + + + + 4.0.0 + org.apache.skywalking + apache-skywalking-e2e + 2.0.0 + + pom + + + e2e-service-provider + e2e-service-consumer + + + + 8.7.0 + + 1.8 + ${java.version} + ${java.version} + + UTF-8 + + 2.2.5.RELEASE + 2.1.2.RELEASE + 5.6.0 + 2.9.7 + 30.1.1-jre + 1.4.199 + 8.0.13 + 1.18.20 + 2.4.1 + + 2.22.0 + 3.8.0 + 3.1.0 + + + + + apache.snapshots + Apache Development Snapshot Repository + https://repository.apache.org/content/groups/snapshots/ + + false + + + true + + + + + + + + org.springframework.boot + spring-boot-dependencies + 2.5.5 + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + com.google.guava + guava + ${guava.version} + + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + **/*E2E.java + + + + + + verify + + + + + + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + ${maven.multiModuleProjectDirectory}/apm-checkstyle/checkStyle.xml + UTF-8 + true + true + + ${project.build.sourceDirectory} + ${project.build.testSourceDirectory} + + + **/*.properties, + **/*.sh, + **/*.bat, + **/*.yml, + **/*.yaml, + **/*.xml + + + **/.asf.yaml, + **/.github/** + + + + + validate + process-sources + + check + + + + + + + + diff --git a/test/e2e-v2/script/docker-compose/base-compose.yml b/test/e2e-v2/script/docker-compose/base-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..975d5d93f0e316528afd714d39e6ada0540dec92 --- /dev/null +++ b/test/e2e-v2/script/docker-compose/base-compose.yml @@ -0,0 +1,104 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '2.1' + +services: + oap: + image: skywalking/oap:latest + expose: + - 11800 + - 12800 + - 10051 + - 5005 + networks: + - e2e + volumes: + - ./../prepare/setup-oap/download-mysql.sh:/download-mysql.sh + - ./../prepare/setup-oap/log4j2.xml:/skywalking/config/log4j2.xml + environment: + SW_CLUSTER_ZK_HOST_PORT: zk:2181 + SW_STORAGE_ES_CLUSTER_NODES: es:9200 + SW_JDBC_URL: jdbc:mysql://mysql:3306/swtest + SW_STORAGE_INFLUXDB_URL: http://influxdb:8086 + SW_CONFIG_ETCD_PERIOD: 1 + SW_CONFIG_ETCD_ENDPOINTS: http://etcd:2379 + SW_CLUSTER_ETCD_ENDPOINTS: http://etcd:2379 + healthcheck: + test: ["CMD", "sh", "-c", "nc -zn 127.0.0.1 11800"] + interval: 5s + timeout: 60s + retries: 120 + + ui: + image: skywalking/ui:latest + expose: + - 8080 + networks: + - e2e + environment: + - SW_OAP_ADDRESS=http://oap:12800 + + provider: + build: + context: ../../java-test-service/ + dockerfile: Dockerfile.provider + args: + - SW_AGENT_JDK_VERSION=${SW_AGENT_JDK_VERSION} + - SW_AGENT_JAVA_COMMIT=${SW_AGENT_JAVA_COMMIT} + networks: + - e2e + expose: + - 9090 + - 5005 + environment: + SW_AGENT_COLLECTOR_BACKEND_SERVICES: oap:11800 + SW_AGENT_NAME: e2e-service-provider + SW_AGENT_INSTANCE_NAME: provider1 + SW_AGENT_COLLECTOR_GET_PROFILE_TASK_INTERVAL: 1 + SW_AGENT_COLLECTOR_GET_AGENT_DYNAMIC_CONFIG_INTERVAL: 1 + healthcheck: + test: ["CMD", "sh", "-c", "nc -nz 127.0.0.1 9090"] + interval: 5s + timeout: 60s + retries: 120 + + consumer: + build: + context: ../../java-test-service/ + dockerfile: Dockerfile.consumer + args: + - SW_AGENT_JDK_VERSION=${SW_AGENT_JDK_VERSION} + - SW_AGENT_JAVA_COMMIT=${SW_AGENT_JAVA_COMMIT} + networks: + - e2e + expose: + - 9092 + - 5005 + environment: + SW_AGENT_COLLECTOR_BACKEND_SERVICES: oap:11800 + PROVIDER_URL: http://provider:9090 + SW_AGENT_NAME: e2e-service-consumer + SW_AGENT_INSTANCE_NAME: consumer1 + SW_AGENT_COLLECTOR_GET_PROFILE_TASK_INTERVAL: 1 + SW_AGENT_COLLECTOR_GET_AGENT_DYNAMIC_CONFIG_INTERVAL: 1 + healthcheck: + test: ["CMD", "sh", "-c", "nc -nz 127.0.0.1 9092"] + interval: 5s + timeout: 60s + retries: 120 + +networks: + e2e: diff --git a/test/e2e-v2/script/prepare/setup-e2e-shell/install-etcdctl.sh b/test/e2e-v2/script/prepare/setup-e2e-shell/install-etcdctl.sh new file mode 100644 index 0000000000000000000000000000000000000000..da8bebd4bce1a8ae4efb4bbdbcffe85120bfeded --- /dev/null +++ b/test/e2e-v2/script/prepare/setup-e2e-shell/install-etcdctl.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env 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. +# ---------------------------------------------------------------------------- + +BASE_DIR=$1 +BIN_DIR=$2 + +if ! command -v etcdctl &> /dev/null; then + mkdir -p $BASE_DIR/etcdctl && cd $BASE_DIR/etcdctl + utype=$(uname | awk '{print tolower($0)}') + suffix= + if [ $utype = "darwin" ] + then + suffix="zip" + else + suffix="tar.gz" + fi + curl -kLo etcdctl.$suffix https://github.com/coreos/etcd/releases/download/v3.5.0/etcd-v3.5.0-$utype-amd64.$suffix + tar -zxf etcdctl.$suffix --strip=1 + cp etcdctl $BIN_DIR/ +fi \ No newline at end of file diff --git a/test/e2e-v2/script/prepare/setup-e2e-shell/install-swctl.sh b/test/e2e-v2/script/prepare/setup-e2e-shell/install-swctl.sh new file mode 100644 index 0000000000000000000000000000000000000000..d2d511391d99d583d2d324aff473aeab9941d3c4 --- /dev/null +++ b/test/e2e-v2/script/prepare/setup-e2e-shell/install-swctl.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env 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. +# ---------------------------------------------------------------------------- + +BASE_DIR=$1 +BIN_DIR=$2 + +if ! command -v swctl &> /dev/null; then + mkdir -p $BASE_DIR/swctl && cd $BASE_DIR/swctl + curl -kLo skywalking-cli.tar.gz https://github.com/apache/skywalking-cli/archive/401e0e5671a3fb49de1d1e1e89f5b693b2062867.tar.gz + tar -zxf skywalking-cli.tar.gz --strip=1 + utype=$(uname | awk '{print tolower($0)}') + make $utype && mv bin/swctl-*-$utype-amd64 $BIN_DIR/swctl +fi \ No newline at end of file diff --git a/test/e2e-v2/script/prepare/setup-e2e-shell/install-yq.sh b/test/e2e-v2/script/prepare/setup-e2e-shell/install-yq.sh new file mode 100644 index 0000000000000000000000000000000000000000..28fd29964de3c5db9ae6a06b5954d0aeba3e18a0 --- /dev/null +++ b/test/e2e-v2/script/prepare/setup-e2e-shell/install-yq.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env 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. +# ---------------------------------------------------------------------------- + +BASE_DIR=$1 +BIN_DIR=$2 + +if ! command -v yq &> /dev/null; then + mkdir -p $BASE_DIR/yq && cd $BASE_DIR/yq + curl -kLo yq.tar.gz https://github.com/mikefarah/yq/archive/v4.11.1.tar.gz + tar -zxf yq.tar.gz --strip=1 + go install && go build -ldflags -s && cp yq $BIN_DIR/ +fi \ No newline at end of file diff --git a/test/e2e-v2/script/prepare/setup-e2e-shell/install.sh b/test/e2e-v2/script/prepare/setup-e2e-shell/install.sh new file mode 100644 index 0000000000000000000000000000000000000000..3d440fa57d546fef59b2809cbd00e4f3c7cde08a --- /dev/null +++ b/test/e2e-v2/script/prepare/setup-e2e-shell/install.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env 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 -ex + +NAME=$1 +CURRENT_DIR="$(cd "$(dirname $0)"; pwd)" + +# prepare base dir +TMP_DIR=/tmp/skywalking-infra-e2e +BIN_DIR=/usr/local/bin +mkdir -p $TMP_DIR && cd $TMP_DIR + +# execute install +bash $CURRENT_DIR/install-$NAME.sh $TMP_DIR $BIN_DIR + +echo "success to install $NAME" \ No newline at end of file diff --git a/test/e2e-v2/script/prepare/setup-oap/download-mysql.sh b/test/e2e-v2/script/prepare/setup-oap/download-mysql.sh new file mode 100755 index 0000000000000000000000000000000000000000..3d5c87d15e633f5886976893b9522ee2a1d14bc6 --- /dev/null +++ b/test/e2e-v2/script/prepare/setup-oap/download-mysql.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env 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 -ex + +apk add curl + +SW_HOME=/skywalking +MYSQL_URL="https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar" +MYSQL_DRIVER="mysql-connector-java-8.0.13.jar" + +if ! curl -Lo "${SW_HOME}/oap-libs/${MYSQL_DRIVER}" ${MYSQL_URL}; then + echo "Fail to download ${MYSQL_DRIVER}." + exit 1 +fi diff --git a/test/e2e-v2/script/prepare/setup-oap/log4j2.xml b/test/e2e-v2/script/prepare/setup-oap/log4j2.xml new file mode 100644 index 0000000000000000000000000000000000000000..2758ba6d4fe408277b36133b8d3033612c0913bb --- /dev/null +++ b/test/e2e-v2/script/prepare/setup-oap/log4j2.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + +