diff --git a/main.go b/main.go index ce61b22..1c6c6fa 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,6 @@ import ( "io/ioutil" "log" "net/http" - "strconv" "github.com/cabify/gotoprom" "github.com/prometheus/client_golang/prometheus" @@ -77,8 +76,8 @@ type OntCovidDataByAge struct { AtLeastOneDoseCumulative json.Number `json:"At least one dose_cumulative"` SecondDoseCumulative json.Number `json:"Second_dose_cumulative"` TotalPopulation json.Number `json:"Total population"` - PercentAtLeastOneDose string `json:"Percent_at_least_one_dose"` - PercentFullyVaccinated string `json:"Percent_fully_vaccinated"` + PercentAtLeastOneDose json.Number `json:"Percent_at_least_one_dose"` + PercentFullyVaccinated json.Number `json:"Percent_fully_vaccinated"` } `json:"records"` Limit int `json:"limit"` Links struct { @@ -200,11 +199,11 @@ func updateMetrics() { if err != nil { log.Println(err) } - percentAtLeastOneDose, err := strconv.ParseFloat(record.PercentAtLeastOneDose, 64) + percentAtLeastOneDose, err := record.PercentAtLeastOneDose.Float64() if err != nil { log.Println(err) } - percentFullyVaccinated, err := strconv.ParseFloat(record.PercentFullyVaccinated, 64) + percentFullyVaccinated, err := record.PercentFullyVaccinated.Float64() if err != nil { log.Println(err) }