Add api QueryMetric.
This commit is contained in:
118
xtrace/CMakeLists.txt
Normal file
118
xtrace/CMakeLists.txt
Normal file
@@ -0,0 +1,118 @@
|
||||
#
|
||||
# Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
|
||||
set(xtrace_public_header
|
||||
include/alibabacloud/xtrace/XtraceClient.h
|
||||
include/alibabacloud/xtrace/XtraceExport.h )
|
||||
|
||||
set(xtrace_public_header_model
|
||||
include/alibabacloud/xtrace/model/GetTagKeyRequest.h
|
||||
include/alibabacloud/xtrace/model/GetTagKeyResult.h
|
||||
include/alibabacloud/xtrace/model/GetTagValRequest.h
|
||||
include/alibabacloud/xtrace/model/GetTagValResult.h
|
||||
include/alibabacloud/xtrace/model/GetTokenRequest.h
|
||||
include/alibabacloud/xtrace/model/GetTokenResult.h
|
||||
include/alibabacloud/xtrace/model/GetTraceRequest.h
|
||||
include/alibabacloud/xtrace/model/GetTraceResult.h
|
||||
include/alibabacloud/xtrace/model/ListIpOrHostsRequest.h
|
||||
include/alibabacloud/xtrace/model/ListIpOrHostsResult.h
|
||||
include/alibabacloud/xtrace/model/ListServicesRequest.h
|
||||
include/alibabacloud/xtrace/model/ListServicesResult.h
|
||||
include/alibabacloud/xtrace/model/ListSpanNamesRequest.h
|
||||
include/alibabacloud/xtrace/model/ListSpanNamesResult.h
|
||||
include/alibabacloud/xtrace/model/QueryMetricRequest.h
|
||||
include/alibabacloud/xtrace/model/QueryMetricResult.h
|
||||
include/alibabacloud/xtrace/model/SearchTracesRequest.h
|
||||
include/alibabacloud/xtrace/model/SearchTracesResult.h )
|
||||
|
||||
set(xtrace_src
|
||||
src/XtraceClient.cc
|
||||
src/model/GetTagKeyRequest.cc
|
||||
src/model/GetTagKeyResult.cc
|
||||
src/model/GetTagValRequest.cc
|
||||
src/model/GetTagValResult.cc
|
||||
src/model/GetTokenRequest.cc
|
||||
src/model/GetTokenResult.cc
|
||||
src/model/GetTraceRequest.cc
|
||||
src/model/GetTraceResult.cc
|
||||
src/model/ListIpOrHostsRequest.cc
|
||||
src/model/ListIpOrHostsResult.cc
|
||||
src/model/ListServicesRequest.cc
|
||||
src/model/ListServicesResult.cc
|
||||
src/model/ListSpanNamesRequest.cc
|
||||
src/model/ListSpanNamesResult.cc
|
||||
src/model/QueryMetricRequest.cc
|
||||
src/model/QueryMetricResult.cc
|
||||
src/model/SearchTracesRequest.cc
|
||||
src/model/SearchTracesResult.cc )
|
||||
|
||||
add_library(xtrace ${LIB_TYPE}
|
||||
${xtrace_public_header}
|
||||
${xtrace_public_header_model}
|
||||
${xtrace_src})
|
||||
|
||||
set_target_properties(xtrace
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}xtrace
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(xtrace
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_XTRACE_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(xtrace
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(xtrace
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(xtrace
|
||||
jsoncpp)
|
||||
target_include_directories(xtrace
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(xtrace
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(xtrace
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(xtrace
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(xtrace
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${xtrace_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/xtrace)
|
||||
install(FILES ${xtrace_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/xtrace/model)
|
||||
install(TARGETS xtrace
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
118
xtrace/include/alibabacloud/xtrace/XtraceClient.h
Normal file
118
xtrace/include/alibabacloud/xtrace/XtraceClient.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_XTRACE_XTRACECLIENT_H_
|
||||
#define ALIBABACLOUD_XTRACE_XTRACECLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "XtraceExport.h"
|
||||
#include "model/GetTagKeyRequest.h"
|
||||
#include "model/GetTagKeyResult.h"
|
||||
#include "model/GetTagValRequest.h"
|
||||
#include "model/GetTagValResult.h"
|
||||
#include "model/GetTokenRequest.h"
|
||||
#include "model/GetTokenResult.h"
|
||||
#include "model/GetTraceRequest.h"
|
||||
#include "model/GetTraceResult.h"
|
||||
#include "model/ListIpOrHostsRequest.h"
|
||||
#include "model/ListIpOrHostsResult.h"
|
||||
#include "model/ListServicesRequest.h"
|
||||
#include "model/ListServicesResult.h"
|
||||
#include "model/ListSpanNamesRequest.h"
|
||||
#include "model/ListSpanNamesResult.h"
|
||||
#include "model/QueryMetricRequest.h"
|
||||
#include "model/QueryMetricResult.h"
|
||||
#include "model/SearchTracesRequest.h"
|
||||
#include "model/SearchTracesResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Xtrace
|
||||
{
|
||||
class ALIBABACLOUD_XTRACE_EXPORT XtraceClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::GetTagKeyResult> GetTagKeyOutcome;
|
||||
typedef std::future<GetTagKeyOutcome> GetTagKeyOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::GetTagKeyRequest&, const GetTagKeyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTagKeyAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetTagValResult> GetTagValOutcome;
|
||||
typedef std::future<GetTagValOutcome> GetTagValOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::GetTagValRequest&, const GetTagValOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTagValAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetTokenResult> GetTokenOutcome;
|
||||
typedef std::future<GetTokenOutcome> GetTokenOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::GetTokenRequest&, const GetTokenOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTokenAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetTraceResult> GetTraceOutcome;
|
||||
typedef std::future<GetTraceOutcome> GetTraceOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::GetTraceRequest&, const GetTraceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTraceAsyncHandler;
|
||||
typedef Outcome<Error, Model::ListIpOrHostsResult> ListIpOrHostsOutcome;
|
||||
typedef std::future<ListIpOrHostsOutcome> ListIpOrHostsOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::ListIpOrHostsRequest&, const ListIpOrHostsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListIpOrHostsAsyncHandler;
|
||||
typedef Outcome<Error, Model::ListServicesResult> ListServicesOutcome;
|
||||
typedef std::future<ListServicesOutcome> ListServicesOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::ListServicesRequest&, const ListServicesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListServicesAsyncHandler;
|
||||
typedef Outcome<Error, Model::ListSpanNamesResult> ListSpanNamesOutcome;
|
||||
typedef std::future<ListSpanNamesOutcome> ListSpanNamesOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::ListSpanNamesRequest&, const ListSpanNamesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListSpanNamesAsyncHandler;
|
||||
typedef Outcome<Error, Model::QueryMetricResult> QueryMetricOutcome;
|
||||
typedef std::future<QueryMetricOutcome> QueryMetricOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::QueryMetricRequest&, const QueryMetricOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryMetricAsyncHandler;
|
||||
typedef Outcome<Error, Model::SearchTracesResult> SearchTracesOutcome;
|
||||
typedef std::future<SearchTracesOutcome> SearchTracesOutcomeCallable;
|
||||
typedef std::function<void(const XtraceClient*, const Model::SearchTracesRequest&, const SearchTracesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SearchTracesAsyncHandler;
|
||||
|
||||
XtraceClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
XtraceClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
XtraceClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~XtraceClient();
|
||||
GetTagKeyOutcome getTagKey(const Model::GetTagKeyRequest &request)const;
|
||||
void getTagKeyAsync(const Model::GetTagKeyRequest& request, const GetTagKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTagKeyOutcomeCallable getTagKeyCallable(const Model::GetTagKeyRequest& request) const;
|
||||
GetTagValOutcome getTagVal(const Model::GetTagValRequest &request)const;
|
||||
void getTagValAsync(const Model::GetTagValRequest& request, const GetTagValAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTagValOutcomeCallable getTagValCallable(const Model::GetTagValRequest& request) const;
|
||||
GetTokenOutcome getToken(const Model::GetTokenRequest &request)const;
|
||||
void getTokenAsync(const Model::GetTokenRequest& request, const GetTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTokenOutcomeCallable getTokenCallable(const Model::GetTokenRequest& request) const;
|
||||
GetTraceOutcome getTrace(const Model::GetTraceRequest &request)const;
|
||||
void getTraceAsync(const Model::GetTraceRequest& request, const GetTraceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTraceOutcomeCallable getTraceCallable(const Model::GetTraceRequest& request) const;
|
||||
ListIpOrHostsOutcome listIpOrHosts(const Model::ListIpOrHostsRequest &request)const;
|
||||
void listIpOrHostsAsync(const Model::ListIpOrHostsRequest& request, const ListIpOrHostsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ListIpOrHostsOutcomeCallable listIpOrHostsCallable(const Model::ListIpOrHostsRequest& request) const;
|
||||
ListServicesOutcome listServices(const Model::ListServicesRequest &request)const;
|
||||
void listServicesAsync(const Model::ListServicesRequest& request, const ListServicesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ListServicesOutcomeCallable listServicesCallable(const Model::ListServicesRequest& request) const;
|
||||
ListSpanNamesOutcome listSpanNames(const Model::ListSpanNamesRequest &request)const;
|
||||
void listSpanNamesAsync(const Model::ListSpanNamesRequest& request, const ListSpanNamesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ListSpanNamesOutcomeCallable listSpanNamesCallable(const Model::ListSpanNamesRequest& request) const;
|
||||
QueryMetricOutcome queryMetric(const Model::QueryMetricRequest &request)const;
|
||||
void queryMetricAsync(const Model::QueryMetricRequest& request, const QueryMetricAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
QueryMetricOutcomeCallable queryMetricCallable(const Model::QueryMetricRequest& request) const;
|
||||
SearchTracesOutcome searchTraces(const Model::SearchTracesRequest &request)const;
|
||||
void searchTracesAsync(const Model::SearchTracesRequest& request, const SearchTracesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
SearchTracesOutcomeCallable searchTracesCallable(const Model::SearchTracesRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_XTRACE_XTRACECLIENT_H_
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_XTRACE_MODEL_QUERYMETRICREQUEST_H_
|
||||
#define ALIBABACLOUD_XTRACE_MODEL_QUERYMETRICREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/xtrace/XtraceExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Xtrace
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_XTRACE_EXPORT QueryMetricRequest : public RpcServiceRequest
|
||||
{
|
||||
struct Filters
|
||||
{
|
||||
std::string value;
|
||||
std::string key;
|
||||
};
|
||||
|
||||
public:
|
||||
QueryMetricRequest();
|
||||
~QueryMetricRequest();
|
||||
|
||||
long getEndTime()const;
|
||||
void setEndTime(long endTime);
|
||||
std::string getOrderBy()const;
|
||||
void setOrderBy(const std::string& orderBy);
|
||||
long getStartTime()const;
|
||||
void setStartTime(long startTime);
|
||||
std::vector<Filters> getFilters()const;
|
||||
void setFilters(const std::vector<Filters>& filters);
|
||||
std::vector<std::string> getMeasures()const;
|
||||
void setMeasures(const std::vector<std::string>& measures);
|
||||
int getIntervalInSec()const;
|
||||
void setIntervalInSec(int intervalInSec);
|
||||
std::string getMetric()const;
|
||||
void setMetric(const std::string& metric);
|
||||
int getLimit()const;
|
||||
void setLimit(int limit);
|
||||
std::vector<std::string> getDimensions()const;
|
||||
void setDimensions(const std::vector<std::string>& dimensions);
|
||||
std::string getOrder()const;
|
||||
void setOrder(const std::string& order);
|
||||
|
||||
private:
|
||||
long endTime_;
|
||||
std::string orderBy_;
|
||||
long startTime_;
|
||||
std::vector<Filters> filters_;
|
||||
std::vector<std::string> measures_;
|
||||
int intervalInSec_;
|
||||
std::string metric_;
|
||||
int limit_;
|
||||
std::vector<std::string> dimensions_;
|
||||
std::string order_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_XTRACE_MODEL_QUERYMETRICREQUEST_H_
|
||||
51
xtrace/include/alibabacloud/xtrace/model/QueryMetricResult.h
Normal file
51
xtrace/include/alibabacloud/xtrace/model/QueryMetricResult.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_XTRACE_MODEL_QUERYMETRICRESULT_H_
|
||||
#define ALIBABACLOUD_XTRACE_MODEL_QUERYMETRICRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/xtrace/XtraceExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Xtrace
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_XTRACE_EXPORT QueryMetricResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
QueryMetricResult();
|
||||
explicit QueryMetricResult(const std::string &payload);
|
||||
~QueryMetricResult();
|
||||
std::string getData()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string data_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_XTRACE_MODEL_QUERYMETRICRESULT_H_
|
||||
@@ -40,44 +40,44 @@ namespace AlibabaCloud
|
||||
SearchTracesRequest();
|
||||
~SearchTracesRequest();
|
||||
|
||||
std::string getServiceIp()const;
|
||||
void setServiceIp(const std::string& serviceIp);
|
||||
std::string getRegionId()const;
|
||||
void setRegionId(const std::string& regionId);
|
||||
std::string getOperationName()const;
|
||||
void setOperationName(const std::string& operationName);
|
||||
std::string getAppType()const;
|
||||
void setAppType(const std::string& appType);
|
||||
int getPageSize()const;
|
||||
void setPageSize(int pageSize);
|
||||
long getEndTime()const;
|
||||
void setEndTime(long endTime);
|
||||
std::string getServiceName()const;
|
||||
void setServiceName(const std::string& serviceName);
|
||||
long getStartTime()const;
|
||||
void setStartTime(long startTime);
|
||||
std::vector<Tag> getTag()const;
|
||||
void setTag(const std::vector<Tag>& tag);
|
||||
bool getReverse()const;
|
||||
void setReverse(bool reverse);
|
||||
long getMinDuration()const;
|
||||
void setMinDuration(long minDuration);
|
||||
int getPageNumber()const;
|
||||
void setPageNumber(int pageNumber);
|
||||
std::string getServiceIp()const;
|
||||
void setServiceIp(const std::string& serviceIp);
|
||||
std::string getRegionId()const;
|
||||
void setRegionId(const std::string& regionId);
|
||||
std::string getOperationName()const;
|
||||
void setOperationName(const std::string& operationName);
|
||||
int getPageSize()const;
|
||||
void setPageSize(int pageSize);
|
||||
std::string getServiceName()const;
|
||||
void setServiceName(const std::string& serviceName);
|
||||
std::vector<Tag> getTag()const;
|
||||
void setTag(const std::vector<Tag>& tag);
|
||||
|
||||
private:
|
||||
std::string serviceIp_;
|
||||
std::string regionId_;
|
||||
std::string operationName_;
|
||||
std::string appType_;
|
||||
int pageSize_;
|
||||
long endTime_;
|
||||
std::string serviceName_;
|
||||
long startTime_;
|
||||
std::vector<Tag> tag_;
|
||||
bool reverse_;
|
||||
long minDuration_;
|
||||
int pageNumber_;
|
||||
std::string serviceIp_;
|
||||
std::string regionId_;
|
||||
std::string operationName_;
|
||||
int pageSize_;
|
||||
std::string serviceName_;
|
||||
std::vector<Tag> tag_;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
377
xtrace/src/XtraceClient.cc
Normal file
377
xtrace/src/XtraceClient.cc
Normal file
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* 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 <alibabacloud/xtrace/XtraceClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Xtrace;
|
||||
using namespace AlibabaCloud::Xtrace::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "xtrace";
|
||||
}
|
||||
|
||||
XtraceClient::XtraceClient(const Credentials &credentials, const ClientConfiguration &configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "xtrace");
|
||||
}
|
||||
|
||||
XtraceClient::XtraceClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "xtrace");
|
||||
}
|
||||
|
||||
XtraceClient::XtraceClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "xtrace");
|
||||
}
|
||||
|
||||
XtraceClient::~XtraceClient()
|
||||
{}
|
||||
|
||||
XtraceClient::GetTagKeyOutcome XtraceClient::getTagKey(const GetTagKeyRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetTagKeyOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetTagKeyOutcome(GetTagKeyResult(outcome.result()));
|
||||
else
|
||||
return GetTagKeyOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::getTagKeyAsync(const GetTagKeyRequest& request, const GetTagKeyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getTagKey(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::GetTagKeyOutcomeCallable XtraceClient::getTagKeyCallable(const GetTagKeyRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetTagKeyOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getTagKey(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::GetTagValOutcome XtraceClient::getTagVal(const GetTagValRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetTagValOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetTagValOutcome(GetTagValResult(outcome.result()));
|
||||
else
|
||||
return GetTagValOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::getTagValAsync(const GetTagValRequest& request, const GetTagValAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getTagVal(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::GetTagValOutcomeCallable XtraceClient::getTagValCallable(const GetTagValRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetTagValOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getTagVal(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::GetTokenOutcome XtraceClient::getToken(const GetTokenRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetTokenOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetTokenOutcome(GetTokenResult(outcome.result()));
|
||||
else
|
||||
return GetTokenOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::getTokenAsync(const GetTokenRequest& request, const GetTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getToken(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::GetTokenOutcomeCallable XtraceClient::getTokenCallable(const GetTokenRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetTokenOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getToken(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::GetTraceOutcome XtraceClient::getTrace(const GetTraceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetTraceOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetTraceOutcome(GetTraceResult(outcome.result()));
|
||||
else
|
||||
return GetTraceOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::getTraceAsync(const GetTraceRequest& request, const GetTraceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getTrace(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::GetTraceOutcomeCallable XtraceClient::getTraceCallable(const GetTraceRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetTraceOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getTrace(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::ListIpOrHostsOutcome XtraceClient::listIpOrHosts(const ListIpOrHostsRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListIpOrHostsOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListIpOrHostsOutcome(ListIpOrHostsResult(outcome.result()));
|
||||
else
|
||||
return ListIpOrHostsOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::listIpOrHostsAsync(const ListIpOrHostsRequest& request, const ListIpOrHostsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listIpOrHosts(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::ListIpOrHostsOutcomeCallable XtraceClient::listIpOrHostsCallable(const ListIpOrHostsRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListIpOrHostsOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listIpOrHosts(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::ListServicesOutcome XtraceClient::listServices(const ListServicesRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListServicesOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListServicesOutcome(ListServicesResult(outcome.result()));
|
||||
else
|
||||
return ListServicesOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::listServicesAsync(const ListServicesRequest& request, const ListServicesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listServices(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::ListServicesOutcomeCallable XtraceClient::listServicesCallable(const ListServicesRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListServicesOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listServices(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::ListSpanNamesOutcome XtraceClient::listSpanNames(const ListSpanNamesRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListSpanNamesOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListSpanNamesOutcome(ListSpanNamesResult(outcome.result()));
|
||||
else
|
||||
return ListSpanNamesOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::listSpanNamesAsync(const ListSpanNamesRequest& request, const ListSpanNamesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listSpanNames(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::ListSpanNamesOutcomeCallable XtraceClient::listSpanNamesCallable(const ListSpanNamesRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListSpanNamesOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listSpanNames(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::QueryMetricOutcome XtraceClient::queryMetric(const QueryMetricRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return QueryMetricOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return QueryMetricOutcome(QueryMetricResult(outcome.result()));
|
||||
else
|
||||
return QueryMetricOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::queryMetricAsync(const QueryMetricRequest& request, const QueryMetricAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, queryMetric(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::QueryMetricOutcomeCallable XtraceClient::queryMetricCallable(const QueryMetricRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<QueryMetricOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->queryMetric(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
XtraceClient::SearchTracesOutcome XtraceClient::searchTraces(const SearchTracesRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return SearchTracesOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return SearchTracesOutcome(SearchTracesResult(outcome.result()));
|
||||
else
|
||||
return SearchTracesOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void XtraceClient::searchTracesAsync(const SearchTracesRequest& request, const SearchTracesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, searchTraces(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
XtraceClient::SearchTracesOutcomeCallable XtraceClient::searchTracesCallable(const SearchTracesRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<SearchTracesOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->searchTraces(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::GetTagKeyRequest;
|
||||
|
||||
GetTagKeyRequest::GetTagKeyRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "GetTagKey")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetTagKeyRequest::~GetTagKeyRequest()
|
||||
{}
|
||||
|
||||
@@ -35,13 +35,9 @@ GetTagKeyResult::~GetTagKeyResult()
|
||||
|
||||
void GetTagKeyResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allTagKeys = value["TagKeys"]["TagKey"];
|
||||
for (const auto &item : allTagKeys)
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::GetTagValRequest;
|
||||
|
||||
GetTagValRequest::GetTagValRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "GetTagVal")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetTagValRequest::~GetTagValRequest()
|
||||
{}
|
||||
|
||||
@@ -35,13 +35,9 @@ GetTagValResult::~GetTagValResult()
|
||||
|
||||
void GetTagValResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allTagValues = value["TagValues"]["TagValue"];
|
||||
for (const auto &item : allTagValues)
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::GetTokenRequest;
|
||||
|
||||
GetTokenRequest::GetTokenRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "GetToken")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetTokenRequest::~GetTokenRequest()
|
||||
{}
|
||||
|
||||
@@ -35,13 +35,9 @@ GetTokenResult::~GetTokenResult()
|
||||
|
||||
void GetTokenResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto tokenNode = value["Token"];
|
||||
if(!tokenNode["Domain"].isNull())
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::GetTraceRequest;
|
||||
|
||||
GetTraceRequest::GetTraceRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "GetTrace")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetTraceRequest::~GetTraceRequest()
|
||||
{}
|
||||
|
||||
@@ -35,60 +35,56 @@ GetTraceResult::~GetTraceResult()
|
||||
|
||||
void GetTraceResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allSpans = value["Spans"]["Span"];
|
||||
for (auto value : allSpans)
|
||||
auto allSpansNode = value["Spans"]["Span"];
|
||||
for (auto valueSpansSpan : allSpansNode)
|
||||
{
|
||||
Span spansObject;
|
||||
if(!value["TraceID"].isNull())
|
||||
spansObject.traceID = value["TraceID"].asString();
|
||||
if(!value["OperationName"].isNull())
|
||||
spansObject.operationName = value["OperationName"].asString();
|
||||
if(!value["Duration"].isNull())
|
||||
spansObject.duration = std::stol(value["Duration"].asString());
|
||||
if(!value["ServiceName"].isNull())
|
||||
spansObject.serviceName = value["ServiceName"].asString();
|
||||
if(!value["ServiceIp"].isNull())
|
||||
spansObject.serviceIp = value["ServiceIp"].asString();
|
||||
if(!value["Timestamp"].isNull())
|
||||
spansObject.timestamp = std::stol(value["Timestamp"].asString());
|
||||
if(!value["RpcId"].isNull())
|
||||
spansObject.rpcId = value["RpcId"].asString();
|
||||
if(!value["ResultCode"].isNull())
|
||||
spansObject.resultCode = value["ResultCode"].asString();
|
||||
if(!value["HaveStack"].isNull())
|
||||
spansObject.haveStack = value["HaveStack"].asString() == "true";
|
||||
auto allTagEntryList = value["TagEntryList"]["TagEntry"];
|
||||
for (auto value : allTagEntryList)
|
||||
if(!valueSpansSpan["TraceID"].isNull())
|
||||
spansObject.traceID = valueSpansSpan["TraceID"].asString();
|
||||
if(!valueSpansSpan["OperationName"].isNull())
|
||||
spansObject.operationName = valueSpansSpan["OperationName"].asString();
|
||||
if(!valueSpansSpan["Duration"].isNull())
|
||||
spansObject.duration = std::stol(valueSpansSpan["Duration"].asString());
|
||||
if(!valueSpansSpan["ServiceName"].isNull())
|
||||
spansObject.serviceName = valueSpansSpan["ServiceName"].asString();
|
||||
if(!valueSpansSpan["ServiceIp"].isNull())
|
||||
spansObject.serviceIp = valueSpansSpan["ServiceIp"].asString();
|
||||
if(!valueSpansSpan["Timestamp"].isNull())
|
||||
spansObject.timestamp = std::stol(valueSpansSpan["Timestamp"].asString());
|
||||
if(!valueSpansSpan["RpcId"].isNull())
|
||||
spansObject.rpcId = valueSpansSpan["RpcId"].asString();
|
||||
if(!valueSpansSpan["ResultCode"].isNull())
|
||||
spansObject.resultCode = valueSpansSpan["ResultCode"].asString();
|
||||
if(!valueSpansSpan["HaveStack"].isNull())
|
||||
spansObject.haveStack = valueSpansSpan["HaveStack"].asString() == "true";
|
||||
auto allTagEntryListNode = allSpansNode["TagEntryList"]["TagEntry"];
|
||||
for (auto allSpansNodeTagEntryListTagEntry : allTagEntryListNode)
|
||||
{
|
||||
Span::TagEntry tagEntryListObject;
|
||||
if(!value["Key"].isNull())
|
||||
tagEntryListObject.key = value["Key"].asString();
|
||||
if(!value["Value"].isNull())
|
||||
tagEntryListObject.value = value["Value"].asString();
|
||||
if(!allSpansNodeTagEntryListTagEntry["Key"].isNull())
|
||||
tagEntryListObject.key = allSpansNodeTagEntryListTagEntry["Key"].asString();
|
||||
if(!allSpansNodeTagEntryListTagEntry["Value"].isNull())
|
||||
tagEntryListObject.value = allSpansNodeTagEntryListTagEntry["Value"].asString();
|
||||
spansObject.tagEntryList.push_back(tagEntryListObject);
|
||||
}
|
||||
auto allLogEventList = value["LogEventList"]["LogEvent"];
|
||||
for (auto value : allLogEventList)
|
||||
auto allLogEventListNode = allSpansNode["LogEventList"]["LogEvent"];
|
||||
for (auto allSpansNodeLogEventListLogEvent : allLogEventListNode)
|
||||
{
|
||||
Span::LogEvent logEventListObject;
|
||||
if(!value["Timestamp"].isNull())
|
||||
logEventListObject.timestamp = std::stol(value["Timestamp"].asString());
|
||||
auto allTagEntryList1 = value["TagEntryList"]["TagEntry"];
|
||||
for (auto value : allTagEntryList1)
|
||||
if(!allSpansNodeLogEventListLogEvent["Timestamp"].isNull())
|
||||
logEventListObject.timestamp = std::stol(allSpansNodeLogEventListLogEvent["Timestamp"].asString());
|
||||
auto allTagEntryList1Node = allLogEventListNode["TagEntryList"]["TagEntry"];
|
||||
for (auto allLogEventListNodeTagEntryListTagEntry : allTagEntryList1Node)
|
||||
{
|
||||
Span::LogEvent::TagEntry2 tagEntryList1Object;
|
||||
if(!value["Key"].isNull())
|
||||
tagEntryList1Object.key = value["Key"].asString();
|
||||
if(!value["Value"].isNull())
|
||||
tagEntryList1Object.value = value["Value"].asString();
|
||||
if(!allLogEventListNodeTagEntryListTagEntry["Key"].isNull())
|
||||
tagEntryList1Object.key = allLogEventListNodeTagEntryListTagEntry["Key"].asString();
|
||||
if(!allLogEventListNodeTagEntryListTagEntry["Value"].isNull())
|
||||
tagEntryList1Object.value = allLogEventListNodeTagEntryListTagEntry["Value"].asString();
|
||||
logEventListObject.tagEntryList1.push_back(tagEntryList1Object);
|
||||
}
|
||||
spansObject.logEventList.push_back(logEventListObject);
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::ListIpOrHostsRequest;
|
||||
|
||||
ListIpOrHostsRequest::ListIpOrHostsRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "ListIpOrHosts")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ListIpOrHostsRequest::~ListIpOrHostsRequest()
|
||||
{}
|
||||
|
||||
@@ -35,13 +35,9 @@ ListIpOrHostsResult::~ListIpOrHostsResult()
|
||||
|
||||
void ListIpOrHostsResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allIpNames = value["IpNames"]["IpName"];
|
||||
for (const auto &item : allIpNames)
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::ListServicesRequest;
|
||||
|
||||
ListServicesRequest::ListServicesRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "ListServices")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ListServicesRequest::~ListServicesRequest()
|
||||
{}
|
||||
|
||||
@@ -35,24 +35,20 @@ ListServicesResult::~ListServicesResult()
|
||||
|
||||
void ListServicesResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allServices = value["Services"]["Service"];
|
||||
for (auto value : allServices)
|
||||
auto allServicesNode = value["Services"]["Service"];
|
||||
for (auto valueServicesService : allServicesNode)
|
||||
{
|
||||
Service servicesObject;
|
||||
if(!value["ServiceName"].isNull())
|
||||
servicesObject.serviceName = value["ServiceName"].asString();
|
||||
if(!value["Pid"].isNull())
|
||||
servicesObject.pid = value["Pid"].asString();
|
||||
if(!value["RegionId"].isNull())
|
||||
servicesObject.regionId = value["RegionId"].asString();
|
||||
if(!valueServicesService["ServiceName"].isNull())
|
||||
servicesObject.serviceName = valueServicesService["ServiceName"].asString();
|
||||
if(!valueServicesService["Pid"].isNull())
|
||||
servicesObject.pid = valueServicesService["Pid"].asString();
|
||||
if(!valueServicesService["RegionId"].isNull())
|
||||
servicesObject.regionId = valueServicesService["RegionId"].asString();
|
||||
services_.push_back(servicesObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ using AlibabaCloud::Xtrace::Model::ListSpanNamesRequest;
|
||||
|
||||
ListSpanNamesRequest::ListSpanNamesRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "ListSpanNames")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ListSpanNamesRequest::~ListSpanNamesRequest()
|
||||
{}
|
||||
|
||||
@@ -35,13 +35,9 @@ ListSpanNamesResult::~ListSpanNamesResult()
|
||||
|
||||
void ListSpanNamesResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allSpanNames = value["SpanNames"]["SpanName"];
|
||||
for (const auto &item : allSpanNames)
|
||||
|
||||
148
xtrace/src/model/QueryMetricRequest.cc
Normal file
148
xtrace/src/model/QueryMetricRequest.cc
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* 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 <alibabacloud/xtrace/model/QueryMetricRequest.h>
|
||||
|
||||
using AlibabaCloud::Xtrace::Model::QueryMetricRequest;
|
||||
|
||||
QueryMetricRequest::QueryMetricRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "QueryMetric")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
QueryMetricRequest::~QueryMetricRequest()
|
||||
{}
|
||||
|
||||
long QueryMetricRequest::getEndTime()const
|
||||
{
|
||||
return endTime_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setEndTime(long endTime)
|
||||
{
|
||||
endTime_ = endTime;
|
||||
setCoreParameter("EndTime", std::to_string(endTime));
|
||||
}
|
||||
|
||||
std::string QueryMetricRequest::getOrderBy()const
|
||||
{
|
||||
return orderBy_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setOrderBy(const std::string& orderBy)
|
||||
{
|
||||
orderBy_ = orderBy;
|
||||
setCoreParameter("OrderBy", orderBy);
|
||||
}
|
||||
|
||||
long QueryMetricRequest::getStartTime()const
|
||||
{
|
||||
return startTime_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setStartTime(long startTime)
|
||||
{
|
||||
startTime_ = startTime;
|
||||
setCoreParameter("StartTime", std::to_string(startTime));
|
||||
}
|
||||
|
||||
std::vector<QueryMetricRequest::Filters> QueryMetricRequest::getFilters()const
|
||||
{
|
||||
return filters_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setFilters(const std::vector<Filters>& filters)
|
||||
{
|
||||
filters_ = filters;
|
||||
for(int dep1 = 0; dep1!= filters.size(); dep1++) {
|
||||
auto filtersObj = filters.at(dep1);
|
||||
std::string filtersObjStr = "Filters." + std::to_string(dep1);
|
||||
setCoreParameter(filtersObjStr + ".Value", filtersObj.value);
|
||||
setCoreParameter(filtersObjStr + ".Key", filtersObj.key);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> QueryMetricRequest::getMeasures()const
|
||||
{
|
||||
return measures_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setMeasures(const std::vector<std::string>& measures)
|
||||
{
|
||||
measures_ = measures;
|
||||
for(int dep1 = 0; dep1!= measures.size(); dep1++) {
|
||||
setCoreParameter("Measures."+ std::to_string(dep1), measures.at(dep1));
|
||||
}
|
||||
}
|
||||
|
||||
int QueryMetricRequest::getIntervalInSec()const
|
||||
{
|
||||
return intervalInSec_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setIntervalInSec(int intervalInSec)
|
||||
{
|
||||
intervalInSec_ = intervalInSec;
|
||||
setCoreParameter("IntervalInSec", std::to_string(intervalInSec));
|
||||
}
|
||||
|
||||
std::string QueryMetricRequest::getMetric()const
|
||||
{
|
||||
return metric_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setMetric(const std::string& metric)
|
||||
{
|
||||
metric_ = metric;
|
||||
setCoreParameter("Metric", metric);
|
||||
}
|
||||
|
||||
int QueryMetricRequest::getLimit()const
|
||||
{
|
||||
return limit_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setLimit(int limit)
|
||||
{
|
||||
limit_ = limit;
|
||||
setCoreParameter("Limit", std::to_string(limit));
|
||||
}
|
||||
|
||||
std::vector<std::string> QueryMetricRequest::getDimensions()const
|
||||
{
|
||||
return dimensions_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setDimensions(const std::vector<std::string>& dimensions)
|
||||
{
|
||||
dimensions_ = dimensions;
|
||||
for(int dep1 = 0; dep1!= dimensions.size(); dep1++) {
|
||||
setCoreParameter("Dimensions."+ std::to_string(dep1), dimensions.at(dep1));
|
||||
}
|
||||
}
|
||||
|
||||
std::string QueryMetricRequest::getOrder()const
|
||||
{
|
||||
return order_;
|
||||
}
|
||||
|
||||
void QueryMetricRequest::setOrder(const std::string& order)
|
||||
{
|
||||
order_ = order;
|
||||
setCoreParameter("Order", order);
|
||||
}
|
||||
|
||||
51
xtrace/src/model/QueryMetricResult.cc
Normal file
51
xtrace/src/model/QueryMetricResult.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* 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 <alibabacloud/xtrace/model/QueryMetricResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Xtrace;
|
||||
using namespace AlibabaCloud::Xtrace::Model;
|
||||
|
||||
QueryMetricResult::QueryMetricResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
QueryMetricResult::QueryMetricResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
QueryMetricResult::~QueryMetricResult()
|
||||
{}
|
||||
|
||||
void QueryMetricResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["Data"].isNull())
|
||||
data_ = value["Data"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string QueryMetricResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
@@ -20,44 +20,13 @@ using AlibabaCloud::Xtrace::Model::SearchTracesRequest;
|
||||
|
||||
SearchTracesRequest::SearchTracesRequest() :
|
||||
RpcServiceRequest("xtrace", "2019-08-08", "SearchTraces")
|
||||
{}
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
SearchTracesRequest::~SearchTracesRequest()
|
||||
{}
|
||||
|
||||
std::string SearchTracesRequest::getServiceIp()const
|
||||
{
|
||||
return serviceIp_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setServiceIp(const std::string& serviceIp)
|
||||
{
|
||||
serviceIp_ = serviceIp;
|
||||
setCoreParameter("ServiceIp", serviceIp);
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getRegionId()const
|
||||
{
|
||||
return regionId_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setRegionId(const std::string& regionId)
|
||||
{
|
||||
regionId_ = regionId;
|
||||
setCoreParameter("RegionId", regionId);
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getOperationName()const
|
||||
{
|
||||
return operationName_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setOperationName(const std::string& operationName)
|
||||
{
|
||||
operationName_ = operationName;
|
||||
setCoreParameter("OperationName", operationName);
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getAppType()const
|
||||
{
|
||||
return appType_;
|
||||
@@ -69,17 +38,6 @@ void SearchTracesRequest::setAppType(const std::string& appType)
|
||||
setCoreParameter("AppType", appType);
|
||||
}
|
||||
|
||||
int SearchTracesRequest::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setPageSize(int pageSize)
|
||||
{
|
||||
pageSize_ = pageSize;
|
||||
setCoreParameter("PageSize", std::to_string(pageSize));
|
||||
}
|
||||
|
||||
long SearchTracesRequest::getEndTime()const
|
||||
{
|
||||
return endTime_;
|
||||
@@ -91,17 +49,6 @@ void SearchTracesRequest::setEndTime(long endTime)
|
||||
setCoreParameter("EndTime", std::to_string(endTime));
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getServiceName()const
|
||||
{
|
||||
return serviceName_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setServiceName(const std::string& serviceName)
|
||||
{
|
||||
serviceName_ = serviceName;
|
||||
setCoreParameter("ServiceName", serviceName);
|
||||
}
|
||||
|
||||
long SearchTracesRequest::getStartTime()const
|
||||
{
|
||||
return startTime_;
|
||||
@@ -113,23 +60,6 @@ void SearchTracesRequest::setStartTime(long startTime)
|
||||
setCoreParameter("StartTime", std::to_string(startTime));
|
||||
}
|
||||
|
||||
std::vector<SearchTracesRequest::Tag> SearchTracesRequest::getTag()const
|
||||
{
|
||||
return tag_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setTag(const std::vector<Tag>& tag)
|
||||
{
|
||||
tag_ = tag;
|
||||
int i = 0;
|
||||
for(int i = 0; i!= tag.size(); i++) {
|
||||
auto obj = tag.at(i);
|
||||
std::string str ="Tag."+ std::to_string(i);
|
||||
setCoreParameter(str + ".Value", obj.value);
|
||||
setCoreParameter(str + ".Key", obj.key);
|
||||
}
|
||||
}
|
||||
|
||||
bool SearchTracesRequest::getReverse()const
|
||||
{
|
||||
return reverse_;
|
||||
@@ -163,3 +93,74 @@ void SearchTracesRequest::setPageNumber(int pageNumber)
|
||||
setCoreParameter("PageNumber", std::to_string(pageNumber));
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getServiceIp()const
|
||||
{
|
||||
return serviceIp_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setServiceIp(const std::string& serviceIp)
|
||||
{
|
||||
serviceIp_ = serviceIp;
|
||||
setCoreParameter("ServiceIp", serviceIp);
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getRegionId()const
|
||||
{
|
||||
return regionId_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setRegionId(const std::string& regionId)
|
||||
{
|
||||
regionId_ = regionId;
|
||||
setCoreParameter("RegionId", regionId);
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getOperationName()const
|
||||
{
|
||||
return operationName_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setOperationName(const std::string& operationName)
|
||||
{
|
||||
operationName_ = operationName;
|
||||
setCoreParameter("OperationName", operationName);
|
||||
}
|
||||
|
||||
int SearchTracesRequest::getPageSize()const
|
||||
{
|
||||
return pageSize_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setPageSize(int pageSize)
|
||||
{
|
||||
pageSize_ = pageSize;
|
||||
setCoreParameter("PageSize", std::to_string(pageSize));
|
||||
}
|
||||
|
||||
std::string SearchTracesRequest::getServiceName()const
|
||||
{
|
||||
return serviceName_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setServiceName(const std::string& serviceName)
|
||||
{
|
||||
serviceName_ = serviceName;
|
||||
setCoreParameter("ServiceName", serviceName);
|
||||
}
|
||||
|
||||
std::vector<SearchTracesRequest::Tag> SearchTracesRequest::getTag()const
|
||||
{
|
||||
return tag_;
|
||||
}
|
||||
|
||||
void SearchTracesRequest::setTag(const std::vector<Tag>& tag)
|
||||
{
|
||||
tag_ = tag;
|
||||
for(int dep1 = 0; dep1!= tag.size(); dep1++) {
|
||||
auto tagObj = tag.at(dep1);
|
||||
std::string tagObjStr = "Tag." + std::to_string(dep1);
|
||||
setCoreParameter(tagObjStr + ".Value", tagObj.value);
|
||||
setCoreParameter(tagObjStr + ".Key", tagObj.key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,9 @@ SearchTracesResult::~SearchTracesResult()
|
||||
|
||||
void SearchTracesResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
Json::CharReader *reader = builder.newCharReader();
|
||||
Json::Value *val;
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
JSONCPP_STRING *errs;
|
||||
reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
|
||||
value = *val;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto pageBeanNode = value["PageBean"];
|
||||
if(!pageBeanNode["TotalCount"].isNull())
|
||||
@@ -50,22 +46,22 @@ void SearchTracesResult::parse(const std::string &payload)
|
||||
pageBean_.pageSize = std::stoi(pageBeanNode["PageSize"].asString());
|
||||
if(!pageBeanNode["PageNumber"].isNull())
|
||||
pageBean_.pageNumber = std::stoi(pageBeanNode["PageNumber"].asString());
|
||||
auto allTraceInfos = value["TraceInfos"]["TraceInfo"];
|
||||
for (auto value : allTraceInfos)
|
||||
auto allTraceInfosNode = pageBeanNode["TraceInfos"]["TraceInfo"];
|
||||
for (auto pageBeanNodeTraceInfosTraceInfo : allTraceInfosNode)
|
||||
{
|
||||
PageBean::TraceInfo traceInfoObject;
|
||||
if(!value["TraceID"].isNull())
|
||||
traceInfoObject.traceID = value["TraceID"].asString();
|
||||
if(!value["OperationName"].isNull())
|
||||
traceInfoObject.operationName = value["OperationName"].asString();
|
||||
if(!value["ServiceName"].isNull())
|
||||
traceInfoObject.serviceName = value["ServiceName"].asString();
|
||||
if(!value["ServiceIp"].isNull())
|
||||
traceInfoObject.serviceIp = value["ServiceIp"].asString();
|
||||
if(!value["Duration"].isNull())
|
||||
traceInfoObject.duration = std::stol(value["Duration"].asString());
|
||||
if(!value["Timestamp"].isNull())
|
||||
traceInfoObject.timestamp = std::stol(value["Timestamp"].asString());
|
||||
if(!pageBeanNodeTraceInfosTraceInfo["TraceID"].isNull())
|
||||
traceInfoObject.traceID = pageBeanNodeTraceInfosTraceInfo["TraceID"].asString();
|
||||
if(!pageBeanNodeTraceInfosTraceInfo["OperationName"].isNull())
|
||||
traceInfoObject.operationName = pageBeanNodeTraceInfosTraceInfo["OperationName"].asString();
|
||||
if(!pageBeanNodeTraceInfosTraceInfo["ServiceName"].isNull())
|
||||
traceInfoObject.serviceName = pageBeanNodeTraceInfosTraceInfo["ServiceName"].asString();
|
||||
if(!pageBeanNodeTraceInfosTraceInfo["ServiceIp"].isNull())
|
||||
traceInfoObject.serviceIp = pageBeanNodeTraceInfosTraceInfo["ServiceIp"].asString();
|
||||
if(!pageBeanNodeTraceInfosTraceInfo["Duration"].isNull())
|
||||
traceInfoObject.duration = std::stol(pageBeanNodeTraceInfosTraceInfo["Duration"].asString());
|
||||
if(!pageBeanNodeTraceInfosTraceInfo["Timestamp"].isNull())
|
||||
traceInfoObject.timestamp = std::stol(pageBeanNodeTraceInfosTraceInfo["Timestamp"].asString());
|
||||
pageBean_.traceInfos.push_back(traceInfoObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user