DataDog / saluki

An experimental toolkit for building telemetry data planes in Rust.
Apache License 2.0
12 stars 2 forks source link

Add workload collector for querying containers by inode based on cgroupsv2 groups. #186

Closed tobz closed 3 weeks ago

tobz commented 1 month ago

Context

As part of fully supporting origin detection in DogStatsD, we need to be able to resolve the inode-based form of "container ID" used in the DogStatsD protocol -- |c:in-1234 -- into an actual container ID. This inode form represents the literal inode number of the cgroupsv2 group that the originating container is scoped to, which can be used to query the cgroupsv2 filesystem and recover the container ID.

We need a Linux-only collector that can scrape the cgroupsv2 hierarchy and extract a mapping of inodes to container ID. We only need the most simplistic data extraction here, purely to be able to push an ancestry link into the tag store. Likewise, we just need the simplest logic that gets us valid container IDs, and not just other arbitrary things using cgroups.

From a cursory search, the cgroupfs crate should be sufficient for our needs here.