未验证 提交 c959d9d8 编写于 作者: 何延龙 提交者: GitHub

Bug fix (#256)

* fix bugs
上级 4c841a56
......@@ -107,3 +107,4 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_names: true
dockerfile: docker/Dockerfile
......@@ -21,7 +21,7 @@ SkyAPM PHP
## Docker image
Go to Docker hub -> [https://hub.docker.com/r/skyapm/skywalking-php](https://hub.docker.com/r/skyapm/skywalking-php)
```shell script
docker run -d -e SW_AGENT_COLLECTOR_BACKEND_SERVICES=127.0.0.1:11800 skywalking-php
docker run -d -e SW_OAP_ADDRESS=127.0.0.1:11800 skywalking-php
```
## Live Demo
......
FROM php:7.4-fpm-alpine AS builder
FROM php:7.4-fpm-buster AS builder
ENV GRPC_RELEASE_TAG v1.31.x
ADD . /tmp/skywalking
ENV PROTOBUF_RELEASE_TAG 3.13.x
RUN set -ex \
&& apk add --no-cache \
autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c \
git ca-certificates curl-dev nginx \
&& apt-get update && apt-get install -y \
autoconf automake libtool curl make g++ unzip \
build-essential autoconf libtool pkg-config cmake \
git ca-certificates libcurl4-openssl-dev nginx re2c \
&& rm -fr /var/lib/apt/lists/* \
&& echo "--- clone grpc ---" \
&& git clone --depth 1 -b ${GRPC_RELEASE_TAG} https://github.com/grpc/grpc /var/local/git/grpc \
&& cd /var/local/git/grpc && git submodule update --init \
&& cd /var/local/git/grpc && git submodule update --init --recursive \
&& echo "--- clone protobuf ---" \
&& git clone --depth 1 -b ${PROTOBUF_RELEASE_TAG} https://github.com/protocolbuffers/protobuf.git /var/local/git/protobuf \
&& cd /var/local/git/protobuf && git submodule update --init --recursive \
&& echo "--- installing protobuf ---" \
&& cd third_party/protobuf \
&& ./autogen.sh && ./configure --enable-shared \
&& make -j$(nproc) && make -j$(nproc) check && make install && make clean && ldconfig \
&& echo "--- grpc protobuf ---" \
&& cd /var/local/git/protobuf \
&& ./autogen.sh && ./configure \
&& make -j$(nproc) && make install && make clean && ldconfig \
&& echo "--- installing grpc ---" \
&& cd /var/local/git/grpc \
&& mkdir -p cmake/build \
&& cd cmake/build \
&& cmake ../.. -DBUILD_SHARED_LIBS=ON -DgRPC_INSTALL=ON \
&& make -j$(nproc) && make install && make clean && ldconfig \
&& cd /tmp/skywalking \
&& phpize && ./configure && make && make install \
&& cp php.ini $PHP_INI_DIR/conf.d/ext-skywalking.ini \
&& cp service.sh /opt/ \
&& cp nginx.conf /etc/nginx/nginx.conf \
&& cp skywalking.php /var/www/html/index.php \
&& cd / \
&& tar zcvf dist.tar.gz \
opt/service.sh \
etc/nginx/nginx.conf \
var/www/html/index.php \
usr/local/etc/php/conf.d/ext-skywalking.ini \
usr/local/lib/php/extensions/no-debug-non-zts-20190902/skywalking.so
&& rm -fr /var/local/git/grpc \
&& rm -fr /var/local/git/protobuf
ADD . /tmp/skywalking
FROM php:7.4-fpm-alpine
COPY --from=builder /dist.tar.gz /
RUN set -ex \
&& apk add --no-cache nginx grpc protoc \
&& tar zxvf /dist.tar.gz -C / \
&& rm -fr /usr/src/php.tar.xz \
&& rm -fr /dist.tar.gz
&& echo "--- installing skywalking php ---" \
&& cd /tmp/skywalking \
&& phpize && ./configure && make && make install \
&& cp php.ini $PHP_INI_DIR/conf.d/ext-skywalking.ini \
&& cp docker/service.sh /opt/ \
&& cp docker/nginx.conf /etc/nginx/nginx.conf \
&& cp docker/index.php /var/www/html/index.php \
&& cd / && rm -fr /tmp/skywalking \
&& rm -fr /usr/src/php.tar.xz
ENTRYPOINT ["/opt/service.sh"]
<?php
$ch = curl_init("https://api.github.com/repos");
curl_exec($ch);
\ No newline at end of file
#!/usr/bin/env sh
nginx
grpc=$SW_OAP_ADDRESS
if [ ! $grpc ]; then
grpc="127.0.0.1:11800"
fi
php-fpm > /var/log/php-fpm.log 2>&1 &
echo "sw oap address:" $grpc
sky-php-agent --grpc ${SW_AGENT_COLLECTOR_BACKEND_SERVICES} --socket /tmp/sky-agent.sock > /var/log/sky-php.log 2>&1 &
sed -i "s/127.0.0.1:11800/$grpc/g" $PHP_INI_DIR/conf.d/ext-skywalking.ini
nginx
while [[ true ]]; do
sleep 1
done
php-fpm
......@@ -79,7 +79,7 @@ std::string CrossProcessBag::encode(int spanId, const std::string &peer) {
}
header.erase(header.end() - 1);
std::cout << header << std::endl;
// std::cout << header << std::endl;
return header;
}
......
......@@ -25,7 +25,7 @@ Span *sky_pdo(zend_execute_data *execute_data, const std::string &class_name, co
function_name == "prepare" || function_name == "commit" ||
function_name == "begintransaction" || function_name == "rollback") {
auto *segment = static_cast<Segment *>(SKYWALKING_G(segment));
auto *span = segment->createSpan(SkySpanType::Exit, SkySpanLayer::Database, 0);
auto *span = segment->createSpan(SkySpanType::Exit, SkySpanLayer::Database, 8003);
span->setOperationName(class_name + "->" + function_name);
uint32_t arg_count = ZEND_CALL_NUM_ARGS(execute_data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册