File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ sinsp_threadinfo::sinsp_threadinfo(const std::shared_ptr<ctor_params>& params):
4444 m_main_fdtable (m_fdtable.table_ptr()),
4545 m_args_table_adapter(" args" , m_args),
4646 m_env_table_adapter(" env" , m_env),
47- m_cgroups_table_adapter(" cgroups" , m_cgroups) {
47+ m_cgroups_table_adapter(" cgroups" , m_cgroups),
48+ m_container_id_accessor(params->thread_manager->get_field_accessor (
49+ sinsp_thread_manager::s_container_id_field_name)) {
4850 init ();
4951}
5052
@@ -408,13 +410,11 @@ std::string sinsp_threadinfo::get_exepath() const {
408410}
409411
410412std::string sinsp_threadinfo::get_container_id () {
411- std::string container_id;
412-
413- const auto accessor = m_params->thread_manager ->get_field_accessor (
414- sinsp_thread_manager::s_container_id_field_name);
415- if (accessor) {
416- get_dynamic_field (*accessor, container_id);
413+ if (!m_container_id_accessor) {
414+ return {};
417415 }
416+ std::string container_id;
417+ get_dynamic_field (*m_container_id_accessor, container_id);
418418 return container_id;
419419}
420420
Original file line number Diff line number Diff line change @@ -671,6 +671,8 @@ class SINSP_PUBLIC sinsp_threadinfo : public libsinsp::state::table_entry {
671671 decltype (m_cgroups),
672672 libsinsp::state::pair_table_entry_adapter<std::string, std::string>>
673673 m_cgroups_table_adapter;
674+
675+ const libsinsp::state::dynamic_struct::field_accessor<std::string>* m_container_id_accessor;
674676};
675677
676678/* @}*/
You can’t perform that action at this time.
0 commit comments