Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Skywalking 5.0 #14

Merged
merged 9 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.deps
.idea
cmake-build-debug
CMakeLists.txt
sky-php7ext/grpc/*
sky-php7ext/configure.ac
sky-php7ext/skywalking.loT
sky-php7ext\.idea
sky-php7ext\*.lo
sky-php7ext\*.la
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sky-php7ext/protos"]
path = sky-php7ext/src/protos
url = https://github.com/apache/incubator-skywalking-data-collect-protocol.git
40 changes: 35 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Sky Walking for php SDK| [中文](README_ZH.md)
==========
**SkyWalking php SDK**: A client tool developed for PHP using SkyWalking APM tools. (It is a pity that it only supports writing log and checking curl currently.)
**SkyWalking php SDK**: A client tool developed for PHP using SkyWalking APM tools. (It is a pity that it only supports checking curl currently.)
SkyWalking APM : https://github.com/apache/incubator-skywalking

* Automatic probe for PHP. **You don't need to modify the application code.**
Expand All @@ -11,16 +11,46 @@ SkyWalking APM : https://github.com/apache/incubator-skywalking
* It is a php extension and contains some php classes.
* It can compatible any versions of php.You can look over the codes in the class 'SkyWalking'.
* You need to add business codes to monnitor.


# Dep
* pkg-config
* grpc
* protoc
* php 7+

# Using and installing
* php extensions(https://github.com/SkywalkingContrib/skywalking-php-sdk/tree/songzhian/sky-php7ext)
* php classes (https://github.com/SkywalkingContrib/skywalking-php-sdk/tree/songzhian/sdk-php)

# Install
1. build php extension
```shell
git clone --recurse-submodules https://github.com/SkywalkingContrib/skywalking-php-sdk.git
cd sky-php7ext
phpize && ./configure && make && make install
```

2. make report_client
```shell
cd sky-php7ext/report
make
```

# Config
* php.ini
```shell
extension=skywalking.so
skywalking.app_code = app_code
skywalking.grpc = 127.0.0.1:11800
```

# Run
```shell
php-fpm
./report_client 120.0.0.1:11800 /tmp
```

# Apply to
* version 1.0 applies to Skywalking 3.1 .
* version 2.0 applies to Skywalking 3.X .
* version 5.0 applies to Skywalking 5.X .
# In the future.
* more php versions.
* more os.
Expand Down
5 changes: 3 additions & 2 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ SkyWalking APM : https://github.com/apache/incubator-skywalking


# 使用安装
* php扩展包(https://github.com/SkywalkingContrib/skywalking-php-sdk/blob/songzhian/sky-php7ext/README_ZH.md)
* php代码类包(https://github.com/SkywalkingContrib/skywalking-php-sdk/blob/songzhian/sdk-php/README_ZH.md)
* php扩展包(https://github.com/SkywalkingContrib/skywalking-php-sdk/blob/master/sky-php7ext/README_ZH.md)
* php代码类包(https://github.com/SkywalkingContrib/skywalking-php-sdk/blob/master/sdk-php/README_ZH.md)

# 对应版本支持
* 1.0对应版本:Skywalking 3.1
* 2.0对应版本:Skywalking 3.x
* 5.0对应版本:Skywalking 5.x
# 将要完成
* 其它php版本扩展支持
* 更多系统支持
Expand Down
1 change: 1 addition & 0 deletions sky-php7ext/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ tests/*/*.php
tests/*/*.exp
tests/*/*.log
tests/*/*.sh
.idea
67 changes: 44 additions & 23 deletions sky-php7ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ dnl [ --enable-skywalking Enable skywalking support])
PHP_ARG_ENABLE(skywalking, whether to enable skywalking support,
[ --enable-skywalking Enable skywalking support])

if test -z "$PHP_DEBUG"; then
AC_ARG_ENABLE(debug,
[--enable-debug compile with debugging system],
[PHP_DEBUG=$enableval], [PHP_DEBUG=no]
)
fi

if test "$PHP_SKYWALKING" != "no"; then
dnl Write more examples of tests here...

Expand Down Expand Up @@ -62,43 +69,57 @@ if test "$PHP_SKYWALKING" != "no"; then
dnl ])
dnl
dnl PHP_SUBST(SKYWALKING_SHARED_LIBADD)
CXXFLAGS+=" -std=c++11 "
PHP_REQUIRE_CXX()

KYWALKING_LIBS=" -L/usr/local/lib "
KYWALKING_LIBS+=`pkg-config --libs protobuf grpc++ grpc`
KYWALKING_LIBS+="-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -ldl"
KYWALKING_LIBS+=" -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -ldl "

AC_OUTPUT_COMMANDS(
protoc -I ./protos --cpp_out=./grpc ./protos/DiscoveryService.proto
protoc -I ./protos --cpp_out=./grpc ./protos/ApplicationRegisterService.proto
protoc -I ./protos --cpp_out=./grpc ./protos/TraceSegmentService.proto
)
AC_OUTPUT_COMMANDS(
protoc -I ./protos --grpc_out=./grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/DiscoveryService.proto
protoc -I ./protos --grpc_out=./grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/ApplicationRegisterService.proto
protoc -I ./protos --grpc_out=./grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/TraceSegmentService.proto
protoc -I ./src/protos --cpp_out=./src/grpc ./src/protos/*.proto
protoc -I ./src/protos --grpc_out=./src/grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./src/protos/*.proto
)

AC_OUTPUT_COMMANDS(
mv grpc/DiscoveryService.grpc.pb.cc grpc/DiscoveryService-grpc.pb.cc
mv grpc/ApplicationRegisterService.grpc.pb.cc grpc/ApplicationRegisterService-grpc.pb.cc
mv grpc/TraceSegmentService.grpc.pb.cc grpc/TraceSegmentService-grpc.pb.cc
mv src/grpc/ApplicationRegisterService.grpc.pb.cc src/grpc/ApplicationRegisterService-grpc.pb.cc
mv src/grpc/Common.grpc.pb.cc src/grpc/Common-grpc.pb.cc
mv src/grpc/DiscoveryService.grpc.pb.cc src/grpc/DiscoveryService-grpc.pb.cc
mv src/grpc/Downstream.grpc.pb.cc src/grpc/Downstream-grpc.pb.cc
mv src/grpc/JVMMetricsService.grpc.pb.cc src/grpc/JVMMetricsService-grpc.pb.cc
mv src/grpc/KeyWithIntegerValue.grpc.pb.cc src/grpc/KeyWithIntegerValue-grpc.pb.cc
mv src/grpc/KeyWithStringValue.grpc.pb.cc src/grpc/KeyWithStringValue-grpc.pb.cc
mv src/grpc/NetworkAddressRegisterService.grpc.pb.cc src/grpc/NetworkAddressRegisterService-grpc.pb.cc
mv src/grpc/TraceSegmentService.grpc.pb.cc src/grpc/TraceSegmentService-grpc.pb.cc
)

PHP_EVAL_LIBLINE($KYWALKING_LIBS, SKYWALKING_SHARED_LIBADD)


PHP_NEW_EXTENSION(skywalking, \
skywalking.c \
grpc/greeter_client.cc \
grpc/DiscoveryService.pb.cc \
grpc/DiscoveryService-grpc.pb.cc \
grpc/ApplicationRegisterService.pb.cc \
grpc/ApplicationRegisterService-grpc.pb.cc \
grpc/TraceSegmentService.pb.cc \
grpc/TraceSegmentService-grpc.pb.cc \
, $ext_shared,, -std=c++11 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)

PHP_ADD_BUILD_DIR($ext_builddir/grpc)

src/greeter_client.cc \
src/grpc/ApplicationRegisterService-grpc.pb.cc \
src/grpc/ApplicationRegisterService.pb.cc \
src/grpc/Common-grpc.pb.cc \
src/grpc/Common.pb.cc \
src/grpc/DiscoveryService-grpc.pb.cc \
src/grpc/DiscoveryService.pb.cc \
src/grpc/Downstream-grpc.pb.cc \
src/grpc/Downstream.pb.cc \
src/grpc/JVMMetricsService-grpc.pb.cc \
src/grpc/JVMMetricsService.pb.cc \
src/grpc/KeyWithIntegerValue-grpc.pb.cc \
src/grpc/KeyWithIntegerValue.pb.cc \
src/grpc/KeyWithStringValue-grpc.pb.cc \
src/grpc/KeyWithStringValue.pb.cc \
src/grpc/NetworkAddressRegisterService-grpc.pb.cc \
src/grpc/NetworkAddressRegisterService.pb.cc \
src/grpc/TraceSegmentService-grpc.pb.cc \
src/grpc/TraceSegmentService.pb.cc \
, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)

PHP_ADD_BUILD_DIR($ext_builddir/src/grpc)
PHP_ADD_LIBRARY(stdc++, 1, SKYWALKING_SHARED_LIBADD)
PHP_SUBST(SKYWALKING_SHARED_LIBADD)
fi
157 changes: 0 additions & 157 deletions sky-php7ext/grpc/common_struct.h

This file was deleted.

Loading