From ce26a548c7d6b041b7b0b318af579eff99269b3e Mon Sep 17 00:00:00 2001 From: Dennis Berthold Date: Tue, 23 May 2023 12:12:16 +0200 Subject: [PATCH] HEL-2718 Updated name to be displayed as {workloadType/workloadName} e.g. deployment/testWorkload1 daemonSet/instana-agent-k8s-eu-prod-nodepool-eventcollector cronjob/technolot-rover --- pkg/iris/workloads/models/eventsEcst.go | 2 +- pkg/iris/workloads/services/events/eventProducer_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/iris/workloads/models/eventsEcst.go b/pkg/iris/workloads/models/eventsEcst.go index 1ccd329..976025c 100644 --- a/pkg/iris/workloads/models/eventsEcst.go +++ b/pkg/iris/workloads/models/eventsEcst.go @@ -128,7 +128,7 @@ func CreateEcstDiscoveryEvent(eventType string, changeAction string, data Data, body := models.DiscoveryBody{ State: models.State{ - Name: data.Workload.ClusterName, + Name: fmt.Sprintf("%s/%s", data.Workload.WorkloadType, data.Workload.WorkloadName), SourceType: "kubernetes", SourceInstance: fmt.Sprintf("cluster/%s", data.Workload.ClusterName), Time: time, diff --git a/pkg/iris/workloads/services/events/eventProducer_test.go b/pkg/iris/workloads/services/events/eventProducer_test.go index bec6ab0..b991bea 100644 --- a/pkg/iris/workloads/services/events/eventProducer_test.go +++ b/pkg/iris/workloads/services/events/eventProducer_test.go @@ -75,7 +75,7 @@ func Test_eventProducer_filter_created(t *testing.T) { assert.NoError(t, err) assert.Empty(t, updated) assert.Len(t, created, 1) - assert.Equal(t, "testCluster1", created[0].Body.State.Name) + assert.Equal(t, "deployment/testWorkload1", created[0].Body.State.Name) } func Test_eventProducer_filter_updated_no_change(t *testing.T) { @@ -394,7 +394,7 @@ func Test_eventProducer_createECSTEvents(t *testing.T) { assert.Equal(t, hex.EncodeToString(id1[:]), created[0].HeaderProperties.Id) assert.Equal(t, models.EventTypeChange, created[0].HeaderProperties.Type) assert.Equal(t, models.EventActionCreated, created[0].HeaderProperties.Action) - assert.Equal(t, "testCluster1", created[0].Body.State.Name) + assert.Equal(t, "deployment/testWorkload1", created[0].Body.State.Name) // UPDATED assert.Equal(t, models.EventTypeChange, updated[0].HeaderProperties.Type) assert.Equal(t, models.EventActionUpdated, updated[0].HeaderProperties.Action)