supeng 1 year ago
parent
commit
cbfaa4fd2e
1 changed files with 25 additions and 1 deletions
  1. 25 1
      all/prometheus/main.go

+ 25 - 1
all/prometheus/main.go

@@ -106,6 +106,7 @@ func (c *CustomCollector) Describe(ch chan<- *prometheus.Desc) {
 	ch <- c.AdInfoDesc
 	ch <- c.AdOwnWechatInfoDesc
 	ch <- c.AdOwnInfoDesc
+	ch <- c.AdOwnConvDesc
 	ch <- c.ApiInfoDesc
 	ch <- c.VideoPlayDesc
 	ch <- c.AdConfigDesc
@@ -153,6 +154,9 @@ func (c *CustomCollector) Collect(ch chan<- prometheus.Metric) {
 				k == "adConfigLoaded" ||
 				k == "adLoaded" ||
 				k == "adView" ||
+				k == "adCloseBtnTap" ||
+				k == "adCloseGestureTap" ||
+				k == "adCloseMaskTap" ||
 				k == "adClick" {
 				v3, _ := strconv.ParseFloat(v2, 64)
 				ch <- prometheus.MustNewConstMetric(
@@ -178,6 +182,9 @@ func (c *CustomCollector) Collect(ch chan<- prometheus.Metric) {
 				k == "adConfigLoaded" ||
 				k == "adLoaded" ||
 				k == "adView" ||
+				k == "adCloseBtnTap" ||
+				k == "adCloseGestureTap" ||
+				k == "adCloseMaskTap" ||
 				k == "adClick" {
 				v3, _ := strconv.ParseFloat(v2, 64)
 				ch <- prometheus.MustNewConstMetric(
@@ -249,6 +256,23 @@ func (c *CustomCollector) Collect(ch chan<- prometheus.Metric) {
 		}
 	}
 
+	//resp, err = adOwnConvLogStore.GetLogs("", time.Now().Unix()-60, time.Now().Unix(), adOwnReportQuerySQL, 0, 0, true)
+	//if err != nil || resp == nil {
+	//	log.Printf("get own ad report logs error %+v resp is %+v.", err, resp)
+	//	return
+	//}
+	//for _, v := range resp.Logs {
+	//	for k, v2 := range v {
+	//		v3, _ := strconv.ParseFloat(v2, 64)
+	//		ch <- prometheus.MustNewConstMetric(
+	//			c.AdOwnConvDesc,
+	//			prometheus.GaugeValue,
+	//			v3,
+	//			v["appId"], v["eventType"], k,
+	//		)
+	//	}
+	//}
+
 	resp, err = adRequestStore.GetLogs("", time.Now().Unix()-60, time.Now().Unix(), adConfigQuerySQL, 0, 0, true)
 	if err != nil || resp == nil {
 		log.Printf("get ad config logs error %+v resp is %+v.", err, resp)
@@ -453,7 +477,7 @@ func main() {
 		AdOwnConvDesc: prometheus.NewDesc(
 			"ad_own_conv_metrics_info",
 			"Front report ad own metrics info",
-			[]string{"app_type", "ad_group", "ad_type", "_type"},
+			[]string{"app_id", "event_type"},
 			prometheus.Labels{},
 		),
 		ApiInfoDesc: prometheus.NewDesc(