pub struct OnDemandPIDResolver { /* private fields */ }Expand description
A resolver for mapping process IDs to their container IDs based on querying the underlying host.
§Platform support
On Linux, PIDs are resolved by querying procfs to find the cgroup of the process, if one exists, the cgroup hierarchy is queried to discover the container ID that owns the process, if possible.
On all other platforms, resolving a PID is a no-op.
Implementations§
Source§impl OnDemandPIDResolver
impl OnDemandPIDResolver
Sourcepub fn new(
procfs_root: Option<PathBuf>,
cgroupfs_root: Option<PathBuf>,
feature_detector: &FeatureDetector,
interner: GenericMapInterner,
) -> Result<Self, GenericError>
pub fn new( procfs_root: Option<PathBuf>, cgroupfs_root: Option<PathBuf>, feature_detector: &FeatureDetector, interner: GenericMapInterner, ) -> Result<Self, GenericError>
Creates a new OnDemandPIDResolver for the given container filesystem roots.
If a root is given, that path is used. Otherwise, it is resolved from the detected features.
§Errors
On Linux, if a cgroups hierarchy can’t be found, or the internal cache can’t be created, an error is returned. On all other platforms, no error is possible.
Sourcepub fn resolve(&self, process_id: u32) -> Option<EntityId>
pub fn resolve(&self, process_id: u32) -> Option<EntityId>
Resolves a process ID to the container ID of the container is part of.
If the process ID isn’t part of a container, or can’t be found, None is returned.
Sourcepub fn resolve_self_container(&self) -> Option<EntityId>
pub fn resolve_self_container(&self) -> Option<EntityId>
Resolves the current process’s container entity from local cgroup membership.
On non-Linux platforms, or when the process is not in a recognizable container cgroup, this returns None.
Trait Implementations§
Source§impl Clone for OnDemandPIDResolver
impl Clone for OnDemandPIDResolver
Source§fn clone(&self) -> OnDemandPIDResolver
fn clone(&self) -> OnDemandPIDResolver
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OnDemandPIDResolver
impl !RefUnwindSafe for OnDemandPIDResolver
impl Send for OnDemandPIDResolver
impl Sync for OnDemandPIDResolver
impl Unpin for OnDemandPIDResolver
impl !UnwindSafe for OnDemandPIDResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more