YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/rpc/rpc_metrics.cc
Line
Count
Source
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
//
13
14
#include "yb/rpc/rpc_metrics.h"
15
16
#include "yb/util/metrics.h"
17
18
METRIC_DEFINE_gauge_int64(server, rpc_connections_alive,
19
                          "Number of alive RPC connections.",
20
                          yb::MetricUnit::kConnections,
21
                          "Number of alive RPC connections.");
22
23
METRIC_DEFINE_counter(server, rpc_connections_created,
24
                      "Number of created RPC connections.",
25
                      yb::MetricUnit::kConnections,
26
                      "Number of created RPC connections.");
27
28
METRIC_DEFINE_gauge_int64(server, rpc_inbound_calls_alive,
29
                          "Number of alive RPC inbound calls.",
30
                          yb::MetricUnit::kRequests,
31
                          "Number of alive RPC inbound calls.");
32
33
METRIC_DEFINE_counter(server, rpc_inbound_calls_created,
34
                      "Number of created RPC inbound calls.",
35
                      yb::MetricUnit::kRequests,
36
                      "Number of created RPC inbound calls.");
37
38
METRIC_DEFINE_gauge_int64(server, rpc_outbound_calls_alive,
39
                          "Number of alive RPC outbound calls.",
40
                          yb::MetricUnit::kRequests,
41
                          "Number of alive RPC outbound calls.");
42
43
METRIC_DEFINE_counter(server, rpc_outbound_calls_created,
44
                      "Number of created RPC outbound calls.",
45
                      yb::MetricUnit::kRequests,
46
                      "Number of created RPC outbound calls.");
47
48
namespace yb {
49
namespace rpc {
50
51
35.2k
RpcMetrics::RpcMetrics(const scoped_refptr<MetricEntity>& metric_entity) {
52
35.2k
  if (metric_entity) {
53
32.6k
    connections_alive = METRIC_rpc_connections_alive.Instantiate(metric_entity, 0);
54
32.6k
    connections_created = METRIC_rpc_connections_created.Instantiate(metric_entity);
55
32.6k
    inbound_calls_alive = METRIC_rpc_inbound_calls_alive.Instantiate(metric_entity, 0);
56
32.6k
    inbound_calls_created = METRIC_rpc_inbound_calls_created.Instantiate(metric_entity);
57
32.6k
    outbound_calls_alive = METRIC_rpc_outbound_calls_alive.Instantiate(metric_entity, 0);
58
32.6k
    outbound_calls_created = METRIC_rpc_outbound_calls_created.Instantiate(metric_entity);
59
32.6k
  }
60
35.2k
}
61
62
} // namespace rpc
63
} // namespace yb