Code Monkey home page Code Monkey logo

molten's Introduction

molten

Readme in Chinese 中文

Build Status

molten is transparency tool for application tracing it self module call.

It trace php app core call and output zipkin/opentracing format trace log.

Provides features about muliti trace sapi, multi sampling type, upload tracing status, module control and muliti sink type.

It very easy to build a distributed systems tracing infrastructure base on php, already run on thousand instance on production env.

Table of contents


  1. Installing
  2. QuickStart
  3. Configure
  4. Function
  5. Verify
  6. Features
  7. Contributing
  8. License

Installing

Everything you should need to install molten on your system.

phpize
./configure
make && make install

make install copies molten.so to and appropriate location, but you still need to enable the module int the PHP config file, To do so, either edit your php.ini or add ad molten.ini file in /etc/php5/conf.d with the following contents:extension=molten.so.

at ./configure phase, you can also add --enable-zipkin-header=yes to support zipkin B3 header.

if you want molten support POST method , at the compile phase you should check libcurl-devel is installed.

QuickStart

cd example
sh run.sh

open http://127.0.0.1:9411/zipkin/ in your browser, you can see the tracing detail in it.

if you think above is too simple, you also can do this.

cd example
sh complex.sh

it is cool, alright?

NOTICE if you not see the trace, you select EndTime +1 hour.

Configure

Base Config

molten.enable set 1 enable or set 0 disable, default 1.

molten.service_name is to set service name for label app service name. now we support add ini_set('molten.service_name', 'YOUR_PROJECT_NAME'); to code to trace different projects using same php enveroment.

molten.tracing_cli set 1 to trace, cli sapi, 0 not trace, just use for trace unit test, default 0.

molten.open_report set 1 to open report php error, default 0.

Sampling Config

molten.sampling_type sampling type choose to use sampling by rate(1) or request(2), default is 1.

molten.sampling_request sampling by request, set to per min request num, defualt is 1000.

molten.sampling_rate determine a request sampled or not by rate, default is 64.

Control Config

molten.notify_uri the uri for molten to notify manger.

Report Config

report module output type is same as sink module

molten.report_interval reporter call interval, default 60.

molten.report_limit reporter list limit current only for error num, default 100.

Sink Config

molten.sink_type sink type, 1 write log, log path is depend on molten.sink_log_path, 2 write log to standand output, 3 write log to syslog, 4 use curl to send trace log, http uri depend on molten.sink_http_uri.

molten.output_type output spans on one line(1) or one line one span(2).

molten.sink_log_path locate log path.

molten.sink_http_uri locate log http uri.

molten.sink_syslog_unix_socket transform log to syslog udp unix domain collector.

Spans Config

molten.span_format span format, you can select zipkin or zipkin_v2 or opentracing for different tracing system.

Function

molten_span_format() get current span format, return zipkin or opentraceing (string).

molten_get_traceid() get current context traceid, return hex string.

molten_set_traceid($trace_id) set current context traceid, return void.

Verify

php -d extension=molten.so -d molten.enable=1 -d molten.sink_type=2 -d molten.tracing_cli=1 -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:12345");curl_exec($c);'

You can see output below:

