diff --git a/internal/pkg/agent/application/monitoring/processes.go b/internal/pkg/agent/application/monitoring/processes.go index 9649778fa51..95441fd9e06 100644 --- a/internal/pkg/agent/application/monitoring/processes.go +++ b/internal/pkg/agent/application/monitoring/processes.go @@ -50,9 +50,20 @@ func processesHandler(coord *coordinator.Coordinator) func(http.ResponseWriter, for _, c := range state.Components { if c.Component.InputSpec != nil { - procs = append(procs, process{c.Component.ID, c.Component.InputSpec.BinaryName, - c.LegacyPID, - sourceFromComponentID(c.Component.ID)}) + displayID := c.Component.ID + if strings.Contains(c.Component.InputSpec.BinaryName, "apm-server") { + // Cloud explicitly looks for an ID of "apm-server" to determine if APM is in managed mode. + // Ensure that this is the ID we use, at the time of writing it is "apm-default". + // Otherwise apm-server won't be routable/accessible in cloud. + // https://github.com/elastic/elastic-agent/issues/1731#issuecomment-1325862913 + displayID = "apm-server" + } + procs = append(procs, process{ + ID: displayID, + PID: c.LegacyPID, + Binary: c.Component.InputSpec.BinaryName, + Source: sourceFromComponentID(c.Component.ID), + }) } } data := struct {