Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[currency] - remove baggage processing #461

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions src/currencyservice/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@ class CurrencyService final : public hipstershop::CurrencyService::Service
const Empty* request,
GetSupportedCurrenciesResponse* response) override
{
// Read baggage from client context
auto clientContext = context->client_metadata();
auto range = clientContext.equal_range("baggage");
std::vector<std::string> baggageLists;
for (auto i = range.first; i != range.second; ++i)
{
baggageLists.emplace_back(std::string(i->second.data()));
}
std::vector<opentelemetry::nostd::shared_ptr<Baggage>> baggages(baggageLists.size());
for (int i = 0; i < baggageLists.size(); i++) {
auto baggage = Baggage::FromHeader(baggageLists[i]);
baggages[i] = baggage;
}

StartSpanOptions options;
options.kind = SpanKind::kServer;
GrpcServerCarrier carrier(context);
Expand All @@ -126,16 +112,6 @@ class CurrencyService final : public hipstershop::CurrencyService::Service
options);
auto scope = get_tracer("currencyservice")->WithActiveSpan(span);

for (auto& baggage : baggages) {
// Set the key value pairs from baggage to Span Attributes
baggage->GetAllEntries([&span](opentelemetry::nostd::string_view key,
opentelemetry::nostd::string_view value) {
span->SetAttribute(key, value);
return true;
});
}

// Fetch and parse whatever HTTP headers we can from the gRPC request.
span->AddEvent("Processing supported currencies request");

for (auto &code : currency_conversion) {
Expand Down Expand Up @@ -177,20 +153,6 @@ class CurrencyService final : public hipstershop::CurrencyService::Service
const CurrencyConversionRequest* request,
Money* response) override
{
// Read baggage from client context
auto clientContext = context->client_metadata();
auto range = clientContext.equal_range("baggage");
std::vector<std::string> baggageLists;
for (auto i = range.first; i != range.second; ++i)
{
baggageLists.emplace_back(std::string(i->second.data()));
}
std::vector<opentelemetry::nostd::shared_ptr<Baggage>> baggages(baggageLists.size());
for (int i = 0; i < baggageLists.size(); i++) {
auto baggage = Baggage::FromHeader(baggageLists[i]);
baggages[i] = baggage;
}

StartSpanOptions options;
options.kind = SpanKind::kServer;
GrpcServerCarrier carrier(context);
Expand All @@ -210,15 +172,6 @@ class CurrencyService final : public hipstershop::CurrencyService::Service
options);
auto scope = get_tracer("currencyservice")->WithActiveSpan(span);

for (auto& baggage : baggages) {
// Set the key value pairs from baggage to Span Attributes
baggage->GetAllEntries([&span](opentelemetry::nostd::string_view key,
opentelemetry::nostd::string_view value) {
span->SetAttribute(key, value);
return true;
});
}
// Fetch and parse whatever HTTP headers we can from the gRPC request.
span->AddEvent("Processing currency conversion request");

try {
Expand Down