diff --git a/agent/agent.go b/agent/agent.go index 2ebdd1b7612b..2174674880a3 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -1603,6 +1603,7 @@ func (a *Agent) AddService(service *structs.NodeService, chkTypes []*structs.Che Notes: chkType.Notes, ServiceID: service.ID, ServiceName: service.Service, + ServiceTags: service.Tags, } if chkType.Status != "" { check.Status = chkType.Status diff --git a/agent/agent_test.go b/agent/agent_test.go index 3807227d6e35..0ea7fd32c9a3 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -290,6 +290,7 @@ func TestAgent_AddService(t *testing.T) { Notes: "note1", ServiceID: "svcid1", ServiceName: "svcname1", + ServiceTags: []string{"tag1"}, }, }, }, @@ -329,6 +330,7 @@ func TestAgent_AddService(t *testing.T) { Notes: "note1", ServiceID: "svcid2", ServiceName: "svcname2", + ServiceTags: []string{"tag2"}, }, "check-noname": &structs.HealthCheck{ Node: "node1", @@ -337,6 +339,7 @@ func TestAgent_AddService(t *testing.T) { Status: "critical", ServiceID: "svcid2", ServiceName: "svcname2", + ServiceTags: []string{"tag2"}, }, "service:svcid2:3": &structs.HealthCheck{ Node: "node1", @@ -345,6 +348,7 @@ func TestAgent_AddService(t *testing.T) { Status: "critical", ServiceID: "svcid2", ServiceName: "svcname2", + ServiceTags: []string{"tag2"}, }, "service:svcid2:4": &structs.HealthCheck{ Node: "node1", @@ -353,6 +357,7 @@ func TestAgent_AddService(t *testing.T) { Status: "critical", ServiceID: "svcid2", ServiceName: "svcname2", + ServiceTags: []string{"tag2"}, }, }, },