3737 lg = kitlog .NewLogfmtLogger (os .Stdout )
3838
3939 // fields for metrics request. If expanded, struct CompanySet needs to be expanded accordingly
40- fieldsToReturn = []string {"id" , "name" , "slug" , "baseline_current" , "country_iso" , "stats_60" , "status" }
40+ fieldsToReturn = []string {"id" , "name" , "slug" , "baseline_current" , "country_iso" , "stats_24" , " stats_60" , "status" }
4141 fieldsToReturnSearch = []string {"id" , "name" , "slug" , "country_iso" }
4242
4343 token Token
@@ -99,6 +99,10 @@ type CompanySet struct {
9999 BaselineCurrent int `json:"baseline_current"`
100100 // Stats60 is the current metrics of mentions
101101 Stats60 int `json:"stats_60"`
102+ // IgnoreStats24 is the statistics over the last 24h in 15 minute buckets.
103+ IgnoreStats24 []int `json:"stats_24"`
104+ // Stats15 is the number of reports over the last 15
105+ Stats15 int `json:"-"`
102106 // NumStatus needs to be filled in programmatically from IgnoreStatus value so it can be used as metric
103107 NumStatus int `json:"-"`
104108}
@@ -490,6 +494,8 @@ func getMetrics(companyIDs string, searchString string) {
490494 default :
491495 companySet .NumStatus = - 1
492496 }
497+ // get last value from Stats24 array
498+ companySet .Stats15 = companySet .IgnoreStats24 [len (companySet .IgnoreStats24 )- 1 ]
493499
494500 // Debugging output
495501 level .Debug (lg ).Log ("msg" , fmt .Sprintf ("" ))
@@ -503,6 +509,7 @@ func getMetrics(companyIDs string, searchString string) {
503509 level .Debug (lg ).Log ("msg" , fmt .Sprintf ("===== Metrics =====" ))
504510 level .Debug (lg ).Log ("msg" , fmt .Sprintf ("Current Baseline: %d" , companySet .BaselineCurrent ))
505511 level .Debug (lg ).Log ("msg" , fmt .Sprintf ("Stats60: %d" , companySet .Stats60 ))
512+ level .Debug (lg ).Log ("msg" , fmt .Sprintf ("Stats15: %d" , companySet .Stats15 ))
506513 level .Debug (lg ).Log ("msg" , fmt .Sprintf ("Status: %d" , companySet .NumStatus ))
507514
508515 // create empty array to hold labels
0 commit comments