提交 ca664a36 编写于 作者: H heyanlong

add refs

上级 6b1e9eea
......@@ -306,7 +306,7 @@ static void generate_context() {
sprintf(makeTraceId, "%d.%d.%ld", application_instance, sys_pid, second);
add_assoc_string(&SKYWALKING_G(context), "currentTraceId", makeTraceId);
efree(makeTraceId);
// efree(makeTraceId);
add_assoc_long(&SKYWALKING_G(context), "isChild", 0);
// parent
......@@ -599,7 +599,7 @@ static void module_init() {
i++;
} while (application_instance == -100000 && i <= 3);
efree(ipv4s);
// efree(ipv4s);
if (application_instance == -100000) {
sky_close = 1;
......@@ -643,8 +643,8 @@ PHP_MSHUTDOWN_FUNCTION(skywalking)
if (sky_close == 1) {
return SUCCESS;
}
zval_dtor(&SKYWALKING_G(context));
zval_dtor(&SKYWALKING_G(UpstreamSegment));
// zval_dtor(&SKYWALKING_G(context));
// zval_dtor(&SKYWALKING_G(UpstreamSegment));
}
return SUCCESS;
......
......@@ -211,6 +211,33 @@ int main(int argc, char **argv) {
spanObject->set_componentid(spans[i]["componentId"].get<int>());
spanObject->set_iserror(spans[i]["isError"].get<int>());
// refs
auto refs = spans[i]["refs"];
for (int k = 0; k < refs.size(); k++) {
std::smatch traceResult;
std::string tmp(refs[k]["parentTraceSegmentId"].get<std::string>());
bool valid = std::regex_match(tmp,
traceResult, std::regex("([\\-0-9]+)\\.(\\d+)\\.(\\d+)"));
UniqueId *uniqueIdTmp = new UniqueId;
long long idp1 = std::stoll(traceResult[1]);
long long idp2 = std::stoll(traceResult[2]);
long long idp3 = std::stoll(traceResult[3]);
uniqueIdTmp->add_idparts(idp1);
uniqueIdTmp->add_idparts(idp2);
uniqueIdTmp->add_idparts(idp3);
TraceSegmentReference *r = spanObject->add_refs();
r->set_allocated_parenttracesegmentid(uniqueIdTmp);
r->set_parentspanid(refs[k]["parentSpanId"].get<int>());
r->set_parentapplicationinstanceid(refs[k]["parentApplicationInstanceId"].get<int>());
r->set_networkaddress(refs[k]["networkAddress"].get<std::string>());
r->set_entryapplicationinstanceid(refs[k]["entryApplicationInstanceId"].get<int>());
r->set_entryservicename(refs[k]["entryServiceName"].get<std::string>());
r->set_parentservicename(refs[k]["parentServiceName"].get<std::string>());
}
}
std::string test;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册