/Users/deen/code/yugabyte-db/build/debugcov-clang-dynamic-arm64-ninja/src/yb/rpc/rtest.service.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // THIS FILE IS AUTOGENERATED FROM yb/rpc/rtest.proto |
2 | | |
3 | | #include "yb/rpc/rtest.pb.h" |
4 | | #include "yb/rpc/rtest.service.h" |
5 | | |
6 | | #include <glog/logging.h> |
7 | | |
8 | | #include "yb/rpc/inbound_call.h" |
9 | | #include "yb/rpc/local_call.h" |
10 | | #include "yb/rpc/remote_method.h" |
11 | | #include "yb/rpc/rpc_context.h" |
12 | | #include "yb/rpc/rpc_service.h" |
13 | | #include "yb/rpc/service_if.h" |
14 | | #include "yb/util/metrics.h" |
15 | | |
16 | | METRIC_DEFINE_counter( |
17 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Add, |
18 | | "Bytes received by yb.rpc_test.CalculatorService.Add() RPC requests", |
19 | | yb::MetricUnit::kBytes, |
20 | | "Bytes received by yb.rpc_test.CalculatorService.Add() RPC requests"); |
21 | | |
22 | | METRIC_DEFINE_counter( |
23 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Add, |
24 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Add() RPC requests", |
25 | | yb::MetricUnit::kBytes, |
26 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Add() RPC requests"); |
27 | | |
28 | | METRIC_DEFINE_histogram_with_percentiles( |
29 | | server, handler_latency_yb_rpc_test_CalculatorService_Add, |
30 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Add() RPC requests", |
31 | | yb::MetricUnit::kMicroseconds, |
32 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Add() RPC requests", |
33 | | 60000000LU, 2); |
34 | | |
35 | | METRIC_DEFINE_counter( |
36 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Sleep, |
37 | | "Bytes received by yb.rpc_test.CalculatorService.Sleep() RPC requests", |
38 | | yb::MetricUnit::kBytes, |
39 | | "Bytes received by yb.rpc_test.CalculatorService.Sleep() RPC requests"); |
40 | | |
41 | | METRIC_DEFINE_counter( |
42 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Sleep, |
43 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Sleep() RPC requests", |
44 | | yb::MetricUnit::kBytes, |
45 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Sleep() RPC requests"); |
46 | | |
47 | | METRIC_DEFINE_histogram_with_percentiles( |
48 | | server, handler_latency_yb_rpc_test_CalculatorService_Sleep, |
49 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Sleep() RPC requests", |
50 | | yb::MetricUnit::kMicroseconds, |
51 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Sleep() RPC requests", |
52 | | 60000000LU, 2); |
53 | | |
54 | | METRIC_DEFINE_counter( |
55 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Echo, |
56 | | "Bytes received by yb.rpc_test.CalculatorService.Echo() RPC requests", |
57 | | yb::MetricUnit::kBytes, |
58 | | "Bytes received by yb.rpc_test.CalculatorService.Echo() RPC requests"); |
59 | | |
60 | | METRIC_DEFINE_counter( |
61 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Echo, |
62 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Echo() RPC requests", |
63 | | yb::MetricUnit::kBytes, |
64 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Echo() RPC requests"); |
65 | | |
66 | | METRIC_DEFINE_histogram_with_percentiles( |
67 | | server, handler_latency_yb_rpc_test_CalculatorService_Echo, |
68 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Echo() RPC requests", |
69 | | yb::MetricUnit::kMicroseconds, |
70 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Echo() RPC requests", |
71 | | 60000000LU, 2); |
72 | | |
73 | | METRIC_DEFINE_counter( |
74 | | server, service_request_bytes_yb_rpc_test_CalculatorService_WhoAmI, |
75 | | "Bytes received by yb.rpc_test.CalculatorService.WhoAmI() RPC requests", |
76 | | yb::MetricUnit::kBytes, |
77 | | "Bytes received by yb.rpc_test.CalculatorService.WhoAmI() RPC requests"); |
78 | | |
79 | | METRIC_DEFINE_counter( |
80 | | server, service_response_bytes_yb_rpc_test_CalculatorService_WhoAmI, |
81 | | "Bytes sent in response to yb.rpc_test.CalculatorService.WhoAmI() RPC requests", |
82 | | yb::MetricUnit::kBytes, |
83 | | "Bytes sent in response to yb.rpc_test.CalculatorService.WhoAmI() RPC requests"); |
84 | | |
85 | | METRIC_DEFINE_histogram_with_percentiles( |
86 | | server, handler_latency_yb_rpc_test_CalculatorService_WhoAmI, |
87 | | "Microseconds spent handling yb.rpc_test.CalculatorService.WhoAmI() RPC requests", |
88 | | yb::MetricUnit::kMicroseconds, |
89 | | "Microseconds spent handling yb.rpc_test.CalculatorService.WhoAmI() RPC requests", |
90 | | 60000000LU, 2); |
91 | | |
92 | | METRIC_DEFINE_counter( |
93 | | server, service_request_bytes_yb_rpc_test_CalculatorService_TestArgumentsInDiffPackage, |
94 | | "Bytes received by yb.rpc_test.CalculatorService.TestArgumentsInDiffPackage() RPC requests", |
95 | | yb::MetricUnit::kBytes, |
96 | | "Bytes received by yb.rpc_test.CalculatorService.TestArgumentsInDiffPackage() RPC requests"); |
97 | | |
98 | | METRIC_DEFINE_counter( |
99 | | server, service_response_bytes_yb_rpc_test_CalculatorService_TestArgumentsInDiffPackage, |
100 | | "Bytes sent in response to yb.rpc_test.CalculatorService.TestArgumentsInDiffPackage() RPC requests", |
101 | | yb::MetricUnit::kBytes, |
102 | | "Bytes sent in response to yb.rpc_test.CalculatorService.TestArgumentsInDiffPackage() RPC requests"); |
103 | | |
104 | | METRIC_DEFINE_histogram_with_percentiles( |
105 | | server, handler_latency_yb_rpc_test_CalculatorService_TestArgumentsInDiffPackage, |
106 | | "Microseconds spent handling yb.rpc_test.CalculatorService.TestArgumentsInDiffPackage() RPC requests", |
107 | | yb::MetricUnit::kMicroseconds, |
108 | | "Microseconds spent handling yb.rpc_test.CalculatorService.TestArgumentsInDiffPackage() RPC requests", |
109 | | 60000000LU, 2); |
110 | | |
111 | | METRIC_DEFINE_counter( |
112 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Panic, |
113 | | "Bytes received by yb.rpc_test.CalculatorService.Panic() RPC requests", |
114 | | yb::MetricUnit::kBytes, |
115 | | "Bytes received by yb.rpc_test.CalculatorService.Panic() RPC requests"); |
116 | | |
117 | | METRIC_DEFINE_counter( |
118 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Panic, |
119 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Panic() RPC requests", |
120 | | yb::MetricUnit::kBytes, |
121 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Panic() RPC requests"); |
122 | | |
123 | | METRIC_DEFINE_histogram_with_percentiles( |
124 | | server, handler_latency_yb_rpc_test_CalculatorService_Panic, |
125 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Panic() RPC requests", |
126 | | yb::MetricUnit::kMicroseconds, |
127 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Panic() RPC requests", |
128 | | 60000000LU, 2); |
129 | | |
130 | | METRIC_DEFINE_counter( |
131 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Ping, |
132 | | "Bytes received by yb.rpc_test.CalculatorService.Ping() RPC requests", |
133 | | yb::MetricUnit::kBytes, |
134 | | "Bytes received by yb.rpc_test.CalculatorService.Ping() RPC requests"); |
135 | | |
136 | | METRIC_DEFINE_counter( |
137 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Ping, |
138 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Ping() RPC requests", |
139 | | yb::MetricUnit::kBytes, |
140 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Ping() RPC requests"); |
141 | | |
142 | | METRIC_DEFINE_histogram_with_percentiles( |
143 | | server, handler_latency_yb_rpc_test_CalculatorService_Ping, |
144 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Ping() RPC requests", |
145 | | yb::MetricUnit::kMicroseconds, |
146 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Ping() RPC requests", |
147 | | 60000000LU, 2); |
148 | | |
149 | | METRIC_DEFINE_counter( |
150 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Disconnect, |
151 | | "Bytes received by yb.rpc_test.CalculatorService.Disconnect() RPC requests", |
152 | | yb::MetricUnit::kBytes, |
153 | | "Bytes received by yb.rpc_test.CalculatorService.Disconnect() RPC requests"); |
154 | | |
155 | | METRIC_DEFINE_counter( |
156 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Disconnect, |
157 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Disconnect() RPC requests", |
158 | | yb::MetricUnit::kBytes, |
159 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Disconnect() RPC requests"); |
160 | | |
161 | | METRIC_DEFINE_histogram_with_percentiles( |
162 | | server, handler_latency_yb_rpc_test_CalculatorService_Disconnect, |
163 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Disconnect() RPC requests", |
164 | | yb::MetricUnit::kMicroseconds, |
165 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Disconnect() RPC requests", |
166 | | 60000000LU, 2); |
167 | | |
168 | | METRIC_DEFINE_counter( |
169 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Forward, |
170 | | "Bytes received by yb.rpc_test.CalculatorService.Forward() RPC requests", |
171 | | yb::MetricUnit::kBytes, |
172 | | "Bytes received by yb.rpc_test.CalculatorService.Forward() RPC requests"); |
173 | | |
174 | | METRIC_DEFINE_counter( |
175 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Forward, |
176 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Forward() RPC requests", |
177 | | yb::MetricUnit::kBytes, |
178 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Forward() RPC requests"); |
179 | | |
180 | | METRIC_DEFINE_histogram_with_percentiles( |
181 | | server, handler_latency_yb_rpc_test_CalculatorService_Forward, |
182 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Forward() RPC requests", |
183 | | yb::MetricUnit::kMicroseconds, |
184 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Forward() RPC requests", |
185 | | 60000000LU, 2); |
186 | | |
187 | | METRIC_DEFINE_counter( |
188 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Lightweight, |
189 | | "Bytes received by yb.rpc_test.CalculatorService.Lightweight() RPC requests", |
190 | | yb::MetricUnit::kBytes, |
191 | | "Bytes received by yb.rpc_test.CalculatorService.Lightweight() RPC requests"); |
192 | | |
193 | | METRIC_DEFINE_counter( |
194 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Lightweight, |
195 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Lightweight() RPC requests", |
196 | | yb::MetricUnit::kBytes, |
197 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Lightweight() RPC requests"); |
198 | | |
199 | | METRIC_DEFINE_histogram_with_percentiles( |
200 | | server, handler_latency_yb_rpc_test_CalculatorService_Lightweight, |
201 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Lightweight() RPC requests", |
202 | | yb::MetricUnit::kMicroseconds, |
203 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Lightweight() RPC requests", |
204 | | 60000000LU, 2); |
205 | | |
206 | | METRIC_DEFINE_counter( |
207 | | server, service_request_bytes_yb_rpc_test_CalculatorService_Trivial, |
208 | | "Bytes received by yb.rpc_test.CalculatorService.Trivial() RPC requests", |
209 | | yb::MetricUnit::kBytes, |
210 | | "Bytes received by yb.rpc_test.CalculatorService.Trivial() RPC requests"); |
211 | | |
212 | | METRIC_DEFINE_counter( |
213 | | server, service_response_bytes_yb_rpc_test_CalculatorService_Trivial, |
214 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Trivial() RPC requests", |
215 | | yb::MetricUnit::kBytes, |
216 | | "Bytes sent in response to yb.rpc_test.CalculatorService.Trivial() RPC requests"); |
217 | | |
218 | | METRIC_DEFINE_histogram_with_percentiles( |
219 | | server, handler_latency_yb_rpc_test_CalculatorService_Trivial, |
220 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Trivial() RPC requests", |
221 | | yb::MetricUnit::kMicroseconds, |
222 | | "Microseconds spent handling yb.rpc_test.CalculatorService.Trivial() RPC requests", |
223 | | 60000000LU, 2); |
224 | | |
225 | | METRIC_DEFINE_counter( |
226 | | server, service_request_bytes_yb_rpc_test_AbacusService_Concat, |
227 | | "Bytes received by yb.rpc_test.AbacusService.Concat() RPC requests", |
228 | | yb::MetricUnit::kBytes, |
229 | | "Bytes received by yb.rpc_test.AbacusService.Concat() RPC requests"); |
230 | | |
231 | | METRIC_DEFINE_counter( |
232 | | server, service_response_bytes_yb_rpc_test_AbacusService_Concat, |
233 | | "Bytes sent in response to yb.rpc_test.AbacusService.Concat() RPC requests", |
234 | | yb::MetricUnit::kBytes, |
235 | | "Bytes sent in response to yb.rpc_test.AbacusService.Concat() RPC requests"); |
236 | | |
237 | | METRIC_DEFINE_histogram_with_percentiles( |
238 | | server, handler_latency_yb_rpc_test_AbacusService_Concat, |
239 | | "Microseconds spent handling yb.rpc_test.AbacusService.Concat() RPC requests", |
240 | | yb::MetricUnit::kMicroseconds, |
241 | | "Microseconds spent handling yb.rpc_test.AbacusService.Concat() RPC requests", |
242 | | 60000000LU, 2); |
243 | | |
244 | | namespace yb { |
245 | | namespace rpc_test { |
246 | | |
247 | | void SetupError(::yb::rpc_test::TrivialErrorPB* error, const Status& status); |
248 | | |
249 | 69 | CalculatorServiceIf::CalculatorServiceIf(const scoped_refptr<MetricEntity>& entity) { |
250 | 69 | InitMethods(entity); |
251 | 69 | } |
252 | | |
253 | 67 | CalculatorServiceIf::~CalculatorServiceIf() { |
254 | 67 | } |
255 | | |
256 | 69 | void CalculatorServiceIf::FillEndpoints(const ::yb::rpc::RpcServicePtr& service, ::yb::rpc::RpcEndpointMap* map) { |
257 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kAdd)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kAdd))); |
258 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kSleep)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kSleep))); |
259 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kEcho)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kEcho))); |
260 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kWhoAmI)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kWhoAmI))); |
261 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTestArgumentsInDiffPackage)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTestArgumentsInDiffPackage))); |
262 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPanic)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPanic))); |
263 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPing)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPing))); |
264 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kDisconnect)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kDisconnect))); |
265 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kForward)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kForward))); |
266 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kLightweight)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kLightweight))); |
267 | 69 | map->emplace(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTrivial)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTrivial))); |
268 | 69 | } |
269 | | |
270 | 75.6k | void CalculatorServiceIf::Handle(::yb::rpc::InboundCallPtr call) { |
271 | 75.6k | auto index = call->method_index(); |
272 | 75.6k | methods_[index].handler(std::move(call)); |
273 | 75.6k | } |
274 | | |
275 | 207 | std::string CalculatorServiceIf::service_name() const { |
276 | 207 | return "yb.rpc_test.CalculatorService"; |
277 | 207 | } |
278 | 124 | std::string CalculatorServiceIf::static_service_name() { |
279 | 124 | return "yb.rpc_test.CalculatorService"; |
280 | 124 | } |
281 | | |
282 | 69 | void CalculatorServiceIf::InitMethods(const scoped_refptr<MetricEntity>& entity) { |
283 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kAdd)] = { |
284 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Add"), |
285 | 619 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
286 | 619 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kAdd)].metrics); |
287 | 619 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::AddRequestPB, ::yb::rpc_test::AddResponsePB>>( |
288 | 616 | std::move(call), [this](const ::yb::rpc_test::AddRequestPB* req, ::yb::rpc_test::AddResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
289 | 616 | Add(req, resp, std::move(rpc_context)); |
290 | 616 | }); |
291 | 619 | }, |
292 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
293 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Add.Instantiate(entity), |
294 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Add.Instantiate(entity), |
295 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Add.Instantiate(entity)) |
296 | 69 | }; |
297 | | |
298 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kSleep)] = { |
299 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Sleep"), |
300 | 38 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
301 | 38 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kSleep)].metrics); |
302 | 38 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::SleepRequestPB, ::yb::rpc_test::SleepResponsePB>>( |
303 | 39 | std::move(call), [this](const ::yb::rpc_test::SleepRequestPB* req, ::yb::rpc_test::SleepResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
304 | 39 | Sleep(req, resp, std::move(rpc_context)); |
305 | 39 | }); |
306 | 38 | }, |
307 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
308 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Sleep.Instantiate(entity), |
309 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Sleep.Instantiate(entity), |
310 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Sleep.Instantiate(entity)) |
311 | 69 | }; |
312 | | |
313 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kEcho)] = { |
314 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Echo"), |
315 | 16.0k | .handler = [this](::yb::rpc::InboundCallPtr call) { |
316 | 16.0k | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kEcho)].metrics); |
317 | 16.0k | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::EchoRequestPB, ::yb::rpc_test::EchoResponsePB>>( |
318 | 16.0k | std::move(call), [this](const ::yb::rpc_test::EchoRequestPB* req, ::yb::rpc_test::EchoResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
319 | 16.0k | Echo(req, resp, std::move(rpc_context)); |
320 | 16.0k | }); |
321 | 16.0k | }, |
322 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
323 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Echo.Instantiate(entity), |
324 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Echo.Instantiate(entity), |
325 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Echo.Instantiate(entity)) |
326 | 69 | }; |
327 | | |
328 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kWhoAmI)] = { |
329 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "WhoAmI"), |
330 | 4 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
331 | 4 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kWhoAmI)].metrics); |
332 | 4 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::WhoAmIRequestPB, ::yb::rpc_test::WhoAmIResponsePB>>( |
333 | 4 | std::move(call), [this](const ::yb::rpc_test::WhoAmIRequestPB* req, ::yb::rpc_test::WhoAmIResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
334 | 4 | WhoAmI(req, resp, std::move(rpc_context)); |
335 | 4 | }); |
336 | 4 | }, |
337 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
338 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_WhoAmI.Instantiate(entity), |
339 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_WhoAmI.Instantiate(entity), |
340 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_WhoAmI.Instantiate(entity)) |
341 | 69 | }; |
342 | | |
343 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTestArgumentsInDiffPackage)] = { |
344 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "TestArgumentsInDiffPackage"), |
345 | 0 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
346 | 0 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTestArgumentsInDiffPackage)].metrics); |
347 | 0 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test_diff_package::ReqDiffPackagePB, ::yb::rpc_test_diff_package::RespDiffPackagePB>>( |
348 | 0 | std::move(call), [this](const ::yb::rpc_test_diff_package::ReqDiffPackagePB* req, ::yb::rpc_test_diff_package::RespDiffPackagePB* resp, ::yb::rpc::RpcContext rpc_context) { |
349 | 0 | TestArgumentsInDiffPackage(req, resp, std::move(rpc_context)); |
350 | 0 | }); |
351 | 0 | }, |
352 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
353 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_TestArgumentsInDiffPackage.Instantiate(entity), |
354 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_TestArgumentsInDiffPackage.Instantiate(entity), |
355 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_TestArgumentsInDiffPackage.Instantiate(entity)) |
356 | 69 | }; |
357 | | |
358 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPanic)] = { |
359 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Panic"), |
360 | 1 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
361 | 1 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPanic)].metrics); |
362 | 1 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::PanicRequestPB, ::yb::rpc_test::PanicResponsePB>>( |
363 | 1 | std::move(call), [this](const ::yb::rpc_test::PanicRequestPB* req, ::yb::rpc_test::PanicResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
364 | 1 | Panic(req, resp, std::move(rpc_context)); |
365 | 1 | }); |
366 | 1 | }, |
367 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
368 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Panic.Instantiate(entity), |
369 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Panic.Instantiate(entity), |
370 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Panic.Instantiate(entity)) |
371 | 69 | }; |
372 | | |
373 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPing)] = { |
374 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Ping"), |
375 | 49.9k | .handler = [this](::yb::rpc::InboundCallPtr call) { |
376 | 49.9k | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kPing)].metrics); |
377 | 49.9k | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::PingRequestPB, ::yb::rpc_test::PingResponsePB>>( |
378 | 49.8k | std::move(call), [this](const ::yb::rpc_test::PingRequestPB* req, ::yb::rpc_test::PingResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
379 | 49.8k | Ping(req, resp, std::move(rpc_context)); |
380 | 49.8k | }); |
381 | 49.9k | }, |
382 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
383 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Ping.Instantiate(entity), |
384 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Ping.Instantiate(entity), |
385 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Ping.Instantiate(entity)) |
386 | 69 | }; |
387 | | |
388 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kDisconnect)] = { |
389 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Disconnect"), |
390 | 8.88k | .handler = [this](::yb::rpc::InboundCallPtr call) { |
391 | 8.88k | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kDisconnect)].metrics); |
392 | 8.88k | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::DisconnectRequestPB, ::yb::rpc_test::DisconnectResponsePB>>( |
393 | 8.86k | std::move(call), [this](const ::yb::rpc_test::DisconnectRequestPB* req, ::yb::rpc_test::DisconnectResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
394 | 8.86k | Disconnect(req, resp, std::move(rpc_context)); |
395 | 8.86k | }); |
396 | 8.88k | }, |
397 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
398 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Disconnect.Instantiate(entity), |
399 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Disconnect.Instantiate(entity), |
400 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Disconnect.Instantiate(entity)) |
401 | 69 | }; |
402 | | |
403 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kForward)] = { |
404 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Forward"), |
405 | 12 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
406 | 12 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kForward)].metrics); |
407 | 12 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::ForwardRequestPB, ::yb::rpc_test::ForwardResponsePB>>( |
408 | 12 | std::move(call), [this](const ::yb::rpc_test::ForwardRequestPB* req, ::yb::rpc_test::ForwardResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
409 | 12 | Forward(req, resp, std::move(rpc_context)); |
410 | 12 | }); |
411 | 12 | }, |
412 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
413 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Forward.Instantiate(entity), |
414 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Forward.Instantiate(entity), |
415 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Forward.Instantiate(entity)) |
416 | 69 | }; |
417 | | |
418 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kLightweight)] = { |
419 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Lightweight"), |
420 | 1 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
421 | 1 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kLightweight)].metrics); |
422 | 1 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallLWParamsImpl<::yb::rpc_test::LWLightweightRequestPB, ::yb::rpc_test::LWLightweightResponsePB>>( |
423 | 1 | std::move(call), [this](const ::yb::rpc_test::LWLightweightRequestPB* req, ::yb::rpc_test::LWLightweightResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
424 | 1 | Lightweight(req, resp, std::move(rpc_context)); |
425 | 1 | }); |
426 | 1 | }, |
427 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
428 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Lightweight.Instantiate(entity), |
429 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Lightweight.Instantiate(entity), |
430 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Lightweight.Instantiate(entity)) |
431 | 69 | }; |
432 | | |
433 | 69 | methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTrivial)] = { |
434 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Trivial"), |
435 | 2 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
436 | 2 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(CalculatorServiceRpcMethodIndexes::kTrivial)].metrics); |
437 | 2 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::TrivialRequestPB, ::yb::rpc_test::TrivialResponsePB>>( |
438 | 2 | std::move(call), [this](const ::yb::rpc_test::TrivialRequestPB* req, ::yb::rpc_test::TrivialResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
439 | 2 | auto result = Trivial(*req, rpc_context.GetClientDeadline()); |
440 | 2 | rpc_context.RespondTrivial(&result, resp); |
441 | 2 | }); |
442 | 2 | }, |
443 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
444 | 69 | METRIC_service_request_bytes_yb_rpc_test_CalculatorService_Trivial.Instantiate(entity), |
445 | 69 | METRIC_service_response_bytes_yb_rpc_test_CalculatorService_Trivial.Instantiate(entity), |
446 | 69 | METRIC_handler_latency_yb_rpc_test_CalculatorService_Trivial.Instantiate(entity)) |
447 | 69 | }; |
448 | | |
449 | 69 | } |
450 | | |
451 | 69 | AbacusServiceIf::AbacusServiceIf(const scoped_refptr<MetricEntity>& entity) { |
452 | 69 | InitMethods(entity); |
453 | 69 | } |
454 | | |
455 | 67 | AbacusServiceIf::~AbacusServiceIf() { |
456 | 67 | } |
457 | | |
458 | 69 | void AbacusServiceIf::FillEndpoints(const ::yb::rpc::RpcServicePtr& service, ::yb::rpc::RpcEndpointMap* map) { |
459 | 69 | map->emplace(methods_[static_cast<size_t>(AbacusServiceRpcMethodIndexes::kConcat)].method.serialized_body(), std::make_pair(service, static_cast<size_t>(AbacusServiceRpcMethodIndexes::kConcat))); |
460 | 69 | } |
461 | | |
462 | 1 | void AbacusServiceIf::Handle(::yb::rpc::InboundCallPtr call) { |
463 | 1 | auto index = call->method_index(); |
464 | 1 | methods_[index].handler(std::move(call)); |
465 | 1 | } |
466 | | |
467 | 207 | std::string AbacusServiceIf::service_name() const { |
468 | 207 | return "yb.rpc_test.CalculatorService"; |
469 | 207 | } |
470 | 0 | std::string AbacusServiceIf::static_service_name() { |
471 | 0 | return "yb.rpc_test.CalculatorService"; |
472 | 0 | } |
473 | | |
474 | 69 | void AbacusServiceIf::InitMethods(const scoped_refptr<MetricEntity>& entity) { |
475 | 69 | methods_[static_cast<size_t>(AbacusServiceRpcMethodIndexes::kConcat)] = { |
476 | 69 | .method = ::yb::rpc::RemoteMethod("yb.rpc_test.CalculatorService", "Concat"), |
477 | 1 | .handler = [this](::yb::rpc::InboundCallPtr call) { |
478 | 1 | call->SetRpcMethodMetrics(methods_[static_cast<size_t>(AbacusServiceRpcMethodIndexes::kConcat)].metrics); |
479 | 1 | ::yb::rpc::HandleCall<::yb::rpc::RpcCallPBParamsImpl<::yb::rpc_test::ConcatRequestPB, ::yb::rpc_test::ConcatResponsePB>>( |
480 | 1 | std::move(call), [this](const ::yb::rpc_test::ConcatRequestPB* req, ::yb::rpc_test::ConcatResponsePB* resp, ::yb::rpc::RpcContext rpc_context) { |
481 | 1 | Concat(req, resp, std::move(rpc_context)); |
482 | 1 | }); |
483 | 1 | }, |
484 | 69 | .metrics = ::yb::rpc::RpcMethodMetrics( |
485 | 69 | METRIC_service_request_bytes_yb_rpc_test_AbacusService_Concat.Instantiate(entity), |
486 | 69 | METRIC_service_response_bytes_yb_rpc_test_AbacusService_Concat.Instantiate(entity), |
487 | 69 | METRIC_handler_latency_yb_rpc_test_AbacusService_Concat.Instantiate(entity)) |
488 | 69 | }; |
489 | | |
490 | 69 | } |
491 | | |
492 | | } // namespace rpc_test |
493 | | } // namespace yb |