33#include < cassert>
44#include < cstdint>
55#include < fstream>
6- #include < iostream>
7- #include < memory>
86#include < regex>
97
108// clang-format off
4644#endif
4745// clang-format on
4846
49- #include < datadog/logger.h>
50-
5147namespace datadog {
5248namespace tracing {
5349namespace {
@@ -330,17 +326,13 @@ bool is_running_in_host_namespace() {
330326 return false ;
331327}
332328
333- Optional<Cgroup> get_cgroup_version (const std::shared_ptr<tracing::Logger>& logger ) {
329+ Optional<Cgroup> get_cgroup_version () {
334330 struct statfs buf;
335331
336332 if (statfs (" /sys/fs/cgroup" , &buf) != 0 ) {
337- logger->log_error (" Failed to statfs /sys/fs/cgroup" );
338333 return nullopt ;
339334 }
340335
341- logger->log_error ([&](auto & stream) {
342- stream << " statfs /sys/fs/cgroup: f_type = " << buf.f_type ;
343- });
344336 if (buf.f_type == CGROUP_SUPER_MAGIC || buf.f_type == TMPFS_MAGIC)
345337 return Cgroup::v1;
346338 else if (buf.f_type == CGROUP2_SUPER_MAGIC)
@@ -351,9 +343,7 @@ Optional<Cgroup> get_cgroup_version(const std::shared_ptr<tracing::Logger>& logg
351343
352344Optional<std::string> find_container_id_from_cgroup () {
353345 auto cgroup_fd = std::ifstream (" /proc/self/cgroup" , std::ios::in);
354- if (!cgroup_fd.is_open ()) {
355- return nullopt ;
356- }
346+ if (!cgroup_fd.is_open ()) return nullopt ;
357347
358348 return find_container_id (cgroup_fd);
359349}
@@ -386,12 +376,11 @@ Optional<std::string> find_container_id(std::istream& source) {
386376 return nullopt ;
387377}
388378
389- Optional<ContainerID> get_id (const std::shared_ptr<tracing::Logger>& logger ) {
379+ Optional<ContainerID> get_id () {
390380#if defined(__linux__) || defined(__unix__)
391- auto maybe_cgroup = get_cgroup_version (logger );
381+ auto maybe_cgroup = get_cgroup_version ();
392382 if (!maybe_cgroup) return nullopt ;
393383
394- // Determine the container ID or inode
395384 ContainerID id;
396385 switch (*maybe_cgroup) {
397386 case Cgroup::v1: {
0 commit comments