[{"traceId":"%s","name":"php_curl","version":"php-4","id":"1.1","parentId":"1","timestamp":%d,"duration":%d,"annotations":[{"value":"cs","timestamp":%d,"endpoint":{"serviceName":"%s","ipv4":"%s"}},{"value":"cr","timestamp":%d,"endpoint":{"serviceName":"%s","ipv4":"%s"}}],"binaryAnnotations":[{"key":"http.url","value":"http:\/\/localhost:12345\/","endpoint":{"serviceName":"%s","ipv4":"%s"}},{"key":"error","value":"Failed
connect to localhost:12345; Connection
refused","endpoint":{"serviceName":"%s","ipv4":"%s"}}]},{"traceId":"%s","name":"cli","version":"php-4","id":"1","timestamp":%d,"duration":%d,"annotations":[{"value":"sr","timestamp":%d,"endpoint":{"serviceName":"%s","ipv4":"%s"}},{"value":"ss","timestamp":%d,"endpoint":{"serviceName":"%s","ipv4":"%s"}}],"binaryAnnotations":[{"key":"path","value":"-","endpoint":{"serviceName":"%s","ipv4":"%s"}}]}]

Features

the Config Block above, you can see which feature we support.

Interceptor

we intercept curl,pdo,mysqli,redis,mongodb,memcached extension to build execute time span info. for chain http request, we replace curl_exec,curl_setopt,curl_setopt_array to add http request trace header (x-w-traceid, x-w-spanid and so on).

the span_format is the way to custom span format, for two popular kinds (zipkin and opentracing).

Sampling

different sampling type and change parameter to control sampling, rate or request.

Sink

Sink is the output where you locate, molten support to standard fd, file, http and others (continue), on this way, we can choose where to output trace log.

Control

Use http to control our sampling.

see molten status, request http://domain/molten/status use GET method.

the output is below, already adapt the style of prometheus.

# HELP molten_request_all Number of all request.
# TYPE molten_request_all counter
molten_request_all %d
# HELP molten_request_capture Number of request be capture.
# TYPE molten_request_capture counter
molten_request_capture %d
# HELP molten_sampling_type the type of sampling.
# TYPE molten_sampling_type gauge
molten_sampling_type %d
# HELP molten_sampling_rate the rate of sampling.
# TYPE molten_sampling_rate gauge
molten_sampling_rate %d
# HELP molten_sampling_request the request be capture one min.
# TYPE molten_sampling_request gauge
molten_sampling_request %d

modify molten sampling, request http://domain/molten/status use POST method,

body is json format, field has the same meaning of config.

{"enable":1,"samplingType":2,"samplingRate":20,"samplingRequest":100}

Report

Report base import info which we do not sampled like error list.

Contributing

Welcome developers who willing to make it better.

the mail list below you can contract for discuss and improve more power.

[email protected]

[email protected]

You may contribute in the following ways:

License

Apache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html

molten's People

Contributors

monque avatar php-cpm avatar remicollet avatar silkcutks avatar xianqiangzhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

molten's Issues

编译问题

--with-mysql 指定值后报错,默认不会报错,默认是mysqlnd吧,
--with-mysqli=/usr/bin/mysql_config

/usr/local/php5.5/include/php/ext/mysqli/php_mysqli_structs.h:63:23: fatal error: my_global.h: 没有那个文件或目录

构建的JSON Span内容是否考虑做下兼容?

2018-03-08 03:51:36.823  WARN 5 --- [nio-9411-exec-8] zipkin.server.ZipkinHttpCollector        : 
Cannot decode spans due to IllegalArgumentException(Expected value to be a boolean, string or number 
but was NULL at path $[2].binaryAnnotations[2].value reading List<Span> from json: 

查看对应的binaryAnnotations 确实是value 是null

"key": "http.response",
"value": null,
"endpoint": {
"serviceName": "xxxx",
"ipv4": "xxxx",
"port": 80
}
}

另外有部分zipkin的日志是这种

 java.lang.IllegalArgumentException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $ reading List<Span> from json: {"error":[]}

找了下以前的issue似乎也有类似的问题,这种情况是不是可以考虑忽略下?

compile time warning

Php 7.1 ubuntu

root@aasaam-app:/tmp/Molten-0.1.2beta# make && make install
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten.c -o molten.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten.c  -fPIC -DPIC -o .libs/molten.o
In file included from /tmp/Molten-0.1.2beta/molten_chain.h:30:0,
                 from /tmp/Molten-0.1.2beta/php_molten.h:35,
                 from /tmp/Molten-0.1.2beta/molten.c:24:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/tmp/Molten-0.1.2beta/molten.c: In function ‘zm_activate_molten’:
/tmp/Molten-0.1.2beta/molten.c:635:9: warning: implicit declaration of function ‘mo_chain_log_init’ [-Wimplicit-function-declaration]
         mo_chain_log_init(&PTG(pcl));
         ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_log.c -o molten_log.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_log.c  -fPIC -DPIC -o .libs/molten_log.o
In file included from /tmp/Molten-0.1.2beta/molten_util.h:30:0,
                 from /tmp/Molten-0.1.2beta/molten_log.h:54,
                 from /tmp/Molten-0.1.2beta/molten_log.c:17:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_intercept.c -o molten_intercept.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_intercept.c  -fPIC -DPIC -o .libs/molten_intercept.o
In file included from /tmp/Molten-0.1.2beta/molten_intercept.h:41:0,
                 from /tmp/Molten-0.1.2beta/molten_intercept.c:16:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_ctrl.c -o molten_ctrl.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_ctrl.c  -fPIC -DPIC -o .libs/molten_ctrl.o
In file included from /tmp/Molten-0.1.2beta/molten_util.h:30:0,
                 from /tmp/Molten-0.1.2beta/molten_ctrl.h:33,
                 from /tmp/Molten-0.1.2beta/molten_ctrl.c:17:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/common/molten_shm.c -o common/molten_shm.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/common/molten_shm.c  -fPIC -DPIC -o common/.libs/molten_shm.o
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/common/molten_stack.c -o common/molten_stack.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/common/molten_stack.c  -fPIC -DPIC -o common/.libs/molten_stack.o
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/common/molten_lock.c -o common/molten_lock.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/common/molten_lock.c  -fPIC -DPIC -o common/.libs/molten_lock.o
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_util.c -o molten_util.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_util.c  -fPIC -DPIC -o .libs/molten_util.o
In file included from /tmp/Molten-0.1.2beta/molten_util.h:30:0,
                 from /tmp/Molten-0.1.2beta/molten_util.c:16:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_span.c -o molten_span.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_span.c  -fPIC -DPIC -o .libs/molten_span.o
In file included from /tmp/Molten-0.1.2beta/molten_span.h:29:0,
                 from /tmp/Molten-0.1.2beta/molten_span.c:17:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_status.c -o molten_status.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_status.c  -fPIC -DPIC -o .libs/molten_status.o
In file included from /tmp/Molten-0.1.2beta/molten_util.h:30:0,
                 from /tmp/Molten-0.1.2beta/molten_ctrl.h:33,
                 from /tmp/Molten-0.1.2beta/molten_status.h:23,
                 from /tmp/Molten-0.1.2beta/molten_status.c:17:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_report.c -o molten_report.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_report.c  -fPIC -DPIC -o .libs/molten_report.o
In file included from /tmp/Molten-0.1.2beta/molten_report.h:24:0,
                 from /tmp/Molten-0.1.2beta/molten_report.c:17:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=compile cc  -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -c /tmp/Molten-0.1.2beta/molten_chain.c -o molten_chain.lo 
libtool: compile:  cc -I. -I/tmp/Molten-0.1.2beta -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common -DHAVE_CONFIG_H -g -O2 -c /tmp/Molten-0.1.2beta/molten_chain.c  -fPIC -DPIC -o .libs/molten_chain.o
In file included from /tmp/Molten-0.1.2beta/molten_chain.h:30:0,
                 from /tmp/Molten-0.1.2beta/molten_chain.c:17:
/tmp/Molten-0.1.2beta/php7_wrapper.h: In function ‘mo_array_merge’:
/tmp/Molten-0.1.2beta/php7_wrapper.h:245:5: warning: implicit declaration of function ‘php_array_merge_recursive’ [-Wimplicit-function-declaration]
     php_array_merge_recursive(Z_ARRVAL_P(dest), Z_ARRVAL_P(src));  
     ^
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/Molten-0.1.2beta/include -I/tmp/Molten-0.1.2beta/main -I/tmp/Molten-0.1.2beta -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/tmp/Molten-0.1.2beta -I/tmp/Molten-0.1.2beta/common  -DHAVE_CONFIG_H  -g -O2   -o molten.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/Molten-0.1.2beta/modules  molten.lo molten_log.lo molten_intercept.lo molten_ctrl.lo common/molten_shm.lo common/molten_stack.lo common/molten_lock.lo molten_util.lo molten_span.lo molten_status.lo molten_report.lo molten_chain.lo 
libtool: link: cc -shared  -fPIC -DPIC  .libs/molten.o .libs/molten_log.o .libs/molten_intercept.o .libs/molten_ctrl.o common/.libs/molten_shm.o common/.libs/molten_stack.o common/.libs/molten_lock.o .libs/molten_util.o .libs/molten_span.o .libs/molten_status.o .libs/molten_report.o .libs/molten_chain.o    -g -O2   -Wl,-soname -Wl,molten.so -o .libs/molten.so
common/.libs/molten_lock.o: In function `mo_fcntl_locK_init':
/tmp/Molten-0.1.2beta/common/molten_lock.c:147: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
libtool: link: ( cd ".libs" && rm -f "molten.la" && ln -s "../molten.la" "molten.la" )
/bin/bash /tmp/Molten-0.1.2beta/libtool --mode=install cp ./molten.la /tmp/Molten-0.1.2beta/modules
libtool: install: cp ./.libs/molten.so /tmp/Molten-0.1.2beta/modules/molten.so
libtool: install: cp ./.libs/molten.lai /tmp/Molten-0.1.2beta/modules/molten.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /tmp/Molten-0.1.2beta/modules

centos下使用yum安装php7+nginx时,molten的扩展会导致php-fpm启动时报错

yum安装包如下
php71-php-pecl-molten.x86_64 : Extension for application tracing
php72-php-pecl-molten.x86_64 : Extension for application tracing

启动php-fpm时报错,错误如下:

Job for php71-php-fpm.service failed because the control process exited with error code. See "systemctl status php71-php-fpm.service" and "journalctl -xe" for details.

yum删除molten安装,启动正常。

phpzie编译扩展暂时还没试。

molten kafka的配置项 怎么弄呢?

配置kafka不起效 我的配置如下:
molten.enable = 1
molten.service_name = test
molten.tracing_cli = 1
molten.sampling_type = 2
molten.sampling_request = 10
molten.sampling_rate_base = 1
molten.report_interval = 100
molten.report_limit = 100000
;molten.sink_type = 3
;molten.sink_syslog_unix_socket = "syslog"
molten.output_type = 1
;molten.sink_log_path = "/Users/gongjiapeng/"
;molten.sink_http_uri = "http://127.0.0.1:9411/api/v1/spans"
2033 molten.span_format = "zipkin"
2034 molten.sink_kafka_brokers = "127.0.0.1:9092"
2035 molten.sink_kafka_topic = "zipkins"

支持mac系统吗?

错误信息:
172-15-70-72:Molten-0.1.0 admin$ ./configure
172-15-70-72:Molten-0.1.0 admin$ make
/bin/sh /Users/admin/opt/php/Molten-0.1.0/libtool --mode=compile cc -I. -I/Users/admin/opt/php/Molten-0.1.0 -DPHP_ATOM_INC -I/Users/admin/opt/php/Molten-0.1.0/include -I/Users/admin/opt/php/Molten-0.1.0/main -I/Users/admin/opt/php/Molten-0.1.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -I/Users/admin/opt/php/Molten-0.1.0 -I/Users/admin/opt/php/Molten-0.1.0/common -DHAVE_CONFIG_H -g -O2 -c /Users/admin/opt/php/Molten-0.1.0/molten.c -o molten.lo
cc -I. -I/Users/admin/opt/php/Molten-0.1.0 -DPHP_ATOM_INC -I/Users/admin/opt/php/Molten-0.1.0/include -I/Users/admin/opt/php/Molten-0.1.0/main -I/Users/admin/opt/php/Molten-0.1.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -I/Users/admin/opt/php/Molten-0.1.0 -I/Users/admin/opt/php/Molten-0.1.0/common -DHAVE_CONFIG_H -g -O2 -c /Users/admin/opt/php/Molten-0.1.0/molten.c -fno-common -DPIC -o .libs/molten.o
In file included from /Users/admin/opt/php/Molten-0.1.0/molten.c:24:
In file included from ./php_molten.h:36:
In file included from ./molten_intercept.h:33:
/usr/local/include/php/ext/mysqli/php_mysqli_structs.h:63:10: fatal error: 'my_global.h' file not found
#include <my_global.h>
^
1 error generated.
make: *** [molten.lo] Error 1

my_global.h文件路径:
172-15-70-72:Molten-0.1.0 admin$ ls /usr/local/include/mysql/
big_endian.h m_ctype.h my_dir.h mysql/ mysqld_error.h plugin_keyring.h thr_mutex.h
binary_log_types.h m_string.h my_getopt.h mysql.h mysqlx_ername.h plugin_validate_password.h thr_rwlock.h
byte_order_generic.h my_alloc.h my_global.h mysql_com.h mysqlx_error.h sql_common.h typelib.h
byte_order_generic_x86.h my_byteorder.h my_list.h mysql_com_server.h mysqlx_version.h sql_state.h
decimal.h my_command.h my_sys.h mysql_embed.h plugin.h sslopt-case.h
errmsg.h my_compiler.h my_thread.h mysql_time.h plugin_audit.h sslopt-longopts.h
keycache.h my_config.h my_thread_local.h mysql_version.h plugin_ftparser.h sslopt-vars.h
little_endian.h my_dbug.h my_xml.h mysqld_ername.h plugin_group_replication.h thr_cond.h

输出{"error":[]}

编译安装之后使用cli模式调用php可以正常捕获php_curl的调用,
但是在web环境下只能捕获mysqli的调用,
php_curl的调用就变成了{"error":[]}

关于molten/status中字段的含义

HELP molten_request_all Number of all request.

TYPE molten_request_all counter

molten_request_all 44

HELP molten_request_capture Number of request be capture.

TYPE molten_request_capture counter

molten_request_capture 44

HELP molten_sampling_type the type of sampling.

TYPE molten_sampling_type gauge

molten_sampling_type 2

HELP molten_sampling_rate the rate of sampling.

TYPE molten_sampling_rate gauge

molten_sampling_rate 1

HELP molten_sampling_request the request be capture one min.

TYPE molten_sampling_request gauge

molten_sampling_request 100

HELP molten_version current molten span version.

TYPE molten_version gauge

molten_version php-4

这里的molten_version指什么?我使用的是PHP71,谢谢

是否考虑支持类似hprose的rpc服务

一直在找php的链路跟踪方案,有幸找到了这个。基本上现在跑通了,谢谢你们的劳动。
我在使用hprose集成的时候,发现如下几个问题
1.无论请求多少个服务,都只获取到一个service。举个例子

$client = Client::create('http://192.168.52.139/HttpServer.php', false);
$client->init();
$client->payment();

  1. service例子都是一样的,我如果要区分,必须要把所有的拆分成curl调用吗?我可以自定义吗?比如一个支付过程,分为初始化,支付等,目前通过rpc调用服务,现在看起来只会记录一条。。这个不知道有没有什么好的解决方法。

编译不了,报错

环境:
vagrant&ubuntu14.04 & php5.6.29

错误信息:
In file included from /home/vagrant/Molten/molten_intercept.c:18:0:
/usr/local/webserver/php5629/include/php/ext/mysqli/php_mysqli_structs.h:63:23: fatal error: my_global.h: No such file or directory

运行run.sh出现问题

PHP Warning: Module 'molten' already loaded in Unknown on line 0

出现上面的错误。怎么解决?

example里的zipkin.sh逻辑问题

    zipkin=`ps aux|grep zipkin|grep -v grep`
    if [ -z "$zipkin" ]; then
    java -jar zipkin.jar --logging.level.zipkin=DEBUG 2>&1 >/dev/null &
    sleep 10
    fi

Molten 对swoole的支持

swoole建立的服务器常驻内存,Molten 是否可以添加对swoole的识别。
还有就是swoole 2.* 官方说开启Molten,会出现崩溃的情况
请问 Molten 对swoole的支持 是否有响应的兼容计划呢

Temp usage issue

In molten_lock.h

char lock_path[LOCK_PATH_SIZE];

So lock_path is always set

In molten_lock.h

if (lock->lock_path == NULL) {

So this condition is always false.

mktemp(lock->lock_path);

mktemp is unsecure and should not be used

$ man 3 mktemp
       Never use this function; see BUGS.
$ make
...
/work/GIT/Molten/common/molten_lock.c:147: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'

Proposal: use php_open_temporary_fd_ex public PHP API.

trace spans信息会被截断

文件输出的span json,zipkin格式下会从前面的信息截断到trace_id,opentracing格式下会从后面截断,json不完整,会不间断的会出现。不管是否做压测都会出现。会是写文件并发导致的吗?
配置信息:
extension=molten.so
molten.enable=1
molten.tracing_cli=1
molten.sampling_rate=1
molten.sink_type=1
molten.sink_log_path=/tmp/molten/

Can't load extension

PHP Warning: PHP Startup: Unable to load dynamic library 'modules/molten.so' - modules/molten.so: undefined symbol: MOLTEN_ERROR in Unknown on line 0

And indeed, lot of -Wimplicit-function-declaration during the build, some of them

/tmp/Molten-0.1.0beta/php7_wrapper.h:245:5: attention : implicit declaration of function « php_array_merge_recursive » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/molten.c:681:5: attention : implicit declaration of function « mo_intercept_uninit » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/molten.c:643:5: attention : implicit declaration of function « mo_intercept_init » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/molten.c:557:5: attention : implicit declaration of function « mo_shm_ctor » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/molten_ctrl.c:178:17: attention : implicit declaration of function « check_hit_ratio » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/common/molten_shm.c:28:9: attention : implicit declaration of function « MOLTEN_ERROR » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/common/molten_lock.c:151:9: attention : implicit declaration of function « unlink » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/common/molten_lock.c:162:5: attention : implicit declaration of function « close » [-Wimplicit-function-declaration]
/tmp/Molten-0.1.0beta/molten_chain.c:121:9: attention : implicit declaration of function « rand64hex » [-Wimplicit-function-declaration]
...

运行正常,但无法上报zipkin服务器

描述:Molten和zipkin在同一台服务器上,php版本:PHP 7.1.8
1.使用curl是可以正常上报数据的。
curl -X POST
http://127.0.0.1:9411/api/v1/spans
-H 'cache-control: no-cache'
-H 'content-type: application/json'
-d ''
2. molten.sink_type=2,可以正常输出trance json串的
3. nc -l 1111,然后运行命令
php -d molten.enable=1 -d molten.sampling_type=1 -d molten.sink_type=4 -d molten.tracing_cli=1 -d molten.sink_http_uri=http://127.0.0.1:1111/api/v1/spans -d molten.service_name=php_test -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:12345");curl_exec($c);'
qq 20171207140637
4.日志输出:

qq 20171207140731

已经调试了一整天但依然无法自行解决问题,麻烦帮忙看下,谢谢!

是否可以提供php层自定义上报功能

非常感谢你们搞了这么一个透明的针对各种io进行上报的功能,非常方便好用。
我们在实际应用中发现,我们时常需要针对一部分业务和逻辑来自定义一些上报。
比如opentracing里面可以自己定义的span等,这样我们可以更加详细的分析我们的系统,不只是各种io

undefined symbol: php_pdo_get_exception in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/home/Molten-master/modules/molten.so' - /home/Molten-master/modules/molten.so: undefined symbol: php_pdo_get_exception in Unknown on line 0

php_pdo_get_exception这个方法没有定义怎么回事,我按照方法安装了,还是报错,能提供个微信群吗

molten 采集类型

你好,请问molten 采样类型除了 1采样率 和2每分钟数,有没有可能考虑 对trace_id的响应时间做采样或存储.
我的需求是: 系统可以存储 响应时间 大于300ms的请求.

非常感谢~

.

.

Segmentation fault with PHP 7.2

Tests are also failing, but could not get any more info from them. So i made report with gdb...

Any ideas what could be the cause?

PHP:

PHP 7.2.3-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Mar  6 2018 12:03:48) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.3-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
root@roses:~/Molten/example# gdb php
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from php...(no debugging symbols found)...done.
(gdb) run -d extension=molten.so -d molten.enable=1 -d molten.sink_type=2 -d molten.tracing_cli=1 -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:1");curl_exec($c);'
Starting program: /usr/bin/php -d extension=molten.so -d molten.enable=1 -d molten.sink_type=2 -d molten.tracing_cli=1 -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:1");curl_exec($c);'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe7676700 (LWP 12846)]
[Thread 0x7fffe7676700 (LWP 12846) exited]
[{"traceId":"993eadb0d8dad3fa","name":"php_curl","version":"php-4","id":"9a62332b17f96ad3","parentId":"885500d93341be44","timestamp":1521723157392157,"duration":31502,"annotations":[{"value":"cs","timestamp":1521723157392157,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}},{"value":"cr","timestamp":1521723157423659,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}],"binaryAnnotations":[{"key":"http.url","value":"http:\/\/localhost:1\/","endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}},{"key":"error","value":"Failed to connect to localhost port 1: Connection refused","endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}]},{"traceId":"993eadb0d8dad3fa","name":"cli","version":"php-4","id":"885500d93341be44","timestamp":1521723157391992,"duration":31749,"annotations":[{"value":"sr","timestamp":1521723157391992,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}},{"value":"ss","timestamp":1521723157423741,"endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}],"binaryAnnotations":[{"key":"path","value":"Standard input code","endpoint":{"serviceName":"default","ipv4":"10.19.0.6"}}]}]

Program received signal SIGSEGV, Segmentation fault.
0x00005555557d5d50 in zend_function_dtor ()
(gdb) where
#0  0x00005555557d5d50 in zend_function_dtor ()
#1  0x00005555557f225b in zend_hash_str_del ()
#2  0x00007fffe5bcb444 in molten_clear_reload_function () at /root/Molten/molten.c:234
#3  zm_shutdown_molten (type=<optimized out>, module_number=<optimized out>) at /root/Molten/molten.c:623
#4  0x00005555557e8433 in ?? ()
#5  0x00005555557e007c in ?? ()
#6  0x00005555557f3208 in zend_hash_graceful_reverse_destroy ()
#7  0x00005555557e1ace in ?? ()
#8  0x0000555555780a9b in php_module_shutdown ()
#9  0x00005555556420b5 in ?? ()
#10 0x00007ffff5fe5f45 in __libc_start_main (main=0x555555641d00, argc=13, argv=0x7fffffffe5c8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe5b8) at libc-start.c:287
#11 0x0000555555642273 in _start ()

Looks like https://github.com/chuan-yun/Molten/blob/master/molten.c#L216 tryies to restore overloaded function which is no longer there ....

13:18:35 INFO   /root/Molten/molten.c:585: molten start
13:18:35 INFO   /root/Molten/molten_log.c:31: [sink][http] http data sender, post_uri:
13:18:35 INFO   /root/Molten/molten_log.c:184: [sink] has libcurl
13:18:35 INFO   /root/Molten/molten_log.c:200: [sink] current select sink_type:4, input type4
13:18:35 INFO   /root/Molten/molten.c:656: molten request init
113:18:35 INFO   /root/Molten/molten.c:700: molten request shutdown
13:18:35 INFO   /root/Molten/molten_log.c:477: [sink] mo log flush 
13:18:35 INFO   /root/Molten/molten_log.c:526: [sink] mo log flush detail size:473
13:18:35 INFO   /root/Molten/molten_log.c:428: [sink] mo log write sink_type [4]
13:18:35 INFO   /root/Molten/molten_log.c:31: [sink][http] http data sender, post_uri:http://127.0.0.1:9411/api/v1/spans
13:18:35 INFO   /root/Molten/molten_log.c:47:  curl request code:0
Segmentation fault (core dumped)
(gdb) bt
#0  0x00005555557d5d50 in zend_function_dtor ()
#1  0x00005555557f225b in zend_hash_str_del ()
#2  0x00007fffe5bcb444 in molten_clear_reload_function () at /root/Molten/molten.c:234
#3  zm_shutdown_molten (type=<optimized out>, module_number=<optimized out>) at /root/Molten/molten.c:623
#4  0x00005555557e8433 in ?? ()
#5  0x00005555557e007c in ?? ()
#6  0x00005555557f3208 in zend_hash_graceful_reverse_destroy ()
#7  0x00005555557e1ace in ?? ()
#8  0x0000555555780a9b in php_module_shutdown ()
#9  0x00005555556420b5 in ?? ()
#10 0x00007ffff5fe5f45 in __libc_start_main (main=0x555555641d00, argc=17, argv=0x7fffffffe578, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffe568) at libc-start.c:287
(gdb) frame 2
#2  0x00007fffe5bcb444 in molten_clear_reload_function () at /root/Molten/molten.c:234
234	              zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func)); 
(gdb) print p
$1 = (const mo_reload_def *) 0x7fffe5ddb530 <prd+48>
(gdb) print p->save_func
$3 = 0x7fffe5bd7578 "origin_molten_curl_setopt_array"
(gdb) print p->orig_func
$4 = 0x7fffe5bd74e9 "curl_setopt_array"
(gdb) print p->over_func
$5 = 0x7fffe5bd74e2 "molten_curl_setopt_array"

zts不支持?

PHP编译参数--enable-maintainer-zts的情况下,

编译报错,configure: error: molten does not support ZTS

请问这个后续会支持吗?

小咨询下

我看curl相关函数的拦截和redis pdo memcache的拦截有些差异,是否版本的迭代导致的? 如果是,那哪种拦截方式才是通用些的呢?

The document should be a little more detailed

How adjust the value of these options in different production envirement?

  • molten.sampling_request
  • molten.sampling_rate
  • molten.report_interval
  • molten.report_limit

How can we use the notify function ? What does it do ?
molten.notify_uri

小建议

建议把安装需要的基础软件在readme里面说明一下,比如docker,jdk8等

php5.2.17 可以安装molten扩展吗?

make的时候报错:

/usr/local/src/Molten/molten_log.c: In function ‘mo_chain_log_flush’:
/usr/local/src/Molten/molten_log.c:493: error: too many arguments to function ‘php_json_encode’
/usr/local/src/Molten/molten_log.c:517: error: too many arguments to function ‘php_json_encode’

cli模式下PHP脚本内存会暴增?

cli大批量数据操作和较长时间业务逻辑,不开启molten扩展没有问题,开启之后内存超过限制,怀疑molten开启之后,会大大增大内存消耗

猜测是调用时都会记录一些信息,cli大脚本不进入request end阶段导致内存迟迟没回收

PHP5.6 安装成功运行 run.sh 出错

如题,PHP5.6 安装过程没有任何报错。但运行 run.sh 不成功。

sh run.sh

which: no docker in (/usr/local/sbin:
……
运行以下也没有任何反应

php -d extension=molten.so -d molten.enable=1 -d molten.sink_type=2 -d molten

.tracing_cli=1 -d molten.sampling_rate=1 -r '$c=curl_init("http://localhost:12345");curl_exec($c);
'
是否一定要求有 docker 环境呢?另外Molten 是否对 PHP 版本有要求,发现在 PHP5.3里貌似不能安装。

不支持SOAP?

我有个接口调用的是第三方提供的SOAP接口,发现捕获不到调用SOAP的相关信息

PHP71 cli执行run.sh无法写入zipkin

php71 -d molten.enable=1 -d molten.sink_type=4 -d molten.tracing_cli=1 -d molten.sink_http_uri=http://127.0.0.1:9411/api/v1/spans -d molten.service_name=php_test -d molten.sampling_rate=1 -r '$c=curl_init("http://10.11.4.55");curl_exec($c);'

zipkin启动命令行,并且创建了相应的数据
java -jar zipkin.jar --STORAGE_TYPE=mysql --MYSQL_DB=zipkindb --MYSQL_USER=root --MYSQL_PASS=xxx --MYSQL_HOST=127.0.0.1--MYSQL_TCP_PORT=3306

开始以为是php-fpm启动的原因,停掉后执行还是写不进去zipkin。

另外,我使用nginx+php-fpm(php7)环境时,也是无法写数据到zipkin,低版本的php5.6当时测试时是没有问题的。我的molten配置如下
molten.enable = 1
molten.sink_log_path = '/tmp/tracing'
molten.service_name = 'xxx'
molten.tracing_cli = 1
molten.sampling_type = 2
molten.sampling_request = 100
molten.sampling_rate = 1
molten.span_format = 'zipkin'
molten.report_interval = 60
molten.notify_uri = ''
molten.report_limit = 100
molten.sink_type = 4
molten.output_type = 1
molten.sink_http_uri = 'http://127.0.0.1:9411/api/v1/spans'
molten.sink_syslog_unix_socket = ''
molten.sink_kafka_brokers= ''
molten.sink_kafka_topic = ''

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.