Skip to content

Commit

Permalink
fix(dialtesting): add task field df_label
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengbo committed Sep 19, 2024
1 parent e4b548b commit 150bc2e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
8 changes: 6 additions & 2 deletions dialtesting/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ type HTTPTask struct {
Tags map[string]string `json:"tags,omitempty"`
Labels []string `json:"labels,omitempty"`
WorkspaceLanguage string `json:"workspace_language,omitempty"`
TagsInfo string `json:"tags_info,omitempty"`
TagsInfo string `json:"tags_info,omitempty"` // deprecated
DFLabel string `json:"df_label,omitempty"`
AdvanceOptions *HTTPAdvanceOption `json:"advance_options,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
Option map[string]string
Expand Down Expand Up @@ -658,6 +659,9 @@ func (t *HTTPTask) GetWorkspaceLanguage() string {
return "zh"
}

func (t *HTTPTask) GetTagsInfo() string {
func (t *HTTPTask) GetDFLabel() string {
if t.DFLabel != "" {
return t.DFLabel
}
return t.TagsInfo
}
8 changes: 6 additions & 2 deletions dialtesting/icmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ type ICMPTask struct {
Labels []string `json:"labels,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
WorkspaceLanguage string `json:"workspace_language,omitempty"`
TagsInfo string `json:"tags_info,omitempty"`
TagsInfo string `json:"tags_info,omitempty"` // deprecated
DFLabel string `json:"df_label,omitempty"`

packetLossPercent float64
avgRoundTripTime float64 // us
Expand Down Expand Up @@ -506,6 +507,9 @@ func (t *ICMPTask) GetWorkspaceLanguage() string {
return "zh"
}

func (t *ICMPTask) GetTagsInfo() string {
func (t *ICMPTask) GetDFLabel() string {
if t.DFLabel != "" {
return t.DFLabel
}
return t.TagsInfo
}
2 changes: 1 addition & 1 deletion dialtesting/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Task interface {
GetLineData() string
GetHostName() (string, error)
GetWorkspaceLanguage() string
GetTagsInfo() string
GetDFLabel() string

SetRegionID(string)
SetAk(string)
Expand Down
8 changes: 6 additions & 2 deletions dialtesting/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ type TCPTask struct {
Labels []string `json:"labels,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
WorkspaceLanguage string `json:"workspace_language,omitempty"`
TagsInfo string `json:"tags_info,omitempty"`
TagsInfo string `json:"tags_info,omitempty"` // deprecated
DFLabel string `json:"df_label,omitempty"`

reqCost time.Duration
reqDNSCost time.Duration
Expand Down Expand Up @@ -443,6 +444,9 @@ func (t *TCPTask) GetWorkspaceLanguage() string {
return "zh"
}

func (t *TCPTask) GetTagsInfo() string {
func (t *TCPTask) GetDFLabel() string {
if t.DFLabel != "" {
return t.DFLabel
}
return t.TagsInfo
}
8 changes: 6 additions & 2 deletions dialtesting/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ type WebsocketTask struct {
Labels []string `json:"labels,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
WorkspaceLanguage string `json:"workspace_language,omitempty"`
TagsInfo string `json:"tags_info,omitempty"`
TagsInfo string `json:"tags_info,omitempty"` // deprecated
DFLabel string `json:"df_label,omitempty"`

reqCost time.Duration
reqDNSCost time.Duration
Expand Down Expand Up @@ -490,6 +491,9 @@ func (t *WebsocketTask) GetWorkspaceLanguage() string {
return "zh"
}

func (t *WebsocketTask) GetTagsInfo() string {
func (t *WebsocketTask) GetDFLabel() string {
if t.DFLabel != "" {
return t.DFLabel
}
return t.TagsInfo
}

0 comments on commit 150bc2e

Please sign in to comment.