#[non_exhaustive]pub enum SourceKind {
Show 25 variants
EnvOverride,
FileOverride,
Container,
Lxc,
MachineId,
DbusMachineId,
Dmi,
LinuxHostId,
IoPlatformUuid,
WindowsMachineGuid,
FreeBsdHostId,
KenvSmbios,
BsdKernHostId,
IllumosHostId,
AwsImds,
GcpMetadata,
AzureImds,
DigitalOceanMetadata,
HetznerMetadata,
OciMetadata,
OpenStackMetadata,
KubernetesPodUid,
KubernetesServiceAccount,
KubernetesDownwardApi,
Custom(&'static str),
}Expand description
Short, stable label identifying a source.
Covers every built-in source plus a SourceKind::Custom variant for
consumer-defined sources. Displayed in error messages, logs, and on the
resolved crate::HostId.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
EnvOverride
Environment-variable override.
FileOverride
File-path override.
Container
Container runtime ID extracted from /proc/self/mountinfo (Linux).
Lxc
LXC/LXD container name from /proc/self/cgroup or
/proc/self/mountinfo, salted with /etc/machine-id (Linux).
MachineId
/etc/machine-id (Linux).
DbusMachineId
/var/lib/dbus/machine-id (Linux).
Dmi
/sys/class/dmi/id/product_uuid — SMBIOS system UUID (Linux).
LinuxHostId
/etc/hostid — glibc 4-byte legacy host identifier (Linux).
IoPlatformUuid
IOPlatformUUID from IOPlatformExpertDevice (macOS).
WindowsMachineGuid
HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid (Windows).
FreeBsdHostId
/etc/hostid (FreeBSD).
KenvSmbios
kenv smbios.system.uuid (FreeBSD SMBIOS).
BsdKernHostId
sysctl kern.hostid (NetBSD, OpenBSD).
IllumosHostId
hostid(1) (illumos, Solaris).
AwsImds
AWS EC2 instance ID via IMDSv2.
GcpMetadata
GCP Compute Engine numeric instance ID via the metadata server.
AzureImds
Azure VM UUID via the Azure Instance Metadata Service.
DigitalOceanMetadata
DigitalOcean Droplet numeric ID.
HetznerMetadata
Hetzner Cloud numeric server ID.
OciMetadata
Oracle Cloud Infrastructure instance OCID.
OpenStackMetadata
OpenStack Nova instance UUID via the metadata service.
KubernetesPodUid
Kubernetes pod UID derived from /proc/self/mountinfo.
KubernetesServiceAccount
Kubernetes service-account namespace.
KubernetesDownwardApi
Kubernetes downward-API projected file.
Custom(&'static str)
Caller-supplied source; the payload is a short label for logs.
The label appears verbatim in Display and
SourceKind::as_str output — a Custom("machine-id") renders
identically to the built-in SourceKind::MachineId. Callers
should pick labels that don’t collide with the built-in
identifiers listed in crate::ids::source_ids so operators
reading logs can tell which source a probe came from.
Implementations§
Source§impl SourceKind
impl SourceKind
Sourcepub const fn custom(label: &'static str) -> Self
pub const fn custom(label: &'static str) -> Self
Construct a SourceKind::Custom from a static string label.
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
Short, stable, lowercase name suitable for logs and telemetry.
Sourcepub fn from_id(id: &str) -> Option<Self>
pub fn from_id(id: &str) -> Option<Self>
Inverse of SourceKind::as_str for the built-in identifiers.
Returns Some(kind) when id matches one of the stable
strings returned by as_str for a non-Custom variant,
None otherwise. SourceKind::Custom intentionally never
round-trips through this — a runtime string cannot safely
become a &'static str.
Trait Implementations§
Source§impl Clone for SourceKind
impl Clone for SourceKind
Source§fn clone(&self) -> SourceKind
fn clone(&self) -> SourceKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more