1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.regionserver;
19
20 import com.google.common.annotations.VisibleForTesting;
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.classification.InterfaceStability;
23 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
24
25
26
27
28
29
30
31
32
33 @InterfaceStability.Evolving
34 @InterfaceAudience.Private
35 public class MetricsRegionServer {
36 private MetricsRegionServerSource serverSource;
37 private MetricsRegionServerWrapper regionServerWrapper;
38
39 public MetricsRegionServer(MetricsRegionServerWrapper regionServerWrapper) {
40 this(regionServerWrapper,
41 CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class)
42 .createServer(regionServerWrapper));
43
44 }
45
46 MetricsRegionServer(MetricsRegionServerWrapper regionServerWrapper,
47 MetricsRegionServerSource serverSource) {
48 this.regionServerWrapper = regionServerWrapper;
49 this.serverSource = serverSource;
50 }
51
52 @VisibleForTesting
53 public MetricsRegionServerSource getMetricsSource() {
54 return serverSource;
55 }
56
57 public MetricsRegionServerWrapper getRegionServerWrapper() {
58 return regionServerWrapper;
59 }
60
61 public void updatePut(long t) {
62 if (t > 1000) {
63 serverSource.incrSlowPut();
64 }
65 serverSource.updatePut(t);
66 }
67
68 public void updateDelete(long t) {
69 if (t > 1000) {
70 serverSource.incrSlowDelete();
71 }
72 serverSource.updateDelete(t);
73 }
74
75 public void updateGet(long t) {
76 if (t > 1000) {
77 serverSource.incrSlowGet();
78 }
79 serverSource.updateGet(t);
80 }
81
82 public void updateIncrement(long t) {
83 if (t > 1000) {
84 serverSource.incrSlowIncrement();
85 }
86 serverSource.updateIncrement(t);
87 }
88
89 public void updateAppend(long t) {
90 if (t > 1000) {
91 serverSource.incrSlowAppend();
92 }
93 serverSource.updateAppend(t);
94 }
95
96 public void updateReplay(long t){
97 serverSource.updateReplay(t);
98 }
99
100 public void updateScannerNext(long scanSize){
101 serverSource.updateScannerNext(scanSize);
102 }
103
104 public void updateSplitTime(long t) {
105 serverSource.updateSplitTime(t);
106 }
107
108 public void incrSplitRequest() {
109 serverSource.incrSplitRequest();
110 }
111
112 public void incrSplitSuccess() {
113 serverSource.incrSplitSuccess();
114 }
115
116 public void updateFlushTime(long t) {
117 serverSource.updateFlushTime(t);
118 }
119 }