diff --git a/src/Agent/NewRelic/Agent/Core/Utilization/VendorInfo.cs b/src/Agent/NewRelic/Agent/Core/Utilization/VendorInfo.cs index bbeaab814..5326f19e5 100644 --- a/src/Agent/NewRelic/Agent/Core/Utilization/VendorInfo.cs +++ b/src/Agent/NewRelic/Agent/Core/Utilization/VendorInfo.cs @@ -24,8 +24,7 @@ public class VendorInfo { private const string ValidateMetadataRegex = @"^[a-zA-Z0-9-_. /]*$"; #if NETSTANDARD2_0 - private const string ContainerIdV1Regex = @".*:cpu:/docker/([0-9a-f]{64}).*"; - private const string ContainerIdV1FallbackRegex = @"([0-9a-f]{64})"; // This is the old regex that just looks for any 64-char hexadecimal string + private const string ContainerIdV1Regex = @".*cpu.*([0-9a-f]{64})"; private const string ContainerIdV2Regex = ".*/docker/containers/([0-9a-f]{64})/.*"; #endif @@ -321,11 +320,6 @@ private IVendorModel TryGetDockerCGroupV1(string fileContent) { return new DockerVendorModel(id); } - matches = Regex.Matches(fileContent, ContainerIdV1FallbackRegex); - if (TryGetIdFromRegexMatch(matches, out id)) - { - return new DockerVendorModel(id); - } return null; } diff --git a/tests/Agent/UnitTests/Core.UnitTest/Utilization/VendorInfoTests.cs b/tests/Agent/UnitTests/Core.UnitTest/Utilization/VendorInfoTests.cs index 8a56adbd3..0cf2dd82e 100644 --- a/tests/Agent/UnitTests/Core.UnitTest/Utilization/VendorInfoTests.cs +++ b/tests/Agent/UnitTests/Core.UnitTest/Utilization/VendorInfoTests.cs @@ -373,8 +373,9 @@ public void GetVendors_GetDockerVendorInfo_ParsesV1_IfV2LookupFailsToParseFile() } // See https://new-relic.atlassian.net/browse/NR-221128 and https://new-relic.atlassian.net/browse/NR-230908 + // The sample files below are from a customer issue where the cgroup file was not being parsed correctly [Test] - public void GetVendors_GetDockerVendorInfo_ParsesV1WithFallback_IfCpuMissing() + public void GetVendors_GetDockerVendorInfo_ParsesV1_ForCustomerIssue() { var vendorInfo = new VendorInfo(_configuration, _agentHealthReporter, _environment, _vendorHttpApiRequestor); var mockFileReaderWrapper = Mock.Create();