fix: 跟踪任务新增非201/400时接收信息
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
|||||||
func NeTraceInfo(neInfo model.NeInfo, traceId string) (map[string]any, error) {
|
func NeTraceInfo(neInfo model.NeInfo, traceId string) (map[string]any, error) {
|
||||||
// 跟踪任务信息
|
// 跟踪任务信息
|
||||||
neUrl := fmt.Sprintf("http://%s:%d/api/rest/traceManagement/v1/subscriptions?id=%s", neInfo.IP, neInfo.Port, traceId)
|
neUrl := fmt.Sprintf("http://%s:%d/api/rest/traceManagement/v1/subscriptions?id=%s", neInfo.IP, neInfo.Port, traceId)
|
||||||
resBytes, err := fetch.Get(neUrl, nil, 60_000)
|
resBytes, err := fetch.Get(neUrl, nil, 30_000)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warnf("NeTraceInfo Get \"%s\"", neUrl)
|
logger.Warnf("NeTraceInfo Get \"%s\"", neUrl)
|
||||||
logger.Errorf("NeTraceInfo %s", err.Error())
|
logger.Errorf("NeTraceInfo %s", err.Error())
|
||||||
@@ -40,12 +40,11 @@ func NeTraceAdd(neInfo model.NeInfo, data map[string]any) (map[string]any, error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
errStr := err.Error()
|
errStr := err.Error()
|
||||||
logger.Warnf("NeTraceAdd POST \"%s\"", neUrl)
|
logger.Warnf("NeTraceAdd POST \"%s\"", neUrl)
|
||||||
if strings.HasPrefix(errStr, "201") || strings.HasPrefix(errStr, "204") {
|
if !(strings.HasPrefix(errStr, "201") || strings.HasPrefix(errStr, "400")) {
|
||||||
return resData, nil
|
|
||||||
}
|
|
||||||
logger.Errorf("NeTraceAdd %s", errStr)
|
logger.Errorf("NeTraceAdd %s", errStr)
|
||||||
return nil, fmt.Errorf("NeService Trace Add API Error")
|
return nil, fmt.Errorf("NeService Trace Add API Error")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 200 成功无数据时
|
// 200 成功无数据时
|
||||||
if len(resBytes) == 0 {
|
if len(resBytes) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user