1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.ipc;
21
22 import org.apache.hadoop.hbase.MultiActionResultTooLarge;
23 import org.apache.hadoop.hbase.NotServingRegionException;
24 import org.apache.hadoop.hbase.RegionTooBusyException;
25 import org.apache.hadoop.hbase.UnknownScannerException;
26 import org.apache.hadoop.hbase.classification.InterfaceAudience;
27 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
28 import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
29 import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
30 import org.apache.hadoop.hbase.exceptions.RegionMovedException;
31 import org.apache.hadoop.hbase.exceptions.ScannerResetException;
32
33 @InterfaceAudience.Private
34 public class MetricsHBaseServer {
35 private MetricsHBaseServerSource source;
36 private MetricsHBaseServerWrapper serverWrapper;
37
38 public MetricsHBaseServer(String serverName, MetricsHBaseServerWrapper wrapper) {
39 serverWrapper = wrapper;
40 source = CompatibilitySingletonFactory.getInstance(MetricsHBaseServerSourceFactory.class)
41 .create(serverName, wrapper);
42 }
43
44 void authorizationSuccess() {
45 source.authorizationSuccess();
46 }
47
48 void authorizationFailure() {
49 source.authorizationFailure();
50 }
51
52 void authenticationFailure() {
53 source.authenticationFailure();
54 }
55
56 void authenticationSuccess() {
57 source.authenticationSuccess();
58 }
59
60 void authenticationFallback() {
61 source.authenticationFallback();
62 }
63
64 void sentBytes(long count) {
65 source.sentBytes(count);
66 }
67
68 void receivedBytes(int count) {
69 source.receivedBytes(count);
70 }
71
72 void sentResponse(long count) { source.sentResponse(count); }
73
74 void receivedRequest(long count) { source.receivedRequest(count); }
75
76 void dequeuedCall(int qTime) {
77 source.dequeuedCall(qTime);
78 }
79
80 void processedCall(int processingTime) {
81 source.processedCall(processingTime);
82 }
83
84 void totalCall(int totalTime) {
85 source.queuedAndProcessedCall(totalTime);
86 }
87
88 public void exception(Throwable throwable) {
89 source.exception();
90
91
92
93
94
95
96
97
98
99 if (throwable != null) {
100 if (throwable instanceof OutOfOrderScannerNextException) {
101 source.outOfOrderException();
102 } else if (throwable instanceof RegionTooBusyException) {
103 source.tooBusyException();
104 } else if (throwable instanceof UnknownScannerException) {
105 source.unknownScannerException();
106 } else if (throwable instanceof ScannerResetException) {
107 source.scannerResetException();
108 } else if (throwable instanceof RegionMovedException) {
109 source.movedRegionException();
110 } else if (throwable instanceof NotServingRegionException) {
111 source.notServingRegionException();
112 } else if (throwable instanceof FailedSanityCheckException) {
113 source.failedSanityException();
114 } else if (throwable instanceof MultiActionResultTooLarge) {
115 source.multiActionTooLargeException();
116 }
117 }
118 }
119
120 public MetricsHBaseServerSource getMetricsSource() {
121 return source;
122 }
123
124 public MetricsHBaseServerWrapper getHBaseServerWrapper() {
125 return serverWrapper;
126 }
127 }