diff --git a/sky-php7ext/skywalking.c b/sky-php7ext/skywalking.c index e23e3b5ad921b4abf157adb5e625ed2b734944cd..026c2ed4737a697799b184af24e2b6b934d5ecf5 100644 --- a/sky-php7ext/skywalking.c +++ b/sky-php7ext/skywalking.c @@ -455,7 +455,7 @@ 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(&sky_entry_span, "peer", "127.0.0.1"); + add_assoc_string(&temp, "peer", ""); add_assoc_long(&temp, "spanType", 0); add_assoc_long(&temp, "spanLayer", 3); add_assoc_long(&temp, "componentId", COMPONENT_HTTPCLIENT); @@ -517,6 +517,10 @@ static void module_init() { do { application_id = applicationCodeRegister(SKYWALKING_G(grpc), SKYWALKING_G(app_code)); + if(application_id == -100000) { + sleep(1); + } + i++; } while (application_id == -100000 && i <= 3); @@ -546,6 +550,9 @@ static void module_init() { application_instance = registerInstance(SKYWALKING_G(grpc), application_id, millisecond, uuid, SKY_OS_NAME, hostname, getpid(), ipv4s); + if(application_instance == -100000) { + sleep(1); + } i++; } while (application_instance == -100000 && i <= 3); diff --git a/sky-php7ext/src/report/report_client.cpp b/sky-php7ext/src/report/report_client.cpp index 3e63502154b6d79927044272e426d7607d5f7a84..c7cb54e4f7f0eb271c4e0fe8330117690edfb915 100644 --- a/sky-php7ext/src/report/report_client.cpp +++ b/sky-php7ext/src/report/report_client.cpp @@ -185,11 +185,15 @@ int main(int argc, char **argv) { for (int i = 0; i < spans.size(); i++) { SpanObject *spanObject = traceSegmentObject.add_spans(); - spanObject->set_spanid(spans[i]["spanId"]); - spanObject->set_parentspanid(spans[i]["parentSpanId"]); + spanObject->set_spanid(spans[i]["spanId"].get()); + spanObject->set_parentspanid(spans[i]["parentSpanId"].get()); spanObject->set_starttime(spans[i]["startTime"]); spanObject->set_endtime(spans[i]["endTime"]); spanObject->set_operationname(spans[i]["operationName"]); + std::string peer(spans[i]["peer"].get()); + if(!peer.empty()) { + spanObject->set_peer(peer); + } int spanType = spans[i]["spanType"].get(); if (spanType == 0) { @@ -205,7 +209,7 @@ int main(int argc, char **argv) { spanObject->set_spanlayer(SpanLayer::Http); } - spanObject->set_componentid(spans[i]["componentId"]); + spanObject->set_componentid(spans[i]["componentId"].get()); spanObject->set_iserror(spans[i]["isError"].get()); }