Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SkyAPM
SkyAPM-php-sdk
提交
e3462199
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 搜索 >>
提交
e3462199
编写于
4月 09, 2019
作者:
G
goerzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Entry span sets url tag
上级
6dd0092f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
4 deletion
+57
-4
php_skywalking.h
php_skywalking.h
+1
-0
skywalking.c
skywalking.c
+52
-1
src/report/report_client.cpp
src/report/report_client.cpp
+4
-3
未找到文件。
php_skywalking.h
浏览文件 @
e3462199
...
...
@@ -136,6 +136,7 @@ static char *generate_sw3(zend_long span_id, char *peer_host, char *operation_na
static
char
*
generate_sw6
(
zend_long
span_id
,
char
*
peer_host
,
char
*
operation_name
);
static
void
generate_context
();
static
char
*
get_page_request_uri
();
static
char
*
get_page_request_peer
();
static
void
write_log
(
char
*
text
);
static
void
request_init
();
static
void
zval_b64_encode
(
zval
*
out
,
char
*
in
);
...
...
skywalking.c
浏览文件 @
e3462199
...
...
@@ -518,6 +518,9 @@ static void generate_context() {
zval
*
carrier
=
NULL
;
ContextCarrier
*
contextCarrier
=
NULL
;
//http info
// zval *http_method = NULL;
zend_bool
jit_initialization
=
PG
(
auto_globals_jit
);
if
(
jit_initialization
)
{
...
...
@@ -526,6 +529,12 @@ static void generate_context() {
zend_string_release
(
server_str
);
}
carrier
=
zend_hash_str_find
(
&
EG
(
symbol_table
),
ZEND_STRL
(
"_SERVER"
));
// http_method = zend_hash_str_find(Z_ARRVAL_P(carrier), "REQUEST_METHOD", sizeof("REQUEST_METHOD") - 1);
// if (http_method != NULL) {
// add_assoc_string(&SKYWALKING_G(context), "method", Z_STRVAL_P(http_method));
// }
if
(
SKYWALKING_G
(
header_version
)
==
2
)
{
zval
*
sw6
;
sw6
=
zend_hash_str_find
(
Z_ARRVAL_P
(
carrier
),
"HTTP_SW6"
,
sizeof
(
"HTTP_SW6"
)
-
1
);
...
...
@@ -661,6 +670,35 @@ static char *get_page_request_uri() {
return
uris
;
}
static
char
*
get_page_request_peer
()
{
zval
*
carrier
=
NULL
;
zval
*
request_host
=
NULL
;
zval
*
request_port
=
NULL
;
char
*
peer
=
NULL
;
size_t
peer_l
=
0
;
zend_bool
jit_initialization
=
PG
(
auto_globals_jit
);
if
(
jit_initialization
)
{
zend_string
*
server_str
=
zend_string_init
(
"_SERVER"
,
sizeof
(
"_SERVER"
)
-
1
,
0
);
zend_is_auto_global
(
server_str
);
zend_string_release
(
server_str
);
}
carrier
=
zend_hash_str_find
(
&
EG
(
symbol_table
),
ZEND_STRL
(
"_SERVER"
));
request_host
=
zend_hash_str_find
(
Z_ARRVAL_P
(
carrier
),
"SERVER_ADDR"
,
sizeof
(
"SERVER_ADDR"
)
-
1
);
request_port
=
zend_hash_str_find
(
Z_ARRVAL_P
(
carrier
),
"SERVER_PORT"
,
sizeof
(
"SERVER_PORT"
)
-
1
);
if
(
request_host
!=
NULL
&&
request_port
!=
NULL
)
{
peer_l
=
snprintf
(
NULL
,
0
,
"%s:%s"
,
Z_STRVAL_P
(
request_host
),
Z_STRVAL_P
(
request_port
));
peer
=
emalloc
(
peer_l
+
1
);
snprintf
(
peer
,
peer_l
+
1
,
"%s:%s"
,
Z_STRVAL_P
(
request_host
),
Z_STRVAL_P
(
request_port
));
}
return
peer
;
}
/**
* ip
...
...
@@ -721,7 +759,10 @@ static void request_init() {
add_assoc_long
(
&
traceSegmentObject
,
"isSizeLimited"
,
0
);
zval
temp
;
char
*
peer
=
NULL
;
array_init
(
&
temp
);
peer
=
get_page_request_peer
();
add_assoc_long
(
&
temp
,
"spanId"
,
0
);
add_assoc_long
(
&
temp
,
"parentSpanId"
,
-
1
);
...
...
@@ -730,11 +771,21 @@ static void request_init() {
efree
(
l_millisecond
);
add_assoc_long
(
&
temp
,
"startTime"
,
millisecond
);
add_assoc_string
(
&
temp
,
"operationName"
,
get_page_request_uri
());
add_assoc_string
(
&
temp
,
"peer"
,
""
);
add_assoc_string
(
&
temp
,
"peer"
,
(
peer
==
NULL
)
?
""
:
peer
);
add_assoc_long
(
&
temp
,
"spanType"
,
0
);
add_assoc_long
(
&
temp
,
"spanLayer"
,
3
);
add_assoc_long
(
&
temp
,
"componentId"
,
COMPONENT_HTTPCLIENT
);
if
(
peer
!=
NULL
)
{
efree
(
peer
);
}
// zval *method = NULL;
// method = zend_hash_str_find(Z_ARRVAL(SKYWALKING_G(context)), "method", sizeof("method") - 1);
// if (method != NULL) {
// add_assoc_string(&temp, "method", Z_STRVAL_P(method));
// }
zval
*
isChild
=
zend_hash_str_find
(
Z_ARRVAL_P
(
&
SKYWALKING_G
(
context
)),
"isChild"
,
sizeof
(
"isChild"
)
-
1
);
// refs
zval
refs
;
...
...
src/report/report_client.cpp
浏览文件 @
e3462199
...
...
@@ -252,9 +252,6 @@ int main(int argc, char **argv) {
spanObject
->
set_endtime
(
spans
[
i
][
"endTime"
]);
spanObject
->
set_operationname
(
spans
[
i
][
"operationName"
]);
std
::
string
peer
(
spans
[
i
][
"peer"
].
get
<
std
::
string
>
());
if
(
!
peer
.
empty
())
{
spanObject
->
set_peer
(
peer
);
}
int
spanType
=
spans
[
i
][
"spanType"
].
get
<
int
>
();
if
(
spanType
==
0
)
{
...
...
@@ -265,6 +262,10 @@ int main(int argc, char **argv) {
spanObject
->
set_spantype
(
SpanType
::
Exit
);
}
if
(
spanType
==
1
&&
!
peer
.
empty
())
{
spanObject
->
set_peer
(
peer
);
}
int
spanLayer
=
spans
[
i
][
"spanLayer"
].
get
<
int
>
();
if
(
spanLayer
==
3
)
{
spanObject
->
set_spanlayer
(
SpanLayer
::
Http
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录