Support Sampling for jaeger.

This commit is contained in:
sdk-team
2020-10-27 03:05:56 +00:00
parent 838459913d
commit b4903d0fd0
24 changed files with 1151 additions and 5 deletions

View File

@@ -31,26 +31,98 @@ XtraceClient::XtraceClient(const Credentials &credentials, const ClientConfigura
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");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
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");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
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");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
XtraceClient::~XtraceClient()
{}
XtraceClient::CheckServiceLinkedRoleForDeletingOutcome XtraceClient::checkServiceLinkedRoleForDeleting(const CheckServiceLinkedRoleForDeletingRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CheckServiceLinkedRoleForDeletingOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CheckServiceLinkedRoleForDeletingOutcome(CheckServiceLinkedRoleForDeletingResult(outcome.result()));
else
return CheckServiceLinkedRoleForDeletingOutcome(outcome.error());
}
void XtraceClient::checkServiceLinkedRoleForDeletingAsync(const CheckServiceLinkedRoleForDeletingRequest& request, const CheckServiceLinkedRoleForDeletingAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, checkServiceLinkedRoleForDeleting(request), context);
};
asyncExecute(new Runnable(fn));
}
XtraceClient::CheckServiceLinkedRoleForDeletingOutcomeCallable XtraceClient::checkServiceLinkedRoleForDeletingCallable(const CheckServiceLinkedRoleForDeletingRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CheckServiceLinkedRoleForDeletingOutcome()>>(
[this, request]()
{
return this->checkServiceLinkedRoleForDeleting(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
XtraceClient::GetSamplingOutcome XtraceClient::getSampling(const GetSamplingRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetSamplingOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetSamplingOutcome(GetSamplingResult(outcome.result()));
else
return GetSamplingOutcome(outcome.error());
}
void XtraceClient::getSamplingAsync(const GetSamplingRequest& request, const GetSamplingAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getSampling(request), context);
};
asyncExecute(new Runnable(fn));
}
XtraceClient::GetSamplingOutcomeCallable XtraceClient::getSamplingCallable(const GetSamplingRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetSamplingOutcome()>>(
[this, request]()
{
return this->getSampling(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
XtraceClient::GetTagKeyOutcome XtraceClient::getTagKey(const GetTagKeyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -195,6 +267,42 @@ XtraceClient::GetTraceOutcomeCallable XtraceClient::getTraceCallable(const GetTr
return task->get_future();
}
XtraceClient::GetTraceAnalysisOutcome XtraceClient::getTraceAnalysis(const GetTraceAnalysisRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetTraceAnalysisOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetTraceAnalysisOutcome(GetTraceAnalysisResult(outcome.result()));
else
return GetTraceAnalysisOutcome(outcome.error());
}
void XtraceClient::getTraceAnalysisAsync(const GetTraceAnalysisRequest& request, const GetTraceAnalysisAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getTraceAnalysis(request), context);
};
asyncExecute(new Runnable(fn));
}
XtraceClient::GetTraceAnalysisOutcomeCallable XtraceClient::getTraceAnalysisCallable(const GetTraceAnalysisRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetTraceAnalysisOutcome()>>(
[this, request]()
{
return this->getTraceAnalysis(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
XtraceClient::ListIpOrHostsOutcome XtraceClient::listIpOrHosts(const ListIpOrHostsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -375,3 +483,39 @@ XtraceClient::SearchTracesOutcomeCallable XtraceClient::searchTracesCallable(con
return task->get_future();
}
XtraceClient::UpdateSamplingOutcome XtraceClient::updateSampling(const UpdateSamplingRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return UpdateSamplingOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return UpdateSamplingOutcome(UpdateSamplingResult(outcome.result()));
else
return UpdateSamplingOutcome(outcome.error());
}
void XtraceClient::updateSamplingAsync(const UpdateSamplingRequest& request, const UpdateSamplingAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, updateSampling(request), context);
};
asyncExecute(new Runnable(fn));
}
XtraceClient::UpdateSamplingOutcomeCallable XtraceClient::updateSamplingCallable(const UpdateSamplingRequest &request) const
{
auto task = std::make_shared<std::packaged_task<UpdateSamplingOutcome()>>(
[this, request]()
{
return this->updateSampling(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,84 @@
/*
* 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/CheckServiceLinkedRoleForDeletingRequest.h>
using AlibabaCloud::Xtrace::Model::CheckServiceLinkedRoleForDeletingRequest;
CheckServiceLinkedRoleForDeletingRequest::CheckServiceLinkedRoleForDeletingRequest() :
RpcServiceRequest("xtrace", "2019-08-08", "CheckServiceLinkedRoleForDeleting")
{
setMethod(HttpRequest::Method::Post);
}
CheckServiceLinkedRoleForDeletingRequest::~CheckServiceLinkedRoleForDeletingRequest()
{}
std::string CheckServiceLinkedRoleForDeletingRequest::getSPIRegionId()const
{
return sPIRegionId_;
}
void CheckServiceLinkedRoleForDeletingRequest::setSPIRegionId(const std::string& sPIRegionId)
{
sPIRegionId_ = sPIRegionId;
setParameter("SPIRegionId", sPIRegionId);
}
std::string CheckServiceLinkedRoleForDeletingRequest::getRegionId()const
{
return regionId_;
}
void CheckServiceLinkedRoleForDeletingRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string CheckServiceLinkedRoleForDeletingRequest::getRoleArn()const
{
return roleArn_;
}
void CheckServiceLinkedRoleForDeletingRequest::setRoleArn(const std::string& roleArn)
{
roleArn_ = roleArn;
setParameter("RoleArn", roleArn);
}
std::string CheckServiceLinkedRoleForDeletingRequest::getDeletionTaskId()const
{
return deletionTaskId_;
}
void CheckServiceLinkedRoleForDeletingRequest::setDeletionTaskId(const std::string& deletionTaskId)
{
deletionTaskId_ = deletionTaskId;
setParameter("DeletionTaskId", deletionTaskId);
}
std::string CheckServiceLinkedRoleForDeletingRequest::getServiceName()const
{
return serviceName_;
}
void CheckServiceLinkedRoleForDeletingRequest::setServiceName(const std::string& serviceName)
{
serviceName_ = serviceName;
setParameter("ServiceName", serviceName);
}

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/xtrace/model/CheckServiceLinkedRoleForDeletingResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Xtrace;
using namespace AlibabaCloud::Xtrace::Model;
CheckServiceLinkedRoleForDeletingResult::CheckServiceLinkedRoleForDeletingResult() :
ServiceResult()
{}
CheckServiceLinkedRoleForDeletingResult::CheckServiceLinkedRoleForDeletingResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CheckServiceLinkedRoleForDeletingResult::~CheckServiceLinkedRoleForDeletingResult()
{}
void CheckServiceLinkedRoleForDeletingResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allRoleUsagesNode = value["RoleUsages"]["RoleUsagesItem"];
for (auto valueRoleUsagesRoleUsagesItem : allRoleUsagesNode)
{
RoleUsagesItem roleUsagesObject;
if(!valueRoleUsagesRoleUsagesItem["Region"].isNull())
roleUsagesObject.region = valueRoleUsagesRoleUsagesItem["Region"].asString();
auto allResources = value["Resources"]["Resources"];
for (auto value : allResources)
roleUsagesObject.resources.push_back(value.asString());
roleUsages_.push_back(roleUsagesObject);
}
if(!value["Deletable"].isNull())
deletable_ = value["Deletable"].asString() == "true";
}
bool CheckServiceLinkedRoleForDeletingResult::getDeletable()const
{
return deletable_;
}
std::vector<CheckServiceLinkedRoleForDeletingResult::RoleUsagesItem> CheckServiceLinkedRoleForDeletingResult::getRoleUsages()const
{
return roleUsages_;
}

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/xtrace/model/GetSamplingRequest.h>
using AlibabaCloud::Xtrace::Model::GetSamplingRequest;
GetSamplingRequest::GetSamplingRequest() :
RpcServiceRequest("xtrace", "2019-08-08", "GetSampling")
{
setMethod(HttpRequest::Method::Post);
}
GetSamplingRequest::~GetSamplingRequest()
{}
std::string GetSamplingRequest::getRegionId()const
{
return regionId_;
}
void GetSamplingRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string GetSamplingRequest::getProxyUserId()const
{
return proxyUserId_;
}
void GetSamplingRequest::setProxyUserId(const std::string& proxyUserId)
{
proxyUserId_ = proxyUserId;
setParameter("ProxyUserId", proxyUserId);
}

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/xtrace/model/GetSamplingResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Xtrace;
using namespace AlibabaCloud::Xtrace::Model;
GetSamplingResult::GetSamplingResult() :
ServiceResult()
{}
GetSamplingResult::GetSamplingResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetSamplingResult::~GetSamplingResult()
{}
void GetSamplingResult::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 GetSamplingResult::getData()const
{
return data_;
}

View File

@@ -49,3 +49,14 @@ void GetTokenRequest::setAppType(const std::string& appType)
setParameter("AppType", appType);
}
std::string GetTokenRequest::getProxyUserId()const
{
return proxyUserId_;
}
void GetTokenRequest::setProxyUserId(const std::string& proxyUserId)
{
proxyUserId_ = proxyUserId;
setParameter("ProxyUserId", proxyUserId);
}

View File

@@ -0,0 +1,73 @@
/*
* 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/GetTraceAnalysisRequest.h>
using AlibabaCloud::Xtrace::Model::GetTraceAnalysisRequest;
GetTraceAnalysisRequest::GetTraceAnalysisRequest() :
RpcServiceRequest("xtrace", "2019-08-08", "GetTraceAnalysis")
{
setMethod(HttpRequest::Method::Post);
}
GetTraceAnalysisRequest::~GetTraceAnalysisRequest()
{}
std::string GetTraceAnalysisRequest::getRegionId()const
{
return regionId_;
}
void GetTraceAnalysisRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string GetTraceAnalysisRequest::getQuery()const
{
return query_;
}
void GetTraceAnalysisRequest::setQuery(const std::string& query)
{
query_ = query;
setParameter("Query", query);
}
std::string GetTraceAnalysisRequest::getApi()const
{
return api_;
}
void GetTraceAnalysisRequest::setApi(const std::string& api)
{
api_ = api;
setParameter("Api", api);
}
std::string GetTraceAnalysisRequest::getProxyUserId()const
{
return proxyUserId_;
}
void GetTraceAnalysisRequest::setProxyUserId(const std::string& proxyUserId)
{
proxyUserId_ = proxyUserId;
setParameter("ProxyUserId", proxyUserId);
}

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/xtrace/model/GetTraceAnalysisResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Xtrace;
using namespace AlibabaCloud::Xtrace::Model;
GetTraceAnalysisResult::GetTraceAnalysisResult() :
ServiceResult()
{}
GetTraceAnalysisResult::GetTraceAnalysisResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetTraceAnalysisResult::~GetTraceAnalysisResult()
{}
void GetTraceAnalysisResult::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 GetTraceAnalysisResult::getData()const
{
return data_;
}

View File

@@ -76,6 +76,17 @@ void QueryMetricRequest::setFilters(const std::vector<Filters>& filters)
}
}
std::string QueryMetricRequest::getProxyUserId()const
{
return proxyUserId_;
}
void QueryMetricRequest::setProxyUserId(const std::string& proxyUserId)
{
proxyUserId_ = proxyUserId;
setParameter("ProxyUserId", proxyUserId);
}
std::vector<std::string> QueryMetricRequest::getMeasures()const
{
return measures_;

View File

@@ -0,0 +1,62 @@
/*
* 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/UpdateSamplingRequest.h>
using AlibabaCloud::Xtrace::Model::UpdateSamplingRequest;
UpdateSamplingRequest::UpdateSamplingRequest() :
RpcServiceRequest("xtrace", "2019-08-08", "UpdateSampling")
{
setMethod(HttpRequest::Method::Post);
}
UpdateSamplingRequest::~UpdateSamplingRequest()
{}
std::string UpdateSamplingRequest::getRegionId()const
{
return regionId_;
}
void UpdateSamplingRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
std::string UpdateSamplingRequest::getSampling()const
{
return sampling_;
}
void UpdateSamplingRequest::setSampling(const std::string& sampling)
{
sampling_ = sampling;
setParameter("Sampling", sampling);
}
std::string UpdateSamplingRequest::getProxyUserId()const
{
return proxyUserId_;
}
void UpdateSamplingRequest::setProxyUserId(const std::string& proxyUserId)
{
proxyUserId_ = proxyUserId;
setParameter("ProxyUserId", proxyUserId);
}

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/xtrace/model/UpdateSamplingResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Xtrace;
using namespace AlibabaCloud::Xtrace::Model;
UpdateSamplingResult::UpdateSamplingResult() :
ServiceResult()
{}
UpdateSamplingResult::UpdateSamplingResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
UpdateSamplingResult::~UpdateSamplingResult()
{}
void UpdateSamplingResult::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 UpdateSamplingResult::getData()const
{
return data_;
}