In cgroup we get all the docker container memory stats from the below API.
example : curl -X GET "http://172.16.0.1:2375/v1.24/containers/<container_name>/stats?stream=0
{'usage': 447074304,
'max_usage': 460214272,
'stats': {'active_anon': 129630208,
'active_file': 130027520,
'cache': 257986560,
'dirty': 0,
'hierarchical_memory_limit': 9223372036854771712,
'hierarchical_memsw_limit': 9223372036854771712,
'inactive_anon': 50491392,
'inactive_file': 127221760,
'mapped_file': 107593728,
'pgfault': 992112,
'pgmajfault': 99,
'pgpgin': 1029171,
'pgpgout': 953253,
'rss': 180805632,
'rss_huge': 127926272,
'shmem': 0,
'swap': 0,
'total_active_anon': 129630208,
'total_active_file': 130027520,
'total_cache': 257986560,
'total_dirty': 0,
'total_inactive_anon': 50491392,
'total_inactive_file': 127221760,
'total_mapped_file': 107593728,
'total_pgfault': 992112,
'total_pgmajfault': 99,
'total_pgpgin': 1029171,
'total_pgpgout': 953253,
'total_rss': 180805632,
'total_rss_huge': 127926272,
'total_shmem': 0,
'total_swap': 0,
'total_unevictable': 0,
'total_writeback': 0,
'unevictable': 0,
'writeback': 0},
'failcnt': 0,
'limit': 83795795968}
I am looking for the same info in cgroup2 but I found that cgroup2 does not have all the information regarding the memory
{'usage': 609529856,
'stats': {'active_anon': 102400,
'active_file': 37502976,
'anon': 321716224,
'anon_thp': 77594624,
'file': 260096000,
'file_dirty': 0,
'file_mapped': 107474944,
'file_writeback': 0,
'inactive_anon': 329601024,
'inactive_file': 221347840,
'kernel_stack': 540672,
'pgactivate': 7270,
'pgdeactivate': 0,
'pgfault': 439225,
'pglazyfree': 0,
'pglazyfreed': 0,
'pgmajfault': 91,
'pgrefill': 0,
'pgscan': 0,
'pgsteal': 0,
'shmem': 1245184,
'slab': 18472688,
'slab_reclaimable': 17250928,
'slab_unreclaimable': 1221760,
'sock': 8192,
'thp_collapse_alloc': 0,
'thp_fault_alloc': 76,
'unevictable': 0,
'workingset_activate': 0,
'workingset_nodereclaim': 0,
'workingset_refault': 0},
'limit': 67113873408}
Is there any API present to get all the info coming as part of the default cgroup.