提交 61d323d3 编写于 作者: G goerzh

write uuid to log

上级 c5fefa06
......@@ -68,6 +68,7 @@ static int application_instance = 0;
static int application_id = 0;
static int sky_close = 0;
static int sky_increment_id = 0;
char *uuid = NULL;
/* {{{ PHP_INI
*/
......@@ -706,6 +707,7 @@ static void request_init() {
add_assoc_long(&SKYWALKING_G(UpstreamSegment), "pid", getppid());
add_assoc_long(&SKYWALKING_G(UpstreamSegment), "application_id", application_id);
add_assoc_long(&SKYWALKING_G(UpstreamSegment), "version", SKYWALKING_G(version));
add_assoc_string(&SKYWALKING_G(UpstreamSegment), "uuid", uuid);
SKY_ADD_ASSOC_ZVAL(&SKYWALKING_G(UpstreamSegment), "segment");
SKY_ADD_ASSOC_ZVAL(&SKYWALKING_G(UpstreamSegment), "globalTraceIds");
......
......@@ -45,8 +45,8 @@ extern "C" void networkAddressRegister();
extern "C" void endpointRegister();
static boost::uuids::uuid uuid = boost::uuids::random_generator()();
extern char *uuid;
static boost::uuids::uuid boost_uuid = boost::uuids::random_generator()();
class GreeterClient {
public:
......@@ -84,9 +84,15 @@ public:
ServiceInstances request;
ServiceInstance *s = request.add_instances();
if (uuid == NULL) {
std::string uuid_str = boost::uuids::to_string(boost_uuid);
uuid = (char *) malloc(uuid_str.size() + 1);
bzero(uuid, uuid_str.size() + 1);
strncpy(uuid, uuid_str.c_str(), uuid_str.size() + 1);
}
s->set_serviceid(applicationid);
s->set_instanceuuid(boost::uuids::to_string(uuid));
s->set_instanceuuid(std::string(uuid));
s->set_time(registertime);
KeyStringValuePair *os = s->add_properties();
......@@ -120,8 +126,8 @@ public:
std::cout << "Register Instance:"<< std::endl;
std::cout << kv.key() << ": " << kv.value() << std::endl;
if (kv.key() == boost::uuids::to_string(uuid)) {
std::cout << "uuid" << ": " << boost::uuids::to_string(uuid) << std::endl;
if (kv.key() == uuid) {
std::cout << "uuid" << ": " << uuid << std::endl;
return kv.value();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册