[OSPP] Update PHP E2E to use native agent (#11330)
This commit is contained in:
parent
fc151a4843
commit
208a9ce55d
|
|
@ -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"]
|
||||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#!/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.
|
||||
|
||||
|
||||
nginx
|
||||
php-fpm
|
||||
|
|
@ -20,6 +20,6 @@
|
|||
isemptyvalue: true
|
||||
- key: {{ notEmpty .key }}
|
||||
value:
|
||||
value: {{ ge .value.value 1 }}
|
||||
isemptyvalue: false
|
||||
value: 0
|
||||
isemptyvalue: true
|
||||
{{- end }}
|
||||
|
|
|
|||
|
|
@ -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}}
|
||||
|
|
|
|||
|
|
@ -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}}
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@ traces:
|
|||
start: "{{ notEmpty .start}}"
|
||||
iserror: false
|
||||
traceids:
|
||||
- {{ (index .traceids 0) }}
|
||||
- "{{ (index .traceids 0) }}"
|
||||
{{- end }}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue