Explorar o código

Fixed #TASK_QT-9810 解决网络数据发送失败问题

rock hai 1 ano
pai
achega
4bedc38519
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      main.go

+ 4 - 1
main.go

@@ -323,8 +323,10 @@ func main() {
 		log.Infoln("netdata is:", string(jsonData))
 		// 创建请求
 		urlRoute := "/api/v2/ebpf/receive"
+
+		log.Infoln("send url is ", *flags.ServerPrefix + *flags.DataServer + urlRoute)
 		// req, err := http.NewRequest("POST", "http://10.0.7.115:18080/api/v2/ebpf/receive", bytes.NewBuffer(jsonData))
-		req, err := http.NewRequest("POST", *flags.DataServer+urlRoute, bytes.NewBuffer(jsonData))
+		req, err := http.NewRequest("POST", *flags.ServerPrefix + *flags.DataServer + urlRoute, bytes.NewBuffer(jsonData))
 		if err != nil {
 			fmt.Println("Error:", err)
 			return
@@ -359,6 +361,7 @@ func main() {
 		// 输出响应状态码和响应正文
 		fmt.Println("Status Code:", response.StatusCode)
 		fmt.Println("Response Body:", string(responseData))
+		log.Infoln("send data response is ", string(responseData))
 	}
 	sendNetDataDone := make(chan struct{})
 	go func() {