提交 9caed1ba 编写于 作者: H heyanlong 提交者: heyanlong

report

上级 b1c50d93
......@@ -98,6 +98,25 @@ if test "$PHP_SKYWALKING" != "no"; then
PHP_NEW_EXTENSION(skywalking, \
skywalking.c \
src/greeter_client.cc \
src/grpc/ApplicationRegisterService-grpc.pb.cc \
src/grpc/ApplicationRegisterService.pb.cc \
src/grpc/Common-grpc.pb.cc \
src/grpc/Common.pb.cc \
src/grpc/DiscoveryService-grpc.pb.cc \
src/grpc/DiscoveryService.pb.cc \
src/grpc/Downstream-grpc.pb.cc \
src/grpc/Downstream.pb.cc \
src/grpc/JVMMetricsService-grpc.pb.cc \
src/grpc/JVMMetricsService.pb.cc \
src/grpc/KeyWithIntegerValue-grpc.pb.cc \
src/grpc/KeyWithIntegerValue.pb.cc \
src/grpc/KeyWithStringValue-grpc.pb.cc \
src/grpc/KeyWithStringValue.pb.cc \
src/grpc/NetworkAddressRegisterService-grpc.pb.cc \
src/grpc/NetworkAddressRegisterService.pb.cc \
src/grpc/TraceSegmentService-grpc.pb.cc \
src/grpc/TraceSegmentService.pb.cc \
, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_BUILD_DIR($ext_builddir/src/grpc)
......
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: DiscoveryService.proto
#ifndef DISCOVERY_CLIENT_C_H
#define DISCOVERY_CLIENT_C_H
#define METHOD__GO_REGISTER 1
#define METHOD__GO_REGISTER_INSTANCE 2
#define METHOD__SEND_TRACE_SEGMENT 3
typedef struct _RegisterParamtruct
{
char* appCode;
}RegisterParamtruct;
typedef struct _RegisterInstanceParamtruct
{
char* agentUUID;
char* osName;;
char* hostname;
char* ipv4s;
int applicationId;
long registerTime;
int processNo;
}RegisterInstanceParamtruct;
typedef enum _SpanTypeStruct
{
Entry_x,
Exit_x,
Local_x
}SpanTypeStruct;
typedef enum _SpanLayerStruct
{
Unknown_x,
Database_x,
RPCFramework_x,
Http_x,
MQ_x,
Cache_x
}SpanLayerStruct;
typedef struct _KeyWithStringValueStruct
{
int key;
char *value;
}KeyWithStringValueStruct;
typedef struct _LogMessageStruct
{
long time;
KeyWithStringValueStruct* data;
}LogMessageStruct;
typedef enum _RefTypeStruct
{
CrossProcess_x,
CrossThread_x
}RefTypeStruct;
typedef struct _UniqueIdStruct
{
long idParts;
}UniqueIdStruct;
typedef struct _TraceSegmentReferenceStruct
{
RefTypeStruct* refType;
UniqueIdStruct* parentTraceSegmentId;
int parentSpanId;
int parentApplicationInstanceId;
int networkAddress;
int networkAddressId;
int entryApplicationInstanceId;
char* entryServiceName;
int entryServiceId;
char* parentServiceName;
int* parentServiceId;
}TraceSegmentReferenceStruct;
typedef struct _SpanObjectStruct
{
int spanId;
int parentSpanId;
long startTime;
long endTime;
TraceSegmentReferenceStruct* refs;
int operationNameId;
char *operationName;
int peerId;
char *peer;
SpanTypeStruct* spanType;
SpanLayerStruct* spanLayer;
int componentId;
int isError;
KeyWithStringValueStruct* tags;
LogMessageStruct* logs;
}SpanObjectStruct;
typedef struct _comListNode
{
UniqueIdStruct* data;
struct _comListNode* next;
} comListNode;
typedef struct _comList
{
struct _comListNode* head;
struct _comListNode* tail;
int count;
} comList;
typedef struct _TraceSegmentObjectStruct
{
comList* traceSegmentIdList;
SpanObjectStruct *spans;
char *segment;
int applicationId;
int applicationInstanceId;
int isSizeLimited;
}TraceSegmentObjectStruct;
typedef struct _SendTraceSegmentParamStruct
{
TraceSegmentObjectStruct* traceSegment;
}SendTraceSegmentParamStruct;
typedef union _ParamDataStruct
{
RegisterParamtruct* registerParam;
RegisterInstanceParamtruct* registerInstanceParam;
SendTraceSegmentParamStruct* sendTraceSegmentParam;
} ParamDataStruct;
typedef struct _UpstreamSegmentStruct
{
UniqueIdStruct* globalTraceIds;
char *segment;
}UpstreamSegmentStruct;
typedef struct AppInstanceStruct
{
int applicationId;
int applicationInstanceId;
} AppInstance;
#endif /* #ifndef DISCOVERY_CLIENT_C_H */
\ No newline at end of file
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <iostream>
#include <memory>
#include <string>
#include <grpc++/grpc++.h>
#include "ApplicationRegisterService.grpc.pb.h"
#include "DiscoveryService.grpc.pb.h"
#include "TraceSegmentService.grpc.pb.h"
#include "common_struct.h"
using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using grpc::ClientReader;
using grpc::ClientReaderWriter;
using grpc::ClientWriter;
extern "C" int goSkyGrpc(char*host, int method, ParamDataStruct* paramData, void (*callfuct)( AppInstance* ) );
class GreeterClient {
public:
GreeterClient(std::shared_ptr<Channel> channel) {
channel_ = channel;
}
// Assembles the client's payload, sends it and presents the response back
// from the server.
AppInstance* goRegister(const std::string& appCode) {
std::unique_ptr<ApplicationRegisterService::Stub> stub_;
stub_ = ApplicationRegisterService::NewStub(channel_) ;
// Data we are sending to the server.
Application request;
request.set_applicationcode( appCode );
// Container for the data we expect from the server.
ApplicationMapping reply;
// Context for the client. It could be used to convey extra information to
// the server and/or tweak certain RPC behaviors.
ClientContext context;
KeyWithIntegerValue kwiv;
// The actual RPC.
Status status = stub_->applicationCodeRegister(&context, request, &reply);
AppInstance* appInstance = (AppInstance*)malloc(sizeof(AppInstance));
// Act upon its status.
if (status.ok()) {
kwiv = reply.application();
appInstance->applicationId = kwiv.value();
return appInstance;
}
return NULL;
}
// Assembles the client's payload, sends it and presents the response back
// from the server.
AppInstance* goRegisterInstance(
std::string agentUUID,
std::string osName,
std::string hostname,
std::string ipv4s,
int applicationId,
long registerTime,
int processNo
) {
std::unique_ptr<InstanceDiscoveryService::Stub> stub_;
stub_ = InstanceDiscoveryService::NewStub(channel_);
// Data we are sending to the server.
ApplicationInstance request;
request.set_applicationid( applicationId );
request.set_agentuuid( agentUUID );
request.set_registertime( registerTime );
OSInfo* osinfo = new OSInfo;
request.set_allocated_osinfo( osinfo );
osinfo->set_osname( osName );
osinfo->set_hostname( hostname );
osinfo->set_processno( processNo );
osinfo->add_ipv4s( ipv4s );
AppInstance* appInstancestruct = (AppInstance*)malloc(sizeof(AppInstance));
// Container for the data we expect from the server.
ApplicationInstanceMapping reply;
// Context for the client. It could be used to convey extra information to
// the server and/or tweak certain RPC behaviors.
ClientContext context;
// The actual RPC.
Status status = stub_->registerInstance(&context, request, &reply);
//free OSInfo
//delete osinfo;
// Act upon its status.
if (status.ok()) {
appInstancestruct->applicationId = reply.applicationid();
appInstancestruct->applicationInstanceId = reply.applicationinstanceid();
return appInstancestruct;
}
return NULL;
}
void sendTrace( TraceSegmentObjectStruct* traceSegment ) {
std::unique_ptr<TraceSegmentService::Stub> stub_;
stub_ = TraceSegmentService::NewStub(channel_);
// Data we are sending to the server.
UpstreamSegment request ;
//UniqueId
UniqueId* uniqueId;
uniqueId = request.add_globaltraceids();
comListNode* com_list = traceSegment->traceSegmentIdList->head;
while(com_list != NULL)
{
uniqueId->add_idparts(com_list->data->idParts);
com_list = com_list->next;
}
if( traceSegment->segment ){
request.set_segment(traceSegment->segment);
Downstream reply;
ClientContext context;
grpc_connectivity_state state = channel_->GetState(false);
if( state == GRPC_CHANNEL_TRANSIENT_FAILURE ){
return ;
}
std::unique_ptr<ClientWriter<UpstreamSegment> > writer( stub_->collect(&context, &reply));
writer->Write(request);
writer->WritesDone();
writer->Finish();
}
}
private:
std::shared_ptr<Channel> channel_;
};
int goSkyGrpc(char *host, int method, ParamDataStruct* paramData, void (*callfuct)( AppInstance* ) ) {
std::shared_ptr<Channel> channel = grpc::CreateChannel(
host, grpc::InsecureChannelCredentials());
static GreeterClient greeter(channel);
switch (method) {
case METHOD__GO_REGISTER:
{
std::string appCode( paramData->registerParam->appCode);
callfuct(greeter.goRegister(appCode));
}
break;
case METHOD__GO_REGISTER_INSTANCE:
{
std::string agentUUID(paramData->registerInstanceParam->agentUUID);
std::string osName(paramData->registerInstanceParam->osName);
std::string hostname(paramData->registerInstanceParam->hostname);
std::string ipv4s(paramData->registerInstanceParam->ipv4s);
int applicationId = paramData->registerInstanceParam->applicationId;
long registerTime = paramData->registerInstanceParam->registerTime;
int processNo = paramData->registerInstanceParam->processNo;
callfuct(
greeter.goRegisterInstance(
agentUUID,
osName,
hostname,
ipv4s,
applicationId,
registerTime,
processNo
)
);
}
break;
case METHOD__SEND_TRACE_SEGMENT:
{
greeter.sendTrace( paramData->sendTraceSegmentParam->traceSegment );
}
break;
default:
return 0;
break;
}
return 1;
}
......@@ -111,83 +111,41 @@ extern zend_module_entry skywalking_module_entry;
void *SKY_ADD_ASSOC_ZVAL(zval *z, const char *k) {
zval null_array;
array_init(&null_array);
add_assoc_zval(z, k, &null_array);
zval null_array;
array_init(&null_array);
add_assoc_zval(z, k, &null_array);
return NULL;
}
void *SKY_UPDATE_PROPERTY(zend_class_entry *cls, zval *tp, const char *name, size_t name_length) {
zval null_array;
array_init(&null_array);
zend_update_property(cls, tp, name, name_length, &null_array);
}
static void *write_log_text(char *text);
static char *sky_json_encode(zval *parameter);
static char *build_SWheader_value(const char *peer_host);
static zval receive_SWHeader_from_caller();
static long get_second();
static char *get_millisecond();
static char *uniqid();
static char *generate_sw3(zend_long span_id, zend_string *peer_host, zend_string *operation_name);
static void make_trace_id();
static zend_always_inline zend_uchar is_sampling();
static char *generate_trace_id();
static char *get_ip();
static void generate_context();
static char *get_page_request_uri();
static char *get_page_url_and_peer();
static long generate_span_id();
static void *write_log( char *text);
static zval *set_span_nodes_data(zval *node_data);
static void write_log( char *text);
static void request_init();
static long sky_array_unshift(zval *stack, zval *var);
static void set_sampling_rate(double degrees);
static void set_span_param_of_curl(char *peer_host);
static void make_span_curl_header(char *peer_host, zval *headers);
static void start_span(zval *this_pr);
static int is_auto_open();
void accel_sky_curl_init(INTERNAL_FUNCTION_PARAMETERS);
void accel_sky_curl_setopt(INTERNAL_FUNCTION_PARAMETERS);
void sky_curl_exec_handler(INTERNAL_FUNCTION_PARAMETERS);
void list_poll(comList* myroot);
static void *sky_flush_all();
static void sky_flush_all();
static zval *get_first_span();
static zval *get_spans();
static char* _get_current_machine_ip();
static int get_app_instance_id();
static int get_app_id();
static char *generate_parent_info_from_header(char *header_name);
static void start_node_span_of_curl();
static char *generate_parent_trace_id();
static zval* generate_trace_id_for_array(int use_parent_tid, zval* z_trace_id);
static char* _entry_app_name();
static char *generate_distributed_trace_ids();
static int _entry_app_instance_id();
static void end_node_span_of_curl(zval *curl);
static void* send_grpc_param(zval *all_node_data);
static comList* create_com_list();
static long _entry_app_name_operation_id();
static long _parent_appname_operation_id();
static int sky_live_pthread(pthread_t tid);
static int add_com_list(comList *com_list, UniqueIdStruct* data);
static void (*orig_curl_init)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
static void (*orig_curl_setopt)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
static void (*orig_curl_exec)(INTERNAL_FUNCTION_PARAMETERS) = NULL;
/*
Declare any global variables you may need between the BEGIN
and END macros here:
*/
ZEND_BEGIN_MODULE_GLOBALS(skywalking)
char *global_log_path;
char *global_header_client_ip_name;
char *global_app_code;
long global_send_type;
zend_bool global_auto_open;
double global_sampling_rate;
char *global_app_grpc_trace;
zval UpstreamSegment;
zval context;
char *log_path;
char *app_code;
zend_bool enable;
char *grpc;
zval UpstreamSegment;
zval context;
ZEND_END_MODULE_GLOBALS(skywalking)
extern ZEND_DECLARE_MODULE_GLOBALS(skywalking);
......@@ -225,7 +183,6 @@ ZEND_TSRMLS_CACHE_EXTERN()
#ifdef _AIX
#define SKY_OS_NAME "AIX"
#endif
#else
......@@ -233,8 +190,12 @@ ZEND_TSRMLS_CACHE_EXTERN()
#ifdef WINVER
#define SKY_OS_NAME "Windows"
#else
#ifdef __APPLE__
#define SKY_OS_NAME "Darwin"
#else
#define SKY_OS_NAME "Unknown"
#endif
#endif
#endif
......
此差异已折叠。
<?php
$ch = curl_init("https://www.qingyidai.com/hahahaa/aaa");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
exit;
$file = new SplFileObject('appid.pid', "w");
$written = $file->fwrite("124124");
......
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <iostream>
#include <memory>
#include <string>
#include <grpc++/grpc++.h>
#include "grpc/ApplicationRegisterService.grpc.pb.h"
#include "grpc/DiscoveryService.grpc.pb.h"
#include "grpc/TraceSegmentService.grpc.pb.h"
using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using grpc::ClientReader;
using grpc::ClientReaderWriter;
using grpc::ClientWriter;
extern "C" int applicationCodeRegister(char *grpc_server, char *code);
extern "C" int
registerInstance(char *grpc_server, int appId, long registertime, char *uuid, char *osname, char *hostname,
int processno, char *ipv4s);
class GreeterClient {
public:
GreeterClient(std::shared_ptr <Channel> channel) {
channel_ = channel;
}
int applicationCodeRegister(const std::string &code) {
std::unique_ptr <ApplicationRegisterService::Stub> stub_;
stub_ = ApplicationRegisterService::NewStub(channel_);
Application request;
request.set_applicationcode(code);
ApplicationMapping reply;
ClientContext context;
Status status = stub_->applicationCodeRegister(&context, request, &reply);
if (status.ok()) {
return reply.application().value();
}
return -100000;
}
int registerInstance(int applicationid, int registertime, char *uuid, char *osname, char *hostname, int processno,
char *ipv4s) {
std::unique_ptr <InstanceDiscoveryService::Stub> stub_;
stub_ = InstanceDiscoveryService::NewStub(channel_);
ApplicationInstance request;
request.set_agentuuid(uuid);
request.set_applicationid(applicationid);
request.set_registertime(registertime);
OSInfo *osInfo = new OSInfo;
request.set_allocated_osinfo(osInfo);
osInfo->set_osname(osname);
osInfo->set_hostname(hostname);
osInfo->set_processno(processno);
osInfo->add_ipv4s(ipv4s);
ApplicationInstanceMapping reply;
ClientContext context;
Status status = stub_->registerInstance(&context, request, &reply);
if (status.ok()) {
return reply.applicationinstanceid();
}
return -1;
}
private:
std::shared_ptr <Channel> channel_;
};
int applicationCodeRegister(char *grpc_server, char *code) {
GreeterClient greeter(grpc::CreateChannel(grpc_server, grpc::InsecureChannelCredentials()));
std::string c(code);
//
return greeter.applicationCodeRegister(c);
}
int
registerInstance(char *grpc_server, int appId, long registertime, char *uuid, char *osname, char *hostname,
int processno, char *ipv4s) {
GreeterClient greeter(grpc::CreateChannel(grpc_server, grpc::InsecureChannelCredentials()));
return greeter.registerInstance(appId, registertime, uuid, osname, hostname, processno, ipv4s);
}
此差异已折叠。
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <sys/types.h>
#include <dirent.h>
#include <regex>
#include <chrono>
#include <cstdio>
#include <thread>
#include "json.hpp"
#include <grpcpp/grpcpp.h>
#include <google/protobuf/util/json_util.h>
#include "../grpc/ApplicationRegisterService.grpc.pb.h"
#include "../grpc/DiscoveryService.grpc.pb.h"
#include "../grpc/TraceSegmentService.grpc.pb.h"
using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using grpc::ClientWriter;
using json = nlohmann::json;
class GreeterClient {
public:
GreeterClient(std::shared_ptr<Channel> channel)
: stub_(TraceSegmentService::NewStub(channel)) {}
int collect(UpstreamSegment request) {
Downstream reply;
ClientContext context;
std::unique_ptr<ClientWriter<UpstreamSegment>> writer(stub_->collect(&context, &reply));
if (!writer->Write(request)) {
}
writer->WritesDone();
Status status = writer->Finish();
if (status.ok()) {
std::cout << "send ok!" << std::endl;
} else {
std::cout << "send error!" << status.error_message() << std::endl;
}
return 1;
}
private:
std::unique_ptr<TraceSegmentService::Stub> stub_;
};
int main(int argc, char **argv) {
for (int i = 0; i < argc; ++i) {
if (std::strncmp("-h", argv[i], sizeof(argv[i]) - 1) == 0 ||
std::strncmp("--help", argv[i], sizeof(argv[i]) - 1) == 0) {
std::cout << "report_client grpc log_path" << std::endl;
std::cout << "e.g. report_client 120.0.0.1:11800 /tmp" << std::endl;
return 0;
}
}
if (argc == 0) {
std::cout << "report_client grpc log_path" << std::endl;
std::cout << "e.g. report_client 120.0.0.1:11800 /tmp" << std::endl;
return 0;
}
GreeterClient greeter(grpc::CreateChannel(argv[1], grpc::InsecureChannelCredentials()));
while (1) {
struct dirent *dir;
DIR *dp;
if ((dp = opendir(argv[2])) == NULL) {
std::cerr << "open directory error";
return 0;
}
while ((dir = readdir(dp)) != NULL) {
if (strcmp(".", dir->d_name) == 0 || strcmp("..", dir->d_name) == 0) {
continue;
}
std::string fileName = std::string(argv[2]) + "/" + dir->d_name;
const std::regex pattern(std::string(argv[2]) + "/skywalking\\.(\\d+)\\.log");
if (std::regex_match(fileName, pattern)) {
std::match_results<std::string::const_iterator> result;
bool valid = std::regex_match(fileName, result, pattern);
if (valid) {
time_t t = time(NULL);
t = t - 65;
char ch[64] = {0};
strftime(ch, sizeof(ch) - 1, "%Y%m%d%H%M", localtime(&t));
unsigned long fileTime = std::stoul(result[1]);
unsigned long localTime = std::stoul(ch);
if (fileTime < localTime) {
std::ifstream file;
file.open(fileName, std::ios::in);
if (file.is_open()) {
std::cout << "send `" << fileName << "` to skywalking service" << std::endl;
std::string strLine;
while (std::getline(file, strLine))
{
if (strLine.empty()) {
continue;
}
json j = json::parse(strLine);
UpstreamSegment request;
std::smatch traceResult;
std::string tmp(j["segment"]["traceSegmentId"].get<std::string>());
bool valid = std::regex_match(tmp,
traceResult, std::regex("([\\-0-9]+)\\.(\\d+)\\.(\\d+)"));
if (valid) {
for (int i = 0; i < j["globalTraceIds"].size(); i++) {
std::cout << "send " << j["globalTraceIds"][i].get<std::string>() << " to skywalking service"
<< std::endl;
std::smatch globalTraceResult;
std::string tmp(j["globalTraceIds"][i].get<std::string>());
bool valid = std::regex_match(tmp, globalTraceResult, std::regex("(\\-?\\d+)\\.(\\d+)\\.(\\d+)"));
UniqueId *globalTrace = request.add_globaltraceids();
long long idp1 = std::stoll(globalTraceResult[1]);
long long idp2 = std::stoll(globalTraceResult[2]);
long long idp3 = std::stoll(globalTraceResult[3]);
globalTrace->add_idparts(idp1);
globalTrace->add_idparts(idp2);
globalTrace->add_idparts(idp3);
}
UniqueId *uniqueId = new UniqueId;
long long idp1 = std::stoll(traceResult[1]);
long long idp2 = std::stoll(traceResult[2]);
long long idp3 = std::stoll(traceResult[3]);
uniqueId->add_idparts(idp1);
uniqueId->add_idparts(idp2);
uniqueId->add_idparts(idp3);
TraceSegmentObject traceSegmentObject;
traceSegmentObject.set_allocated_tracesegmentid(uniqueId);
traceSegmentObject.set_applicationid(j["application_id"].get<int>());
traceSegmentObject.set_applicationinstanceid(j["application_instance"].get<int>());
traceSegmentObject.set_issizelimited(j["segment"]["isSizeLimited"].get<int>());
auto spans = j["segment"]["spans"];
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_starttime(spans[i]["startTime"]);
spanObject->set_endtime(spans[i]["endTime"]);
spanObject->set_operationname(spans[i]["operationName"]);
int spanType = spans[i]["spanType"].get<int>();
if (spanType == 0) {
spanObject->set_spantype(SpanType::Entry);
} else if (spanType == 2) {
spanObject->set_spantype(SpanType::Local);
} else if (spanType == 1) {
spanObject->set_spantype(SpanType::Exit);
}
int spanLayer = spans[i]["spanLayer"].get<int>();
if (spanLayer == 3) {
spanObject->set_spanlayer(SpanLayer::Http);
}
spanObject->set_componentid(spans[i]["componentId"]);
spanObject->set_iserror(spans[i]["isError"].get<int>());
}
std::string test;
traceSegmentObject.SerializeToString(&test);
request.set_segment(test);
greeter.collect(request);
}
}
remove(fileName.c_str());
}
}
}
}
}
closedir(dp);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
// std::string user("world");
// std::string reply = greeter.SayHello(user);
// std::cout << "Greeter received: " << reply << std::endl;
return 0;
}
\ No newline at end of file
//
// Created by Yanlong He on 2018/11/30.
//
#include "tools.h"
//
// Created by Yanlong He on 2018/11/30.
//
#ifndef SKYWALKING_TOOLS_H
#define SKYWALKING_TOOLS_H
#endif //SKYWALKING_TOOLS_H
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册