chuan-yun / Molten

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

molten支持socket吗 #104

Open xyzj91 opened 6 years ago

xyzj91 commented 6 years ago

请问下molten支持socket吗

amiter commented 6 years ago

请问下molten支持socket吗

可以自定义拦截你的socket相关函数。 或者molten_get_traceid() 透传给你的socket server

xyzj91 commented 6 years ago

嗯嗯,好的谢谢

xyzj91 commented 6 years ago

请问下molten支持socket吗

可以自定义拦截你的socket相关函数。 或者molten_get_traceid() 透传给你的socket server

我看了下代码,这个molten_get_traceid和molten_set_traceid这两个函数是昨天刚加上去的吗?还有请问下提供的另外的几个函数是用在哪里的啊?有没有函数的说明文档啊?

amiter commented 6 years ago

请问下molten支持socket吗

可以自定义拦截你的socket相关函数。 或者molten_get_traceid() 透传给你的socket server

我看了下代码,这个molten_get_traceid和molten_set_traceid这两个函数是昨天刚加上去的吗?还有请问下提供的另外的几个函数是用在哪里的啊?有没有函数的说明文档啊?

可以参考 file_put_contents是怎样加入自定义函数的,我fork了一个库,加入了stream_socket_client\stream_socket_sendto\frwrite

xyzj91 commented 6 years ago

请问下molten支持socket吗

可以自定义拦截你的socket相关函数。 或者molten_get_traceid() 透传给你的socket server

我看了下代码,这个molten_get_traceid和molten_set_traceid这两个函数是昨天刚加上去的吗?还有请问下提供的另外的几个函数是用在哪里的啊?有没有函数的说明文档啊?

可以参考 file_put_contents是怎样加入自定义函数的,我fork了一个库,加入了stream_socket_client\stream_socket_sendto\frwrite

这一块我也增加上去了,我想问下moltem这个扩展会将上报的信息截断,导致看到的response不完整,请问你解决这个问题了吗?

silkcutKs commented 6 years ago

@xyzj91 请帮忙将你发生截断信息的请求或者调用的上下文发一下吧, 我这里看一下。

xyzj91 commented 6 years ago

