From 77a4ba4925022f7ade715d0ceb011e8498ac3659 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 10 Aug 2023 02:48:52 +0300 Subject: [PATCH] Detect Docker when using control group v2 --- src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs | 4 +++- src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs index bb94ec267..b9f560b51 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs @@ -77,7 +77,9 @@ namespace NzbDrone.Common.EnvironmentInfo FullName = Name; } - if (IsLinux && File.Exists("/proc/1/cgroup") && File.ReadAllText("/proc/1/cgroup").Contains("/docker/")) + if (IsLinux && + ((File.Exists("/proc/1/cgroup") && File.ReadAllText("/proc/1/cgroup").Contains("/docker/")) || + (File.Exists("/proc/1/mountinfo") && File.ReadAllText("/proc/1/mountinfo").Contains("/docker/")))) { IsDocker = true; } diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index 5ebb3ca8c..886063f30 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -145,6 +145,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry { SentrySdk.ConfigureScope(scope => { + scope.SetTag("is_docker", $"{osInfo.IsDocker}"); }); }