Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SkyAPM
SkyAPM-php-sdk
提交
4b99fe02
S
SkyAPM-php-sdk
项目概览
SkyAPM
/
SkyAPM-php-sdk
通知
14
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyAPM-php-sdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4b99fe02
编写于
7月 30, 2019
作者:
何
何延龙
提交者:
GitHub
7月 30, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #102 from bostin/feature/add_yar_client_support
add yar client support
上级
f08b40fc
2c332f16
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
35 addition
and
3 deletion
+35
-3
README.md
README.md
+1
-0
docs/zh/qa.md
docs/zh/qa.md
+1
-0
skywalking.c
skywalking.c
+33
-3
未找到文件。
README.md
浏览文件 @
4b99fe02
...
...
@@ -22,6 +22,7 @@ Host in Beijing. Go to [demo](http://106.75.237.45:8080/).
1.
CURL
1.
PDO
1.
Mysqli
1.
Yar Client (
[
Yar
](
https://www.php.net/manual/en/book.yar.php
)
)
## Contact Us
*
Submit an
[
issue
](
https://github.com/SkyAPM/SkyAPM-php-sdk/issues
)
...
...
docs/zh/qa.md
浏览文件 @
4b99fe02
...
...
@@ -19,6 +19,7 @@
*
php curl扩展发出的请求
*
php PDO扩展发出的请求
*
php mysqli扩展发出的请求
*
php yar扩展(client)发出的请求
1.
skywalking_get_trace_info()函数的返回值格式?
*
返回值为数组。如果扩展加载但是未启用(
`skywalking.enable=0`
), 则返回空数组
...
...
skywalking.c
浏览文件 @
4b99fe02
...
...
@@ -319,6 +319,7 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return
char
*
operationName
=
NULL
;
char
*
peer
=
NULL
;
char
*
component
=
NULL
;
int
componentId
=
COMPONENT_MYSQL_JDBC_DRIVER
;
if
(
class_name
!=
NULL
)
{
if
(
strcmp
(
class_name
,
"PDO"
)
==
0
)
{
if
(
strcmp
(
function_name
,
"exec"
)
==
0
...
...
@@ -350,6 +351,22 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return
strcat
(
operationName
,
"->"
);
strcat
(
operationName
,
function_name
);
}
}
else
if
(
strcmp
(
class_name
,
"Yar_Client"
)
==
0
)
{
if
(
strcmp
(
function_name
,
"__call"
)
==
0
)
{
componentId
=
COMPONENT_GRPC
;
component
=
(
char
*
)
emalloc
(
strlen
(
"Yar_Client"
)
+
1
);
strcpy
(
component
,
"Yar_Client"
);
uint32_t
arg_count
=
ZEND_CALL_NUM_ARGS
(
execute_data
);
if
(
arg_count
)
{
zval
*
p
=
ZEND_CALL_ARG
(
execute_data
,
1
);
if
(
Z_TYPE_P
(
p
)
==
IS_STRING
)
{
operationName
=
(
char
*
)
emalloc
(
strlen
(
class_name
)
+
strlen
(
Z_STRVAL_P
(
p
))
+
3
);
strcpy
(
operationName
,
class_name
);
strcat
(
operationName
,
"->"
);
strcat
(
operationName
,
Z_STRVAL_P
(
p
));
}
}
}
}
}
else
if
(
function_name
!=
NULL
)
{
if
(
strcmp
(
function_name
,
"mysqli_query"
)
==
0
)
{
...
...
@@ -473,8 +490,21 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return
}
}
}
}
else
if
(
strcmp
(
class_name
,
"Yar_Client"
)
==
0
)
{
if
(
strcmp
(
function_name
,
"__call"
)
==
0
)
{
zval
rv
,
_uri
;
ZVAL_STRING
(
&
_uri
,
"_uri"
);
zval
*
yar_uri
=
Z_OBJ_HT
(
EX
(
This
))
->
read_property
(
&
EX
(
This
),
&
_uri
,
BP_VAR_R
,
0
,
&
rv
);
add_assoc_string
(
&
tags
,
"yar.uri"
,
Z_STRVAL_P
(
yar_uri
));
uint32_t
arg_count
=
ZEND_CALL_NUM_ARGS
(
execute_data
);
if
(
arg_count
)
{
zval
*
p
=
ZEND_CALL_ARG
(
execute_data
,
1
);
if
(
Z_TYPE_P
(
p
)
==
IS_STRING
)
{
add_assoc_string
(
&
tags
,
"yar.method"
,
Z_STRVAL_P
(
p
));
}
}
}
}
zval
temp
;
zval
*
spans
=
NULL
;
...
...
@@ -496,7 +526,7 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return
add_assoc_long
(
&
temp
,
"spanType"
,
1
);
add_assoc_long
(
&
temp
,
"spanLayer"
,
1
);
// add_assoc_string(&temp, "component", component);
add_assoc_long
(
&
temp
,
"componentId"
,
COMPONENT_MYSQL_JDBC_DRIVER
);
add_assoc_long
(
&
temp
,
"componentId"
,
componentId
);
add_assoc_string
(
&
temp
,
"operationName"
,
operationName
);
add_assoc_string
(
&
temp
,
"peer"
,
peer
==
NULL
?
""
:
peer
);
efree
(
component
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录