diff --git a/pkg/collector/corechecks/servicediscovery/impl_linux.go b/pkg/collector/corechecks/servicediscovery/impl_linux.go index c85e66d380a1a5..fe470bd863d76f 100644 --- a/pkg/collector/corechecks/servicediscovery/impl_linux.go +++ b/pkg/collector/corechecks/servicediscovery/impl_linux.go @@ -106,6 +106,7 @@ func (li *linuxImpl) DiscoverServices() (*discoveredServices, error) { svc.service.CPUCores = service.CPUCores svc.service.ContainerID = service.ContainerID svc.service.GeneratedName = service.GeneratedName + svc.service.Name = service.Name events.heartbeat = append(events.heartbeat, *svc) } } @@ -143,6 +144,7 @@ func (li *linuxImpl) handlePotentialServices(events *serviceEvents, now time.Tim svc.service.CPUCores = service.CPUCores svc.service.ContainerID = service.ContainerID svc.service.GeneratedName = service.GeneratedName + svc.service.Name = service.Name li.aliveServices[pid] = svc events.start = append(events.start, *svc) diff --git a/pkg/collector/corechecks/servicediscovery/module/impl_linux.go b/pkg/collector/corechecks/servicediscovery/module/impl_linux.go index dd02e8a13c2f44..181c22b662aaac 100644 --- a/pkg/collector/corechecks/servicediscovery/module/impl_linux.go +++ b/pkg/collector/corechecks/servicediscovery/module/impl_linux.go @@ -685,6 +685,10 @@ func (s *discovery) enrichContainerData(service *model.Service, containers map[s if serviceName != "" { service.GeneratedName = serviceName + // Update the legacy name field as well + if service.DDService == "" { + service.Name = serviceName + } } service.CheckedContainerData = true diff --git a/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go b/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go index a8154ea1b79251..81c5bdb6a9f3a2 100644 --- a/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go +++ b/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go @@ -840,6 +840,7 @@ func TestDocker(t *testing.T) { require.Contains(t, portMap, pid1111) require.Contains(t, portMap[pid1111].Ports, uint16(1234)) require.Contains(t, portMap[pid1111].ContainerID, "dummyCID") + require.Contains(t, portMap[pid1111].Name, "foo_from_app_tag") require.Contains(t, portMap[pid1111].GeneratedName, "foo_from_app_tag") }