This repository was archived by the owner on Jan 10, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,22 @@ type cmetric struct {
2121 typ prometheus.ValueType
2222}
2323
24+ func parseFloatOrBool (v string ) (float64 , error ) {
25+ f , err := strconv .ParseFloat (v , 64 )
26+ if err != nil {
27+ // trying to see if the value is a boolean
28+ b , err2 := strconv .ParseBool (v )
29+ if err2 == nil {
30+ err = nil
31+ f = 0
32+ if b {
33+ f = 1
34+ }
35+ }
36+ }
37+ return f , err
38+ }
39+
2440// infoCollect parses RequestInfo() results and handles the metrics
2541func infoCollect (
2642 ch chan <- prometheus.Metric ,
@@ -35,7 +51,7 @@ func infoCollect(
3551 // key presence depends on (namespace) configuration
3652 continue
3753 }
38- f , err := strconv . ParseFloat ( v , 64 )
54+ f , err := parseFloatOrBool ( v )
3955 if err != nil {
4056 log .Printf ("%q invalid value %q: %s" , key , v , err )
4157 continue
Original file line number Diff line number Diff line change 2222 gauge ("prole_tombstones" , "prole tombstones" ),
2323 gauge ("non_replica_objects" , "non replica objects" ),
2424 gauge ("non_replica_tombstones" , "non replica tombstones" ),
25- // stop_writes=false
26- // hwm_breached=false
25+ gauge ( " stop_writes" , "stop writes" ),
26+ gauge ( " hwm_breached" , "hwm breached" ),
2727 // current_time=257114127
2828 gauge ("non_expirable_objects" , "non expirable objects" ),
2929 counter ("expired_objects" , "expired objects" ),
You can’t perform that action at this time.
0 commit comments