1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.master;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.apache.hadoop.classification.InterfaceAudience;
23 import org.apache.hadoop.classification.InterfaceStability;
24 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
25 import org.apache.hadoop.hbase.master.MetricsMasterSource;
26 import org.apache.hadoop.hbase.master.MetricsMasterSourceFactory;
27 import org.apache.hadoop.hbase.master.MetricsMasterWrapper;
28
29
30
31
32
33
34
35
36 @InterfaceStability.Evolving
37 @InterfaceAudience.Private
38 public class MetricsMaster {
39 private final Log LOG = LogFactory.getLog(this.getClass());
40 private MetricsMasterSource masterSource;
41
42 public MetricsMaster(MetricsMasterWrapper masterWrapper) {
43 masterSource = CompatibilitySingletonFactory.getInstance(MetricsMasterSourceFactory.class).create(masterWrapper);
44 }
45
46
47 public MetricsMasterSource getMetricsSource() {
48 return masterSource;
49 }
50
51
52
53
54
55
56 public synchronized void addSplit(long time, long size) {
57 masterSource.updateSplitTime(time);
58 masterSource.updateSplitSize(size);
59 }
60
61
62
63
64
65
66 public synchronized void addMetaWALSplit(long time, long size) {
67 masterSource.updateMetaWALSplitTime(time);
68 masterSource.updateMetaWALSplitSize(size);
69 }
70
71
72
73
74 public void incrementRequests(final int inc) {
75 masterSource.incRequests(inc);
76
77 }
78
79
80
81
82
83 public void updateRITCount(int ritCount) {
84 masterSource.setRIT(ritCount);
85 }
86
87
88
89
90
91
92 public void updateRITCountOverThreshold(int ritCountOverThreshold) {
93 masterSource.setRITCountOverThreshold(ritCountOverThreshold);
94 }
95
96
97
98
99 public void updateRITOldestAge(long timestamp) {
100 masterSource.setRITOldestAge(timestamp);
101 }
102
103
104
105
106
107 public void addSnapshot(long time) {
108 masterSource.updateSnapshotTime(time);
109 }
110
111
112
113
114
115 public void addSnapshotRestore(long time) {
116 masterSource.updateSnapshotRestoreTime(time);
117 }
118
119
120
121
122
123 public void addSnapshotClone(long time) {
124 masterSource.updateSnapshotCloneTime(time);
125 }
126 }