Reapply single-PID adapation for metricbeat's system/process, revert update to `go-systemd`
Proposed commit message
This reverts https://github.com/elastic/beats/pull/39714
Which in turn reverted https://github.com/elastic/beats/pull/39620
That original PR somehow ended up containing an update to coreos/go-systemd
That newer version of go-systemd contains this file: https://github.com/coreos/go-systemd/blob/v22.5.0/internal/dlopen/dlopen_example.go
Which is copied from coreos/pkg: https://github.com/coreos/pkg/blob/bbd7aa9bf6fb51acc905bd45a5363ebecf065f30/dlopen/dlopen_example.go
When the original PR was merged into beats, this caused a linker error in agentbeat, as agentbeat will import both the go-systemd and coreos/pkg libraries, resulting in two definitions of my_strlen from those two identical files.
For now, this just reverts the update to go-systemd, which isn't actually needed.
What I'm still not sure about is why this wasn't caught my CI. Do we not have anything in CI that packages agentbeat? Note that hitting this bug requires a few extra args during the build process:
args.ExtraFlags = append(args.ExtraFlags, "-tags=agentbeat,withjournald")
Going to manually test this with agent/agentbeat.
Checklist
- [x] My code follows the style guidelines of this project
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have made corresponding change to the default configuration files
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added an entry in
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.
Pinging @elastic/elastic-agent (Team:Elastic-Agent)
This pull request does not have a backport label. If this is a bug or security fix, could you label this PR @fearful-symmetry? 🙏. For such, you'll need to label your PR with:
- The upcoming major version of the Elastic Stack
- The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)
To fixup this pull request, you need to add the backport labels for the needed branches, such as:
backport-v8./d.0is the label to automatically backport to the8./dbranch./dis the digit
What I'm still not sure about is why this wasn't caught my CI. Do we not have anything in CI that packages agentbeat? Note that hitting this bug requires a few extra args during the build process:
It might be the case that the conditional build triggers don't properly account for agentbeat.
Alright, confirmed agentbeat builds with "-tags=agentbeat,withjournald" on this branch.
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)
At first glance it doesn't look like CI is actually building agentbeat with these changes.
I think we need to update CI to compile x-pack/agentbeat when any of the individual Beat pipelines is triggered. That is likely why this error was missed the first time.
@cmacknz do we want to rope CI changes into this PR?