Skip to content

Commit

Permalink
avoid error when prometheus gives scientific notation (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
buixor committed Jun 16, 2020
1 parent 8651a1a commit d6987ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/crowdsec-cli/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ func ShowPrometheus(url string) {
log.Debugf("no source in Metric")
}
value := m.(prom2json.Metric).Value
ival, err := strconv.Atoi(value)
fval, err := strconv.ParseFloat(value, 32)
if err != nil {
log.Errorf("Unexpected int value %s : %s", value, err)
}
ival := int(fval)
switch fam.Name {
/*buckets*/
case "cs_bucket_create":
Expand Down

0 comments on commit d6987ae

Please sign in to comment.