Skip to content

Use gopsutil upstream instead of fork#451

Open
pgimalac wants to merge 2 commits intomainfrom
pgimalac/replace-gopsutil-fork
Open

Use gopsutil upstream instead of fork#451
pgimalac wants to merge 2 commits intomainfrom
pgimalac/replace-gopsutil-fork

Conversation

@pgimalac
Copy link
Copy Markdown
Member

The gopsutil fork was still used in a single file, without particular reason a priori.

The only function used is host.PlatformInformation(), looking at the code the only changes in upstream compared to the fork are bugfixes, better parsing of some files, and supporting more Linux distributions.

@pgimalac pgimalac requested review from a team as code owners March 17, 2026 07:54
@brycekahle
Copy link
Copy Markdown
Member

brycekahle commented Mar 17, 2026

I still see significant differences in host_linux.go: shirou/gopsutil@master...DataDog:gopsutil:v1.2.2#diff-2b26d2c462

Specifically:

  • using VERSION_ID instead of VERSION for getOSRelease
  • Trimming of quotes
  • coercing platform amzn to amazon
  • Supporting more platform values
  • Supporting /etc/slackware-version
  • Ensuring the file has at least one line before using

@pgimalac
Copy link
Copy Markdown
Member Author

If the comment is that some values can change, it's true, but if anything it's bugfixes / better handling, so I considered it was fine
I would rely on CI to make sure a change doesn't break anything if it was functional 😅

using VERSION_ID instead of VERSION for getOSRelease

Huum both use VERSION_ID ?

Trimming of quotes

You're already trimming the quotes after calling host.PlatformInformation() and I'm quite sure the strings don't contain quotes in the middle

coercing platform amzn to amazon

Again this is done the same way in both ?

Supporting more platform values
Supporting /etc/slackware-version

Yes I mentioned in the PR description ("supporting more Linux distributions").
Do you think this could cause issues ?

Ensuring the file has at least one line before using

Again this is done both upstream and in our fork
I checked the blame out of curiosity and actually they explicitly based the change on our fork shirou/gopsutil#1328
And you opened a PR to do it for all files 😄 shirou/gopsutil#1584

@brycekahle
Copy link
Copy Markdown
Member

Huum both use VERSION_ID ?

Github diff is lying to me
Screenshot 2026-03-19 at 1 25 56 PM

getOSRelease doesn't even exist in that file anymore...

@brycekahle
Copy link
Copy Markdown
Member

I would rely on CI to make sure a change doesn't break anything if it was functional

Nikos CI is currently broken. I'm trying to fix it.

@brycekahle
Copy link
Copy Markdown
Member

Sorry for the confusion. I was looking at a Github diff which was wildly incorrect and I don't know why.

I'd prefer to wait until I fix the nikos CI to ensure this doesn't break anything.

@pgimalac
Copy link
Copy Markdown
Member Author

The fork and upstream have diverged for so long 😅
Maybe it's comparing to upstream's v3 instead of master for some reason (the fork is based on v3)

I'd prefer to wait until I fix the nikos CI to ensure this doesn't break anything.

Sure no problem for me !
FYI this is the last use of the gopsutil fork in the agent, but I think it's only imported by system-probe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants