File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
spectator-reg-servo/src/main/java/com/netflix/spectator/servo Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2015 Netflix, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com .netflix .spectator .servo ;
17
+
18
+ import com .netflix .servo .monitor .AbstractMonitor ;
19
+ import com .netflix .servo .monitor .MonitorConfig ;
20
+ import com .netflix .servo .monitor .NumericMonitor ;
21
+
22
+ /**
23
+ * Reports a constant value passed into the constructor.
24
+ */
25
+ final class ServoGauge <T extends Number > extends AbstractMonitor <Double >
26
+ implements NumericMonitor <Double > {
27
+ private final double value ;
28
+
29
+ /**
30
+ * Create a new monitor that returns {@code value}.
31
+ */
32
+ ServoGauge (MonitorConfig config , double value ) {
33
+ super (config );
34
+ this .value = value ;
35
+ }
36
+
37
+ @ Override public Double getValue (int pollerIndex ) {
38
+ return value ;
39
+ }
40
+ }
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ MonitorConfig toMonitorConfig(Id id) {
121
121
}
122
122
} else {
123
123
for (Measurement m : meter .measure ()) {
124
- monitors .add (new NumberGauge (toMonitorConfig (m .id ()), m .value ()));
124
+ monitors .add (new ServoGauge (toMonitorConfig (m .id ()), m .value ()));
125
125
}
126
126
}
127
127
}
You can’t perform that action at this time.
0 commit comments