This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 208a9ce55d [OSPP] Update PHP E2E to use native agent (#11330)
208a9ce55d is described below

commit 208a9ce55d43a6dfcd32c0f30ced3775d26510b4
Author: simonluo345 <101088629+simonluo...@users.noreply.github.com>
AuthorDate: Mon Oct 9 18:52:57 2023 -0700

    [OSPP] Update PHP E2E to use native agent (#11330)
---
 test/e2e-v2/cases/php/Dockerfile.php               | 54 +++++++++++++++++++
 test/e2e-v2/cases/php/docker-compose.yml           |  9 +++-
 test/e2e-v2/cases/php/e2e.yaml                     |  2 +-
 .../service-endpoint-php.yml => entrypoint.sh}     |  8 +--
 .../cases/php/expected/metrics-has-value.yml       |  4 +-
 .../cases/php/expected/service-endpoint-php.yml    |  4 +-
 .../cases/php/expected/service-instance-php.yml    | 12 ++---
 .../cases/php/expected/trace-info-detail.yml       | 34 +++++++-----
 test/e2e-v2/cases/php/expected/traces-list-php.yml |  6 +--
 .../cases/php/expected/traces-list-provider.yml    |  2 +-
 test/e2e-v2/cases/php/nginx.conf                   | 62 ++++++++++++++++++++++
 test/e2e-v2/cases/php/php.ini                      | 19 +++----
 test/e2e-v2/script/env                             |  1 +
 13 files changed, 174 insertions(+), 43 deletions(-)

diff --git a/test/e2e-v2/cases/php/Dockerfile.php 
b/test/e2e-v2/cases/php/Dockerfile.php
new file mode 100644
index 0000000000..f3fe4c8f64
--- /dev/null
+++ b/test/e2e-v2/cases/php/Dockerfile.php
@@ -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.
+
+FROM php:8.1-fpm-bullseye as builder
+
+ARG SW_AGENT_PHP_COMMIT
+
+ENV RUSTUP_HOME=/usr/local/rustup \
+    CARGO_HOME=/usr/local/cargo \
+    PATH=/usr/local/cargo/bin:$PATH \
+    RUST_VERSION=1.64.0
+
+WORKDIR /tmp
+RUN apt update \
+        && apt install -y wget protobuf-compiler libclang-dev git \
+        && wget 
https://static.rust-lang.org/rustup/archive/1.25.1/x86_64-unknown-linux-gnu/rustup-init
 \
+        && chmod +x rustup-init \
+        && ./rustup-init -y --no-modify-path --profile minimal 
--default-toolchain $RUST_VERSION --default-host x86_64-unknown-linux-gnu \
+        && rm rustup-init \
+        && chmod -R a+w $RUSTUP_HOME $CARGO_HOME
+
+RUN git clone https://github.com/apache/skywalking-php.git $(pwd)
+
+RUN git reset --hard ${SW_AGENT_PHP_COMMIT} && git submodule update --init
+
+RUN phpize \
+        && ./configure --enable-skywalking_agent \
+        && make \
+        && make install
+
+FROM php:8.1-fpm-bullseye
+RUN apt update \
+        && apt install -y nginx \
+        && cd / \
+        && rm -rf /var/cache/apk/*
+COPY --from=builder 
/usr/local/lib/php/extensions/no-debug-non-zts-20210902/skywalking_agent.so 
/usr/local/lib/php/extensions/no-debug-non-zts-20210902/
+COPY entrypoint.sh /entrypoint.sh
+
+EXPOSE 9000
+EXPOSE 8080
+
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/test/e2e-v2/cases/php/docker-compose.yml 
b/test/e2e-v2/cases/php/docker-compose.yml
index eb921cf25a..91120d4b56 100644
--- a/test/e2e-v2/cases/php/docker-compose.yml
+++ b/test/e2e-v2/cases/php/docker-compose.yml
@@ -24,7 +24,11 @@ services:
       - 12800
 
   php:
-    image: skyapm/skywalking-php:v4.2.0-8.0-fpm-alpine
+    build:
+      context: .
+      dockerfile: Dockerfile.php
+      args:
+        - SW_AGENT_PHP_COMMIT=${SW_AGENT_PHP_COMMIT}
     networks:
       - e2e
     ports:
@@ -36,7 +40,8 @@ services:
         condition: service_healthy
     volumes:
       - ./index.php:/var/www/html/index.php
-      - ./php.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini
+      - ./php.ini:/usr/local/etc/php/conf.d/ext-skywalking_agent.ini
+      - ./nginx.conf:/etc/nginx/nginx.conf
 
   provider:
     extends:
diff --git a/test/e2e-v2/cases/php/e2e.yaml b/test/e2e-v2/cases/php/e2e.yaml
index f0727a1ca1..046daa028f 100644
--- a/test/e2e-v2/cases/php/e2e.yaml
+++ b/test/e2e-v2/cases/php/e2e.yaml
@@ -68,7 +68,7 @@ verify:
     - 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 --service-name=php\
-            | yq e '.traces | select(.[].endpointnames[0]=="/php/info") | 
.[0].traceids[0]' -
+            | yq e '.traces | select(.[].endpointnames[0]=="POST:/php/info") | 
.[0].traceids[0]' -
         )
       expected: expected/trace-info-detail.yml
     # dependency service
diff --git a/test/e2e-v2/cases/php/expected/service-endpoint-php.yml 
b/test/e2e-v2/cases/php/entrypoint.sh
old mode 100644
new mode 100755
similarity index 88%
copy from test/e2e-v2/cases/php/expected/service-endpoint-php.yml
copy to test/e2e-v2/cases/php/entrypoint.sh
index 91e5011cb6..27d1919751
--- a/test/e2e-v2/cases/php/expected/service-endpoint-php.yml
+++ b/test/e2e-v2/cases/php/entrypoint.sh
@@ -1,3 +1,4 @@
+#!/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.
@@ -13,7 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- contains . }}
-- id: {{ b64enc "php" }}.1_{{ b64enc "/php/info" }}
-  name: /php/info
-{{- end}}
+
+nginx
+php-fpm
\ No newline at end of file
diff --git a/test/e2e-v2/cases/php/expected/metrics-has-value.yml 
b/test/e2e-v2/cases/php/expected/metrics-has-value.yml
index 04b077dd98..474e0ef1e4 100644
--- a/test/e2e-v2/cases/php/expected/metrics-has-value.yml
+++ b/test/e2e-v2/cases/php/expected/metrics-has-value.yml
@@ -20,6 +20,6 @@
     isemptyvalue: true
 - key: {{ notEmpty .key }}
   value:
-    value: {{ ge .value.value 1 }}
-    isemptyvalue: false
+    value: 0
+    isemptyvalue: true
 {{- end }}
diff --git a/test/e2e-v2/cases/php/expected/service-endpoint-php.yml 
b/test/e2e-v2/cases/php/expected/service-endpoint-php.yml
index 91e5011cb6..905e063614 100644
--- a/test/e2e-v2/cases/php/expected/service-endpoint-php.yml
+++ b/test/e2e-v2/cases/php/expected/service-endpoint-php.yml
@@ -14,6 +14,6 @@
 # limitations under the License.
 
 {{- contains . }}
-- id: {{ b64enc "php" }}.1_{{ b64enc "/php/info" }}
-  name: /php/info
+- id: {{ b64enc "php" }}.1_{{ b64enc "POST:/php/info" }}
+  name: POST:/php/info
 {{- end}}
diff --git a/test/e2e-v2/cases/php/expected/service-instance-php.yml 
b/test/e2e-v2/cases/php/expected/service-instance-php.yml
index 52a1343dc1..11964dd2e7 100644
--- a/test/e2e-v2/cases/php/expected/service-instance-php.yml
+++ b/test/e2e-v2/cases/php/expected/service-instance-php.yml
@@ -16,19 +16,19 @@
 # under the License. shadow
 
 {{- contains .}}
-- id: {{ b64enc "php" }}.1_{{ b64enc "php-instance" }}
-  name: php-instance
+- id: {{ notEmpty .id }}
+  name: {{ notEmpty .name }}
   attributes:
   {{- contains .attributes }}
-  - name: os_name
+  - name: Process No.
     value: {{ notEmpty .value }}
-  - name: host_name
+  - name: OS Name
     value: {{ notEmpty .value }}
-  - name: process_no
+  - name: hostname
     value: {{ notEmpty .value }}
   - name: ipv4s
     value: {{ notEmpty .value }}
   {{- end}}
   language: PHP
-  instanceuuid: {{ b64enc "php" }}.1_{{ b64enc "php-instance" }}
+  instanceuuid: {{ notEmpty .instanceuuid }}
 {{- end}}
diff --git a/test/e2e-v2/cases/php/expected/trace-info-detail.yml 
b/test/e2e-v2/cases/php/expected/trace-info-detail.yml
index bb8fade225..7d0711bb3a 100644
--- a/test/e2e-v2/cases/php/expected/trace-info-detail.yml
+++ b/test/e2e-v2/cases/php/expected/trace-info-detail.yml
@@ -15,8 +15,8 @@
 
 spans:
   {{- contains .spans }}
-  - traceid: {{ .traceid }}
-    segmentid: {{ .segmentid }}
+  - traceid: "{{ .traceid }}"
+    segmentid: "{{ .segmentid }}"
     spanid: {{ .spanid }}
     parentspanid: {{ .parentspanid }}
     refs: []
@@ -24,9 +24,9 @@ spans:
     serviceinstancename: {{ notEmpty .serviceinstancename }}
     starttime: {{ gt .starttime 0 }}
     endtime: {{ gt .endtime 0 }}
-    endpointname: /php/info
+    endpointname: POST:/php/info
     type: Entry
-    peer: {{ notEmpty .peer }}
+    peer: ""
     component: PHP
     iserror: false
     layer: Http
@@ -34,11 +34,15 @@ spans:
       {{- contains .tags }}
       - key: url
         value: {{ notEmpty .value }}
+      - key: http.method
+        value: POST
+      - key: http.status_code
+        value: "200"
       {{- end }}
     logs: []
     attachedevents: []
-  - traceid: {{ notEmpty .traceid }}
-    segmentid: {{ .segmentid }}
+  - traceid: "{{ notEmpty .traceid }}"
+    segmentid: "{{ .segmentid }}"
     spanid: {{ .spanid }}
     parentspanid: {{ .parentspanid }}
     refs: []
@@ -55,18 +59,20 @@ spans:
     tags:
       {{- contains .tags }}
       - key: url
-        value: {{ notEmpty .value }}
+        value: http://provider:9090/info
+      - key: status_code
+        value: "200"
       {{- end }}
     logs: []
     attachedevents: []
-  - traceid: {{ notEmpty .traceid }}
+  - traceid: "{{ notEmpty .traceid }}"
     segmentid: {{ .segmentid }}
     spanid: {{ .spanid }}
     parentspanid: {{ .parentspanid }}
     refs:
       {{- contains .refs }}
-      - traceid: {{ notEmpty .traceid }}
-        parentsegmentid: {{ .parentsegmentid }}
+      - traceid: "{{ notEmpty .traceid }}"
+        parentsegmentid: "{{ .parentsegmentid }}"
         parentspanid: 1
         type: CROSS_PROCESS
       {{- end }}
@@ -82,12 +88,14 @@ spans:
     layer: Http
     tags:
       {{- contains .tags }}
+      - key: url
+        value: http://provider:9090/info
       - key: http.method
         value: GET
-      - key: url
-        value: {{ notEmpty .value }}
+      - key: http.status_code
+        value: "200"
       {{- end }}
     logs: []
     attachedevents: []
-  {{- end }}
+{{- end }}
 
diff --git a/test/e2e-v2/cases/php/expected/traces-list-php.yml 
b/test/e2e-v2/cases/php/expected/traces-list-php.yml
index fe737c9434..7bd4814f9c 100644
--- a/test/e2e-v2/cases/php/expected/traces-list-php.yml
+++ b/test/e2e-v2/cases/php/expected/traces-list-php.yml
@@ -15,12 +15,12 @@
 
 traces:
 {{- contains .traces }}
-- segmentid: {{ notEmpty .segmentid }}
+- segmentid: "{{ notEmpty .segmentid }}"
   endpointnames:
-    - /php/info
+    - POST:/php/info
   duration: {{ ge .duration 0 }}
   start: "{{ notEmpty .start}}"
   iserror: false
   traceids:
-    - {{ (index .traceids 0) }}
+    - "{{ (index .traceids 0) }}"
 {{- end }}
diff --git a/test/e2e-v2/cases/php/expected/traces-list-provider.yml 
b/test/e2e-v2/cases/php/expected/traces-list-provider.yml
index 888cac1f49..aab7258d9d 100644
--- a/test/e2e-v2/cases/php/expected/traces-list-provider.yml
+++ b/test/e2e-v2/cases/php/expected/traces-list-provider.yml
@@ -22,5 +22,5 @@ traces:
   start: "{{ notEmpty .start}}"
   iserror: false
   traceids:
-    - {{ (index .traceids 0) }}
+    - "{{ (index .traceids 0) }}"
 {{- end }}
diff --git a/test/e2e-v2/cases/php/nginx.conf b/test/e2e-v2/cases/php/nginx.conf
new file mode 100644
index 0000000000..2a87938d12
--- /dev/null
+++ b/test/e2e-v2/cases/php/nginx.conf
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+user  www-data;
+worker_processes  1;
+
+error_log  /var/log/nginx/error.log warn;
+pid        /var/run/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    server {
+        listen 8080;
+        root /var/www/html;
+        index index.php;
+
+        location / {
+            try_files $uri $uri/ /index.php?$query_string;
+        }
+
+        location ~ \.php$ {
+            fastcgi_pass  127.0.0.1:9000;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            include fastcgi_params;
+        }
+    }
+}
\ No newline at end of file
diff --git a/test/e2e-v2/cases/php/php.ini b/test/e2e-v2/cases/php/php.ini
index 2fbef153c9..8789034b0e 100644
--- a/test/e2e-v2/cases/php/php.ini
+++ b/test/e2e-v2/cases/php/php.ini
@@ -14,13 +14,14 @@
 ; limitations under the License.
 
 
-[skywalking]
-extension=skywalking.so
-skywalking.app_code = php
-skywalking.enable = 1
-skywalking.version = 8
-skywalking.grpc = oap:11800
-skywalking.error_handler_enable = 0
-skywalking.sample_n_per_3_secs = -1
-skywalking.instance_name = "php-instance"
+[skywalking_agent]
+extension = skywalking_agent.so
+skywalking_agent.service_name = php
+skywalking_agent.enable = 1
+skywalking_agent.log_file = /tmp/skywalking-agent.log
+skywalking_agent.log_level = DEBUG
+skywalking_agent.server_addr = oap:11800
+
+skywalking_agent.skywalking_version = 9
+skywalking_agent.runtime_dir = /tmp
 
diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env
index d6460e8d6a..1059d3839a 100644
--- a/test/e2e-v2/script/env
+++ b/test/e2e-v2/script/env
@@ -24,5 +24,6 @@ 
SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
 SW_KUBERNETES_COMMIT_SHA=a14f386063fffc61ed9b396e1328b76d33239aba
 SW_ROVER_COMMIT=fc8d074c6d34ecfee585a7097cbd5aef1ca680a5
 SW_BANYANDB_COMMIT=63be6e80bef82ea274d7352cc7a461b757d28355
+SW_AGENT_PHP_COMMIT=3192c553002707d344bd6774cfab5bc61f67a1d3
 
 SW_CTL_COMMIT=9d2d0edccda2afe5cf24f1e632142f40e80e8fa4

Reply via email to