diff --git a/src/cc/api/BPF.cc b/src/cc/api/BPF.cc index fe41474ee913..b6d095526969 100644 --- a/src/cc/api/BPF.cc +++ b/src/cc/api/BPF.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -854,34 +853,6 @@ bool BPF::add_module(std::string module) false : true; } -namespace { - -std::string random_alnum_string(const int len) { - static constexpr char kDict[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - static std::mt19937 gen; - static std::uniform_int_distribution dist(0, sizeof(kDict) - 2); - std::string res; - res.resize(len); - for (int i = 0; i < len; ++i) { - res[i] = kDict[dist(gen)]; - } - return res; -} - -constexpr size_t kEventNameSizeLimit = 224; - -std::string shorten_event_name(const std::string& name) { - constexpr size_t kRandomSuffixLen = 16; - std::string res; - res.reserve(kEventNameSizeLimit); - res.assign(name); - res.resize(kEventNameSizeLimit - kRandomSuffixLen); - res.append(random_alnum_string(kRandomSuffixLen)); - return res; -} - -} // namespace - std::string BPF::get_uprobe_event(const std::string& binary_path, uint64_t offset, bpf_probe_attach_type type, pid_t pid) { @@ -890,15 +861,6 @@ std::string BPF::get_uprobe_event(const std::string& binary_path, res += "_0x" + uint_to_hex(offset); if (pid != -1) res += "_" + std::to_string(pid); - if (res.size() > kEventNameSizeLimit) { - auto iter = name_map_.find(res); - if (iter != name_map_.end()) { - return iter->second; - } - std::string shortend_name = shorten_event_name(res); - name_map_[res] = shortend_name; - return shortend_name; - } return res; } diff --git a/src/cc/api/BPF.h b/src/cc/api/BPF.h index e90cda5e9751..00ec8e8cb529 100644 --- a/src/cc/api/BPF.h +++ b/src/cc/api/BPF.h @@ -341,9 +341,6 @@ class BPF { std::string all_bpf_program_; std::map kprobes_; - // For uprobes, if the binary path is longer than 250, we'll shorten them. And then keep the - // mapping. - std::map name_map_; std::map uprobes_; std::map tracepoints_; std::map raw_tracepoints_;