Status GetSupportedCurrencies()

in src/currency/src/server.cpp [105:142]


  Status GetSupportedCurrencies(ServerContext* context,
  	const Empty* request,
  	GetSupportedCurrenciesResponse* response) override
  {
    StartSpanOptions options;
    options.kind = SpanKind::kServer;
    GrpcServerCarrier carrier(context);

    auto prop        = context::propagation::GlobalTextMapPropagator::GetGlobalPropagator();
    auto current_ctx = context::RuntimeContext::GetCurrent();
    auto new_context = prop->Extract(carrier, current_ctx);
    options.parent   = GetSpan(new_context)->GetContext();

    std::string span_name = "Currency/GetSupportedCurrencies";
    auto span =
        get_tracer("currency")->StartSpan(span_name,
                                      {{SemanticConventions::kRpcSystem, "grpc"},
                                       {SemanticConventions::kRpcService, "oteldemo.CurrencyService"},
                                       {SemanticConventions::kRpcMethod, "GetSupportedCurrencies"},
                                       {SemanticConventions::kRpcGrpcStatusCode, 0}},
                                      options);
    auto scope = get_tracer("currency")->WithActiveSpan(span);

    span->AddEvent("Processing supported currencies request");

    for (auto &code : currency_conversion) {
      response->add_currency_codes(code.first);
    }

    span->AddEvent("Currencies fetched, response sent back");
    span->SetStatus(StatusCode::kOk);

    logger->Info(std::string(__func__) + " successful");

    // Make sure to end your spans!
    span->End();
  	return Status::OK;
  }