userver: userver/ugrpc/client/call_context.hpp Source File
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
call_context.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/ugrpc/client/call_context.hpp
4/// @brief @copybrief ugrpc::client::CallContext
5
6#include <grpcpp/client_context.h>
7
8#include <userver/tracing/span.hpp>
9#include <userver/utils/impl/internal_tag_fwd.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace ugrpc::client {
14
15namespace impl {
16class CallState;
17} // namespace impl
18
19/// @brief gRPC call context
21public:
22 /// @cond
23 // For internal use only
24 CallContext(utils::impl::InternalTag, impl::CallState& state) noexcept;
25 /// @endcond
26
27 /// @returns the `ClientContext` used for this RPC
28 grpc::ClientContext& GetClientContext();
29
30 /// @returns client name
31 std::string_view GetClientName() const noexcept;
32
33 /// @returns RPC name
34 std::string_view GetCallName() const noexcept;
35
36 /// @returns RPC span
37 tracing::Span& GetSpan() noexcept;
38
39private:
40 impl::CallState& state_;
41};
42
43} // namespace ugrpc::client
44
45USERVER_NAMESPACE_END