Function tikv_util::metrics::threads_linux::sanitize_thread_name[][src]

fn sanitize_thread_name(tid: pid_t, raw: &str) -> String

Sanitizes the thread name. Keeps a-zA-Z0-9_:, replaces - and with _, and drops the others.

Examples:

assert_eq!(sanitize_thread_name(0, "ok123"), "ok123");
assert_eq!(sanitize_thread_name(0, "Az_1"), "Az_1");
assert_eq!(sanitize_thread_name(0, "a-b"), "a_b");
assert_eq!(sanitize_thread_name(0, "a b"), "a_b");
assert_eq!(sanitize_thread_name(1, "@123"), "123");
assert_eq!(sanitize_thread_name(1, "@@@@"), "1");