flatten_cgroup_path

Function flatten_cgroup_path 

Source
pub fn flatten_cgroup_path(path: &str, patterns: &[Pattern]) -> String
Expand description

Collapse dynamic segments of a cgroup path per every pattern in patterns. A pattern is a glob matched with glob’s default MatchOptions (require_literal_separator = false), so * is NOT segment-bounded — it matches across / just like **. The literal portions are preserved and the wildcard portions are replaced with the wildcard token itself. Example: pattern /kubepods/*/workload applied to /kubepods/pod-abc/workload produces /kubepods/*/workload, so two runs with different pod IDs collapse onto the same key.

Patterns are tried in listed order; the first match wins and subsequent patterns are not applied. A path that matches no pattern is returned verbatim.