/Users/deen/code/yugabyte-db/src/yb/consensus/log_metrics.cc
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | // |
18 | | // The following only applies to changes made to this file as part of YugaByte development. |
19 | | // |
20 | | // Portions Copyright (c) YugaByte, Inc. |
21 | | // |
22 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
23 | | // in compliance with the License. You may obtain a copy of the License at |
24 | | // |
25 | | // http://www.apache.org/licenses/LICENSE-2.0 |
26 | | // |
27 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
28 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
29 | | // or implied. See the License for the specific language governing permissions and limitations |
30 | | // under the License. |
31 | | // |
32 | | |
33 | | #include "yb/consensus/log_metrics.h" |
34 | | |
35 | | #include "yb/util/metrics.h" |
36 | | |
37 | | METRIC_DEFINE_counter(tablet, log_bytes_logged, "Bytes Written to WAL", |
38 | | yb::MetricUnit::kBytes, |
39 | | "Number of bytes logged since service start"); |
40 | | |
41 | | METRIC_DEFINE_counter(tablet, log_wal_size, "Size of WAL Files", |
42 | | yb::MetricUnit::kBytes, |
43 | | "Size of wal files"); |
44 | | |
45 | | METRIC_DEFINE_coarse_histogram(table, log_sync_latency, "Log Sync Latency", |
46 | | yb::MetricUnit::kMicroseconds, |
47 | | "Microseconds spent on synchronizing the log segment file"); |
48 | | |
49 | | METRIC_DEFINE_coarse_histogram(table, log_append_latency, "Log Append Latency", |
50 | | yb::MetricUnit::kMicroseconds, |
51 | | "Microseconds spent on appending to the log segment file"); |
52 | | |
53 | | METRIC_DEFINE_coarse_histogram(table, log_group_commit_latency, "Log Group Commit Latency", |
54 | | yb::MetricUnit::kMicroseconds, |
55 | | "Microseconds spent on committing an entire group"); |
56 | | |
57 | | METRIC_DEFINE_coarse_histogram(table, log_roll_latency, "Log Roll Latency", |
58 | | yb::MetricUnit::kMicroseconds, |
59 | | "Microseconds spent on rolling over to a new log segment file"); |
60 | | |
61 | | METRIC_DEFINE_coarse_histogram(table, log_entry_batches_per_group, "Log Group Commit Batch Size", |
62 | | yb::MetricUnit::kRequests, |
63 | | "Number of log entry batches in a group commit group"); |
64 | | |
65 | | namespace yb { |
66 | | namespace log { |
67 | | |
68 | | #define MINIT(metric_entity, x) x(METRIC_log_##x.Instantiate(metric_entity)) |
69 | | LogMetrics::LogMetrics(const scoped_refptr<MetricEntity>& table_metric_entity, |
70 | | const scoped_refptr<MetricEntity>& tablet_metric_entity) |
71 | | : MINIT(tablet_metric_entity, bytes_logged), |
72 | | MINIT(tablet_metric_entity, wal_size), |
73 | | MINIT(table_metric_entity, sync_latency), |
74 | | MINIT(table_metric_entity, append_latency), |
75 | | MINIT(table_metric_entity, group_commit_latency), |
76 | | MINIT(table_metric_entity, roll_latency), |
77 | 89.1k | MINIT(table_metric_entity, entry_batches_per_group) { |
78 | 89.1k | } |
79 | | #undef MINIT |
80 | | |
81 | | } // namespace log |
82 | | } // namespace yb |