chuan-yun / Molten

php probe for zipkin and opentracing
Apache License 2.0
793 stars 160 forks source link

CLI模式可以正常上报数据,SAPI模式(php-fpm)不上报 #141

Open yetHandsome opened 5 years ago

yetHandsome commented 5 years ago

molten.ini

[molten]
extension=molten.so
molten.enable="1"
molten.service_name="local"
molten.tracing_cli=1
molten.open_report=1
molten.sampling_type=2
molten.sampling_rate=1
molten.notify_uri="http://172.20.10.18:9411/zipkin/"
molten.sink_http_uri="http://172.20.10.18:9411/api/v1/spans"
molten.sink_type=4
molten.sink_log_path="/tmp/logs/"

nginx配置 zipkin.me.conf

server {
    listen 80;
    server_name  zipkin.me;
    root "/usr/local/src/Molten/example";

    location / {
        index  index.html index.htm index.php;
        try_files $uri $uri/ /index.php;
    }

    location ~ \.php(.*)$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }
}

php -m 405 Method Not Allowed[PHP Modules] bz2 calendar Core ctype curl date exif fileinfo filter ftp gd gettext hash iconv igbinary json libxml mcrypt molten msgpack mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar readline redis Reflection session sockets SPL sqlite3 standard tokenizer Zend OPcache zlib

[Zend Modules] Zend OPcache

PHP执行还报错405 Method Not Allowed # php -v 405 Method Not AllowedPHP 7.0.33 (cli) (built: Jul 30 2019 11:48:07) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies

将 zipkin 的 java 服务 kill 掉就正常了 #php -v PHP 7.0.33 (cli) (built: Jul 30 2019 11:48:07) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies

yetHandsome commented 5 years ago

./configure --enable-zipkin-header=yes

checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib checking for PHP extension directory... /usr/lib64/php/modules checking for PHP installed headers prefix... /usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking whether to enable molten support... yes, shared checking whether to enable zipkin B3 header... yes checking whether to enable level span id... no checking for mmap... yes checking for munmap... yes checking check for php json... has found php json include file checking check for mysqlnd... mysqlnd not found, mysqli support will not complete checking check for pdo... has found pdo include file checking for curl-config... checking for librdkafka/rdkafka.h... checking how to print strings... printf checking for a sed that does not truncate output... (cached) /bin/sed checking for fgrep... /bin/grep -F checking for ld used by cc... /bin/ld checking if the linker (/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /bin/nm -B checking the name lister (/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 1572864 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop checking for /bin/ld option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking for gawk... (cached) gawk checking command to parse /bin/nm -B output from cc object... ok checking for sysroot... no checking for mt... no checking if : is a manifest tool... no checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if cc supports -fno-rtti -fno-exceptions... no checking for cc option to produce PIC... -fPIC -DPIC checking if cc PIC flag -fPIC -DPIC works... yes checking if cc static flag -static works... no checking if cc supports -c -o file.o... yes checking if cc supports -c -o file.o... (cached) yes checking whether the cc linker (/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no configure: creating ./config.status config.status: creating config.h config.status: executing libtool commands

php-cpm commented 5 years ago

cli 模式下报错注释掉 molten.notify_uri设置后重试

php-fpm 下无法请求问题请检查 curl 与 molten 扩展的加载顺序,molten 需要后加载

yetHandsome commented 5 years ago

ll /etc/php.d/ total 88 -rw-r--r--. 1 root root 47 Jul 30 17:54 20-bz2.ini -rw-r--r--. 1 root root 57 Jul 30 17:54 20-calendar.ini -rw-r--r--. 1 root root 51 Jul 30 17:54 20-ctype.ini -rw-r--r--. 1 root root 49 Jul 30 17:54 20-curl.ini -rw-r--r--. 1 root root 49 Jul 30 17:54 20-exif.ini -rw-r--r--. 1 root root 57 Jul 30 17:54 20-fileinfo.ini -rw-r--r--. 1 root root 47 Jul 30 17:54 20-ftp.ini -rw-r--r--. 1 root root 45 Jul 30 17:54 20-gd.ini -rw-r--r--. 1 root root 55 Jul 30 17:54 20-gettext.ini -rw-r--r--. 1 root root 51 Jul 30 17:54 20-iconv.ini -rw-r--r--. 1 root root 49 Jul 30 17:54 20-json.ini -rw-r--r--. 1 root root 53 Jul 30 17:54 20-mcrypt.ini -rw-r--r--. 1 root root 55 Jul 30 17:54 20-mysqlnd.ini -rw-r--r--. 1 root root 47 Jul 30 17:54 20-pdo.ini -rw-r--r--. 1 root root 49 Jul 30 17:54 20-phar.ini -rw-r--r--. 1 root root 55 Jul 30 17:54 20-sockets.ini -rw-r--r--. 1 root root 55 Jul 30 17:54 20-sqlite3.ini -rw-r--r--. 1 root root 59 Jul 30 17:54 20-tokenizer.ini -rw-r--r--. 1 root root 53 Jul 30 17:54 30-mysqli.ini -rw-r--r--. 1 root root 59 Jul 30 17:54 30-pdo_mysql.ini -rw-r--r--. 1 root root 61 Jul 30 17:54 30-pdo_sqlite.ini -rw-r--r--. 1 root root 358 Aug 20 02:26 molte.ini