Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SkyAPM
SkyAPM-php-sdk
提交
d12ff96f
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,体验更适合开发者的 AI 搜索 >>
提交
d12ff96f
编写于
7月 29, 2019
作者:
w60514603
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add yar client support: ./configure --enable-yarclient=yes (default=no)
上级
83027ebe
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
3 deletion
+46
-3
config.m4
config.m4
+7
-0
skywalking.c
skywalking.c
+39
-3
未找到文件。
config.m4
浏览文件 @
d12ff96f
PHP_ARG_ENABLE(skywalking, whether to enable skywalking support,
[ --enable-skywalking Enable skywalking support])
PHP_ARG_ENABLE(yarclient, whether to enable yar client support,
[ --enable-yarclient Enable yar client support], no, no)
if test "$PHP_SKYWALKING" != "no"; then
PHP_NEW_EXTENSION(skywalking, \
skywalking.c \
...
...
@@ -8,3 +11,7 @@ if test "$PHP_SKYWALKING" != "no"; then
encode.c \
, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
if test "$PHP_YARCLIENT" != "no"; then
AC_DEFINE(ENABLE_YAR_CLIENT, 1, [Enable yar client support])
fi
skywalking.c
浏览文件 @
d12ff96f
...
...
@@ -189,7 +189,7 @@ ZEND_API void sky_execute_ex(zend_execute_data *execute_data) {
add_assoc_string
(
&
tags
,
"db.type"
,
"redis"
);
uint32_t
arg_count
=
ZEND_CALL_NUM_ARGS
(
execute_data
);
zval
*
fname
=
ZEND_CALL_ARG
(
execute_data
,
1
);
int
i
;
int
i
;
for
(
i
=
1
;
i
<
arg_count
+
1
;
++
i
)
{
if
(
i
==
1
)
{
continue
;
...
...
@@ -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
...
...
@@ -351,6 +352,25 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return
strcat
(
operationName
,
function_name
);
}
}
#ifdef ENABLE_YAR_CLIENT
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
));
}
}
}
}
#endif
}
else
if
(
function_name
!=
NULL
)
{
if
(
strcmp
(
function_name
,
"mysqli_query"
)
==
0
)
{
class_name
=
"mysqli"
;
...
...
@@ -474,7 +494,23 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return
}
}
}
#ifdef ENABLE_YAR_CLIENT
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
));
}
}
}
}
#endif
zval
temp
;
zval
*
spans
=
NULL
;
...
...
@@ -496,7 +532,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录