From c5fefa06808937b37406dbd698c01d9fa64b54a9 Mon Sep 17 00:00:00 2001 From: goerzh Date: Mon, 8 Apr 2019 15:47:48 +0800 Subject: [PATCH] fix function name --- skywalking.c | 14 +++++++------- src/greeter_client.cc | 27 ++++++++++++++++----------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/skywalking.c b/skywalking.c index 4b2629a..f9fc49a 100644 --- a/skywalking.c +++ b/skywalking.c @@ -53,10 +53,10 @@ #include "b64.h" -extern int applicationCodeRegister(char *grpc_server, char *code); +extern int serviceRegister(char *grpc_server, char *code); -extern int registerInstance(char *grpc_server, int appId, long registertime, char *osname, char *hostname, - int processno, char *ipv4s); +extern int serviceInstanceRegister(char *grpc_server, int appId, long registertime, char *osname, char *hostname, + int processno, char *ipv4s); /* If you declare any globals in php_skywalking.h uncomment this: */ @@ -819,7 +819,7 @@ static void module_init() { int i = 0; do { - application_id = applicationCodeRegister(SKYWALKING_G(grpc), SKYWALKING_G(app_code)); + application_id = serviceRegister(SKYWALKING_G(grpc), SKYWALKING_G(app_code)); if(application_id == -100000) { sleep(1); @@ -846,9 +846,9 @@ static void module_init() { i = 0; do { - application_instance = registerInstance(SKYWALKING_G(grpc), application_id, millisecond, SKY_OS_NAME, - hostname, getpid(), - ipv4s); + application_instance = serviceInstanceRegister(SKYWALKING_G(grpc), application_id, millisecond, SKY_OS_NAME, + hostname, getpid(), + ipv4s); if(application_instance == -100000) { sleep(1); } diff --git a/src/greeter_client.cc b/src/greeter_client.cc index ff47314..1343df5 100644 --- a/src/greeter_client.cc +++ b/src/greeter_client.cc @@ -35,11 +35,16 @@ using grpc::ClientReaderWriter; using grpc::ClientWriter; -extern "C" int applicationCodeRegister(char *grpc_server, char *service_name); +extern "C" int serviceRegister(char *grpc_server, char *service_name); extern "C" int -registerInstance(char *grpc_server, int appId, long registertime, char *osname, char *hostname, - int processno, char *ipv4s); +serviceInstanceRegister(char *grpc_server, int appId, long registertime, char *osname, char *hostname, + int processno, char *ipv4s); + +extern "C" void networkAddressRegister(); + +extern "C" void endpointRegister(); + static boost::uuids::uuid uuid = boost::uuids::random_generator()(); @@ -48,7 +53,7 @@ public: GreeterClient(std::shared_ptr channel) : stub_(Register::NewStub(channel)) {} - int applicationCodeRegister(const std::string &service_name) { + int serviceRegister(const std::string &service_name) { Services request; Service *s = request.add_services(); @@ -74,8 +79,8 @@ public: return -100000; } - int registerInstance(int applicationid, long registertime, char *osname, char *hostname, int processno, - char *ipv4s) { + int serviceInstanceRegister(int applicationid, long registertime, char *osname, char *hostname, int processno, + char *ipv4s) { ServiceInstances request; ServiceInstance *s = request.add_instances(); @@ -131,17 +136,17 @@ private: }; -int applicationCodeRegister(char *grpc_server, char *service_name) { +int serviceRegister(char *grpc_server, char *service_name) { GreeterClient greeter(grpc::CreateChannel(grpc_server, grpc::InsecureChannelCredentials())); std::string c(service_name); - return greeter.applicationCodeRegister(c); + return greeter.serviceRegister(c); } int -registerInstance(char *grpc_server, int appId, long registertime, char *osname, char *hostname, - int processno, char *ipv4s) { +serviceInstanceRegister(char *grpc_server, int appId, long registertime, char *osname, char *hostname, + int processno, char *ipv4s) { GreeterClient greeter(grpc::CreateChannel(grpc_server, grpc::InsecureChannelCredentials())); - return greeter.registerInstance(appId, registertime, osname, hostname, processno, ipv4s); + return greeter.serviceInstanceRegister(appId, registertime, osname, hostname, processno, ipv4s); } -- GitLab