@xyzj91 请帮忙将你发生截断信息的请求或者调用的上下文发一下吧, 我这里看一下。 public function test(){ $html = curl_http("https://www.baidu.com"); echo $html; } 中这个curk_http是基于curl封装的一个请求函数,下面是请求的详细日志: [{"traceId":"97cc67746f267499","name":"stream_socket_client","version":"php-4","id":"ccec4062788c94f2","parentId":"8617ebb36a436e91","timestamp":1540454516864809,"duration":10097,"annotations":[{"value":"cs","timestamp":1540454516864809,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516874906,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"socket.address","value":"tcp:\/\/119.23.250.196:6379","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fwrite","version":"php-4","id":"1478e2c54784b037","parentId":"8617ebb36a436e91","timestamp":1540454516874980,"duration":53,"annotations":[{"value":"cs","timestamp":1540454516874980,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516875033,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fwrite.data","value":"2\r\n$4\r\nAUTH\r\n$74\r\ny\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fgets","version":"php-4","id":"e8ad520547d13e63","parentId":"8617ebb36a436e91","timestamp":1540454516875054,"duration":9919,"annotations":[{"value":"cs","timestamp":1540454516875054,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516884973,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fgets.data","value":"+OK\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fwrite","version":"php-4","id":"28b321ce0b04431e","parentId":"8617ebb36a436e91","timestamp":1540454516885378,"duration":44,"annotations":[{"value":"cs","timestamp":1540454516885378,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516885422,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fwrite.data","value":"2\r\n$4\r\nAUTH\r\n$74\r\ny\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fgets","version":"php-4","id":"f6f8ce6615456e22","parentId":"8617ebb36a436e91","timestamp":1540454516885436,"duration":12549,"annotations":[{"value":"cs","timestamp":1540454516885436,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516897985,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fgets.data","value":"+OK\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fwrite","version":"php-4","id":"ada611d05c0be797","parentId":"8617ebb36a436e91","timestamp":1540454516898233,"duration":54,"annotations":[{"value":"cs","timestamp":1540454516898233,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516898287,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fwrite.data","value":"*2\r\n$3\r\nGET\r\n$26\r\nftkett40kmufff1inkd1dhol64\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fgets","version":"php-4","id":"43bc0a75f5487809","parentId":"8617ebb36a436e91","timestamp":1540454516898304,"duration":10274,"annotations":[{"value":"cs","timestamp":1540454516898304,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516908578,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fgets.data","value":"$37\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"php_curl","version":"php-4","id":"7bb7de8d57c299aa","parentId":"8617ebb36a436e91","timestamp":1540454516910350,"duration":77720,"annotations":[{"value":"cs","timestamp":1540454516910350,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516988070,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"http.url","value":"https:\/\/www.baidu.com\/","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"key":"http.status1","value":"200","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"key":"http.response","value":"<!DOCTYPE html>\r\n\r\n\r\n\t<meta http-equiv=\"content-type\" content=\"text\/html;charset=utf-8\">\r\n\t<meta ht","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"GET","version":"php-4","id":"8617ebb36a436e91","timestamp":1540454516850386,"duration":138741,"annotations":[{"value":"sr","timestamp":1540454516850386,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"ss","timestamp":1540454516989127,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"http.url","value":"http:\/\/www.manage.com\/cmts.php?c=index&a=test&t=1540369243&channel_id=1&cinema_id=4&skip=1","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"key":"path","value":"\/data\/wwwroot\/lile\/manage\/cmts.php","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]}]

http.response这一段被截断了,只显示了一小部分,我想问下您这边有没有做参数的长度限制啊?

xyzj91 commented 6 years ago

@xyzj91 请帮忙将你发生截断信息的请求或者调用的上下文发一下吧, 我这里看一下。 public function test(){ $html = curl_http("https://www.baidu.com"); echo $html; } 中这个curk_http是基于curl封装的一个请求函数,下面是请求的详细日志: [{"traceId":"97cc67746f267499","name":"stream_socket_client","version":"php-4","id":"ccec4062788c94f2","parentId":"8617ebb36a436e91","timestamp":1540454516864809,"duration":10097,"annotations":[{"value":"cs","timestamp":1540454516864809,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516874906,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"socket.address","value":"tcp://119.23.250.196:6379","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fwrite","version":"php-4","id":"1478e2c54784b037","parentId":"8617ebb36a436e91","timestamp":1540454516874980,"duration":53,"annotations":[{"value":"cs","timestamp":1540454516874980,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516875033,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fwrite.data","value":"2\r\n$4\r\nAUTH\r\n$74\r\ny\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fgets","version":"php-4","id":"e8ad520547d13e63","parentId":"8617ebb36a436e91","timestamp":1540454516875054,"duration":9919,"annotations":[{"value":"cs","timestamp":1540454516875054,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516884973,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fgets.data","value":"+OK\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fwrite","version":"php-4","id":"28b321ce0b04431e","parentId":"8617ebb36a436e91","timestamp":1540454516885378,"duration":44,"annotations":[{"value":"cs","timestamp":1540454516885378,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516885422,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fwrite.data","value":"2\r\n$4\r\nAUTH\r\n$74\r\ny\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fgets","version":"php-4","id":"f6f8ce6615456e22","parentId":"8617ebb36a436e91","timestamp":1540454516885436,"duration":12549,"annotations":[{"value":"cs","timestamp":1540454516885436,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516897985,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fgets.data","value":"+OK\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fwrite","version":"php-4","id":"ada611d05c0be797","parentId":"8617ebb36a436e91","timestamp":1540454516898233,"duration":54,"annotations":[{"value":"cs","timestamp":1540454516898233,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516898287,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fwrite.data","value":"*2\r\n$3\r\nGET\r\n$26\r\nftkett40kmufff1inkd1dhol64\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"fgets","version":"php-4","id":"43bc0a75f5487809","parentId":"8617ebb36a436e91","timestamp":1540454516898304,"duration":10274,"annotations":[{"value":"cs","timestamp":1540454516898304,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516908578,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"fgets.data","value":"$37\r\n","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"php_curl","version":"php-4","id":"7bb7de8d57c299aa","parentId":"8617ebb36a436e91","timestamp":1540454516910350,"duration":77720,"annotations":[{"value":"cs","timestamp":1540454516910350,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"cr","timestamp":1540454516988070,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"http.url","value":"https://www.baidu.com/","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"key":"http.status1","value":"200","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"key":"http.response","value":"\r\n\r\n\r\n\t\r\n\t<meta ht","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]},{"traceId":"97cc67746f267499","name":"GET","version":"php-4","id":"8617ebb36a436e91","timestamp":1540454516850386,"duration":138741,"annotations":[{"value":"sr","timestamp":1540454516850386,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"value":"ss","timestamp":1540454516989127,"endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}],"binaryAnnotations":[{"key":"http.url","value":"http://www.manage.com/cmts.php?c=index&a=test&t=1540369243&channel_id=1&cinema_id=4&skip=1","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}},{"key":"path","value":"/data/wwwroot/lile/manage/cmts.php","endpoint":{"serviceName":"native","ipv4":"192.168.0.115","port":80}}]}]

http.response这一段被截断了,只显示了一小部分,我想问下您这边有没有做参数的长度限制啊?

silkcutKs commented 6 years ago

http.response这边做了限制

xyzj91 commented 6 years ago

http.response这边做了限制

嗯嗯,谢谢,找到了。而且我已经将源码那边将限制长度改为了可配置了