Add trace api.

This commit is contained in:
sdk-team
2020-04-03 19:52:25 +08:00
parent cc1b078ff1
commit 636e24a33f
21 changed files with 1259 additions and 1 deletions

View File

@@ -303,6 +303,42 @@ ARMSClient::DeleteRetcodeAppOutcomeCallable ARMSClient::deleteRetcodeAppCallable
return task->get_future();
}
ARMSClient::GetPrometheusApiTokenOutcome ARMSClient::getPrometheusApiToken(const GetPrometheusApiTokenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetPrometheusApiTokenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetPrometheusApiTokenOutcome(GetPrometheusApiTokenResult(outcome.result()));
else
return GetPrometheusApiTokenOutcome(outcome.error());
}
void ARMSClient::getPrometheusApiTokenAsync(const GetPrometheusApiTokenRequest& request, const GetPrometheusApiTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getPrometheusApiToken(request), context);
};
asyncExecute(new Runnable(fn));
}
ARMSClient::GetPrometheusApiTokenOutcomeCallable ARMSClient::getPrometheusApiTokenCallable(const GetPrometheusApiTokenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetPrometheusApiTokenOutcome()>>(
[this, request]()
{
return this->getPrometheusApiToken(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ARMSClient::GetRetcodeShareUrlOutcome ARMSClient::getRetcodeShareUrl(const GetRetcodeShareUrlRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -339,6 +375,42 @@ ARMSClient::GetRetcodeShareUrlOutcomeCallable ARMSClient::getRetcodeShareUrlCall
return task->get_future();
}
ARMSClient::GetTraceOutcome ARMSClient::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 ARMSClient::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));
}
ARMSClient::GetTraceOutcomeCallable ARMSClient::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();
}
ARMSClient::ImportAppAlertRulesOutcome ARMSClient::importAppAlertRules(const ImportAppAlertRulesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -411,6 +483,42 @@ ARMSClient::ImportCustomAlertRulesOutcomeCallable ARMSClient::importCustomAlertR
return task->get_future();
}
ARMSClient::ListClusterFromGrafanaOutcome ARMSClient::listClusterFromGrafana(const ListClusterFromGrafanaRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListClusterFromGrafanaOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListClusterFromGrafanaOutcome(ListClusterFromGrafanaResult(outcome.result()));
else
return ListClusterFromGrafanaOutcome(outcome.error());
}
void ARMSClient::listClusterFromGrafanaAsync(const ListClusterFromGrafanaRequest& request, const ListClusterFromGrafanaAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listClusterFromGrafana(request), context);
};
asyncExecute(new Runnable(fn));
}
ARMSClient::ListClusterFromGrafanaOutcomeCallable ARMSClient::listClusterFromGrafanaCallable(const ListClusterFromGrafanaRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListClusterFromGrafanaOutcome()>>(
[this, request]()
{
return this->listClusterFromGrafana(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ARMSClient::ListPromClustersOutcome ARMSClient::listPromClusters(const ListPromClustersRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -879,6 +987,42 @@ ARMSClient::SearchTraceAppByPageOutcomeCallable ARMSClient::searchTraceAppByPage
return task->get_future();
}
ARMSClient::SearchTracesOutcome ARMSClient::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 ARMSClient::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));
}
ARMSClient::SearchTracesOutcomeCallable ARMSClient::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();
}
ARMSClient::SetRetcodeShareStatusOutcome ARMSClient::setRetcodeShareStatus(const SetRetcodeShareStatusRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,40 @@
/*
* 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/arms/model/GetPrometheusApiTokenRequest.h>
using AlibabaCloud::ARMS::Model::GetPrometheusApiTokenRequest;
GetPrometheusApiTokenRequest::GetPrometheusApiTokenRequest() :
RpcServiceRequest("arms", "2019-08-08", "GetPrometheusApiToken")
{
setMethod(HttpRequest::Method::Post);
}
GetPrometheusApiTokenRequest::~GetPrometheusApiTokenRequest()
{}
std::string GetPrometheusApiTokenRequest::getRegionId()const
{
return regionId_;
}
void GetPrometheusApiTokenRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}

View 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/arms/model/GetPrometheusApiTokenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ARMS;
using namespace AlibabaCloud::ARMS::Model;
GetPrometheusApiTokenResult::GetPrometheusApiTokenResult() :
ServiceResult()
{}
GetPrometheusApiTokenResult::GetPrometheusApiTokenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetPrometheusApiTokenResult::~GetPrometheusApiTokenResult()
{}
void GetPrometheusApiTokenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Token"].isNull())
token_ = value["Token"].asString();
}
std::string GetPrometheusApiTokenResult::getToken()const
{
return token_;
}

View 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/arms/model/GetTraceRequest.h>
using AlibabaCloud::ARMS::Model::GetTraceRequest;
GetTraceRequest::GetTraceRequest() :
RpcServiceRequest("arms", "2019-08-08", "GetTrace")
{
setMethod(HttpRequest::Method::Post);
}
GetTraceRequest::~GetTraceRequest()
{}
std::string GetTraceRequest::getTraceID()const
{
return traceID_;
}
void GetTraceRequest::setTraceID(const std::string& traceID)
{
traceID_ = traceID;
setParameter("TraceID", traceID);
}
std::string GetTraceRequest::getRegionId()const
{
return regionId_;
}
void GetTraceRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}

View File

@@ -0,0 +1,101 @@
/*
* 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/arms/model/GetTraceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ARMS;
using namespace AlibabaCloud::ARMS::Model;
GetTraceResult::GetTraceResult() :
ServiceResult()
{}
GetTraceResult::GetTraceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetTraceResult::~GetTraceResult()
{}
void GetTraceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allSpansNode = value["Spans"]["Span"];
for (auto valueSpansSpan : allSpansNode)
{
Span spansObject;
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(!allSpansNodeTagEntryListTagEntry["Key"].isNull())
tagEntryListObject.key = allSpansNodeTagEntryListTagEntry["Key"].asString();
if(!allSpansNodeTagEntryListTagEntry["Value"].isNull())
tagEntryListObject.value = allSpansNodeTagEntryListTagEntry["Value"].asString();
spansObject.tagEntryList.push_back(tagEntryListObject);
}
auto allLogEventListNode = allSpansNode["LogEventList"]["LogEvent"];
for (auto allSpansNodeLogEventListLogEvent : allLogEventListNode)
{
Span::LogEvent logEventListObject;
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(!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);
}
spans_.push_back(spansObject);
}
}
std::vector<GetTraceResult::Span> GetTraceResult::getSpans()const
{
return spans_;
}

View File

@@ -0,0 +1,40 @@
/*
* 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/arms/model/ListClusterFromGrafanaRequest.h>
using AlibabaCloud::ARMS::Model::ListClusterFromGrafanaRequest;
ListClusterFromGrafanaRequest::ListClusterFromGrafanaRequest() :
RpcServiceRequest("arms", "2019-08-08", "ListClusterFromGrafana")
{
setMethod(HttpRequest::Method::Post);
}
ListClusterFromGrafanaRequest::~ListClusterFromGrafanaRequest()
{}
std::string ListClusterFromGrafanaRequest::getRegionId()const
{
return regionId_;
}
void ListClusterFromGrafanaRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}

View File

@@ -0,0 +1,91 @@
/*
* 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/arms/model/ListClusterFromGrafanaResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ARMS;
using namespace AlibabaCloud::ARMS::Model;
ListClusterFromGrafanaResult::ListClusterFromGrafanaResult() :
ServiceResult()
{}
ListClusterFromGrafanaResult::ListClusterFromGrafanaResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListClusterFromGrafanaResult::~ListClusterFromGrafanaResult()
{}
void ListClusterFromGrafanaResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allPromClusterListNode = value["PromClusterList"]["PromCluster"];
for (auto valuePromClusterListPromCluster : allPromClusterListNode)
{
PromCluster promClusterListObject;
if(!valuePromClusterListPromCluster["Id"].isNull())
promClusterListObject.id = std::stol(valuePromClusterListPromCluster["Id"].asString());
if(!valuePromClusterListPromCluster["ClusterId"].isNull())
promClusterListObject.clusterId = valuePromClusterListPromCluster["ClusterId"].asString();
if(!valuePromClusterListPromCluster["ClusterName"].isNull())
promClusterListObject.clusterName = valuePromClusterListPromCluster["ClusterName"].asString();
if(!valuePromClusterListPromCluster["AgentStatus"].isNull())
promClusterListObject.agentStatus = valuePromClusterListPromCluster["AgentStatus"].asString();
if(!valuePromClusterListPromCluster["ClusterType"].isNull())
promClusterListObject.clusterType = valuePromClusterListPromCluster["ClusterType"].asString();
if(!valuePromClusterListPromCluster["ControllerId"].isNull())
promClusterListObject.controllerId = valuePromClusterListPromCluster["ControllerId"].asString();
if(!valuePromClusterListPromCluster["IsControllerInstalled"].isNull())
promClusterListObject.isControllerInstalled = valuePromClusterListPromCluster["IsControllerInstalled"].asString() == "true";
if(!valuePromClusterListPromCluster["UserId"].isNull())
promClusterListObject.userId = valuePromClusterListPromCluster["UserId"].asString();
if(!valuePromClusterListPromCluster["RegionId"].isNull())
promClusterListObject.regionId = valuePromClusterListPromCluster["RegionId"].asString();
if(!valuePromClusterListPromCluster["PluginsJsonArray"].isNull())
promClusterListObject.pluginsJsonArray = valuePromClusterListPromCluster["PluginsJsonArray"].asString();
if(!valuePromClusterListPromCluster["StateJson"].isNull())
promClusterListObject.stateJson = valuePromClusterListPromCluster["StateJson"].asString();
if(!valuePromClusterListPromCluster["NodeNum"].isNull())
promClusterListObject.nodeNum = std::stoi(valuePromClusterListPromCluster["NodeNum"].asString());
if(!valuePromClusterListPromCluster["CreateTime"].isNull())
promClusterListObject.createTime = std::stol(valuePromClusterListPromCluster["CreateTime"].asString());
if(!valuePromClusterListPromCluster["UpdateTime"].isNull())
promClusterListObject.updateTime = std::stol(valuePromClusterListPromCluster["UpdateTime"].asString());
if(!valuePromClusterListPromCluster["LastHeartBeatTime"].isNull())
promClusterListObject.lastHeartBeatTime = std::stol(valuePromClusterListPromCluster["LastHeartBeatTime"].asString());
if(!valuePromClusterListPromCluster["InstallTime"].isNull())
promClusterListObject.installTime = std::stol(valuePromClusterListPromCluster["InstallTime"].asString());
if(!valuePromClusterListPromCluster["Extra"].isNull())
promClusterListObject.extra = valuePromClusterListPromCluster["Extra"].asString();
if(!valuePromClusterListPromCluster["Options"].isNull())
promClusterListObject.options = valuePromClusterListPromCluster["Options"].asString();
promClusterList_.push_back(promClusterListObject);
}
}
std::vector<ListClusterFromGrafanaResult::PromCluster> ListClusterFromGrafanaResult::getPromClusterList()const
{
return promClusterList_;
}

View File

@@ -0,0 +1,133 @@
/*
* 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/arms/model/SearchTracesRequest.h>
using AlibabaCloud::ARMS::Model::SearchTracesRequest;
SearchTracesRequest::SearchTracesRequest() :
RpcServiceRequest("arms", "2019-08-08", "SearchTraces")
{
setMethod(HttpRequest::Method::Post);
}
SearchTracesRequest::~SearchTracesRequest()
{}
long SearchTracesRequest::getEndTime()const
{
return endTime_;
}
void SearchTracesRequest::setEndTime(long endTime)
{
endTime_ = endTime;
setParameter("EndTime", std::to_string(endTime));
}
long SearchTracesRequest::getStartTime()const
{
return startTime_;
}
void SearchTracesRequest::setStartTime(long startTime)
{
startTime_ = startTime;
setParameter("StartTime", std::to_string(startTime));
}
bool SearchTracesRequest::getReverse()const
{
return reverse_;
}
void SearchTracesRequest::setReverse(bool reverse)
{
reverse_ = reverse;
setParameter("Reverse", reverse ? "true" : "false");
}
long SearchTracesRequest::getMinDuration()const
{
return minDuration_;
}
void SearchTracesRequest::setMinDuration(long minDuration)
{
minDuration_ = minDuration;
setParameter("MinDuration", std::to_string(minDuration));
}
std::string SearchTracesRequest::getServiceIp()const
{
return serviceIp_;
}
void SearchTracesRequest::setServiceIp(const std::string& serviceIp)
{
serviceIp_ = serviceIp;
setParameter("ServiceIp", serviceIp);
}
std::string SearchTracesRequest::getRegionId()const
{
return regionId_;
}
void SearchTracesRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string SearchTracesRequest::getOperationName()const
{
return operationName_;
}
void SearchTracesRequest::setOperationName(const std::string& operationName)
{
operationName_ = operationName;
setParameter("OperationName", operationName);
}
std::string SearchTracesRequest::getServiceName()const
{
return serviceName_;
}
void SearchTracesRequest::setServiceName(const std::string& serviceName)
{
serviceName_ = serviceName;
setParameter("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 + 1);
setParameter(tagObjStr + ".Value", tagObj.value);
setParameter(tagObjStr + ".Key", tagObj.key);
}
}

View File

@@ -0,0 +1,67 @@
/*
* 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/arms/model/SearchTracesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::ARMS;
using namespace AlibabaCloud::ARMS::Model;
SearchTracesResult::SearchTracesResult() :
ServiceResult()
{}
SearchTracesResult::SearchTracesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
SearchTracesResult::~SearchTracesResult()
{}
void SearchTracesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allTraceInfosNode = value["TraceInfos"]["TraceInfo"];
for (auto valueTraceInfosTraceInfo : allTraceInfosNode)
{
TraceInfo traceInfosObject;
if(!valueTraceInfosTraceInfo["TraceID"].isNull())
traceInfosObject.traceID = valueTraceInfosTraceInfo["TraceID"].asString();
if(!valueTraceInfosTraceInfo["OperationName"].isNull())
traceInfosObject.operationName = valueTraceInfosTraceInfo["OperationName"].asString();
if(!valueTraceInfosTraceInfo["ServiceName"].isNull())
traceInfosObject.serviceName = valueTraceInfosTraceInfo["ServiceName"].asString();
if(!valueTraceInfosTraceInfo["ServiceIp"].isNull())
traceInfosObject.serviceIp = valueTraceInfosTraceInfo["ServiceIp"].asString();
if(!valueTraceInfosTraceInfo["Duration"].isNull())
traceInfosObject.duration = std::stol(valueTraceInfosTraceInfo["Duration"].asString());
if(!valueTraceInfosTraceInfo["Timestamp"].isNull())
traceInfosObject.timestamp = std::stol(valueTraceInfosTraceInfo["Timestamp"].asString());
traceInfos_.push_back(traceInfosObject);
}
}
std::vector<SearchTracesResult::TraceInfo> SearchTracesResult::getTraceInfos()const
{
return traceInfos_;
}