Skip to content

introspection: expose the daemon's PID and PIDNS#7694

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
AkihiroSuda:introspection-pid
Nov 29, 2022
Merged

introspection: expose the daemon's PID and PIDNS#7694
dmcgowan merged 1 commit intocontainerd:mainfrom
AkihiroSuda:introspection-pid

Conversation

@AkihiroSuda
Copy link
Copy Markdown
Member

e.g., for inspecting the daemon's oom_score_adj

}
pid := os.Getpid()
var pidns uint64
if runtime.GOOS == "linux" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is this if block necessary since you have an (empty) implementation of statPIDNS for all non-Linux platforms?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, but added for readability

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if err != nil {
return nil, errdefs.ToGRPC(err)
}
pid := os.Getpid()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't unshare newpid for the short-live thread. It is safe to do that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't get

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for my unclear comment.

I was thinking why not just hide the pid param in the statPIDNS function,
since pid won't change in the entire life-cycle.

And I also consider that the result can be cached when plugin initializes.
But other random thought comes. Is it possible to change containerd's pidns like #7513?
If the pidns changes, we can't cache it. 😂

@AkihiroSuda AkihiroSuda requested a review from estesp November 29, 2022 05:33
@dmcgowan dmcgowan merged commit 6f7ed27 into containerd:main Nov 29, 2022
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.

4 participants