From 6473dcfa6852d371405f50ddab8eb2bf81ba6156 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 29 Jan 2024 13:45:55 -0800 Subject: [PATCH 1/5] Adding logging for AzureStats Signed-off-by: Sarat Vemulapalli --- .../repositories/azure/AzureBlobStoreRepositoryTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java b/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java index 986720ec431fe..e79d75453b375 100644 --- a/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java +++ b/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java @@ -39,6 +39,8 @@ import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.RetryPolicyType; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.opensearch.common.SuppressForbidden; import org.opensearch.common.regex.Regex; import org.opensearch.common.settings.MockSecureSettings; @@ -188,6 +190,7 @@ protected String requestUniqueId(final HttpExchange exchange) { @SuppressForbidden(reason = "this test uses a HttpServer to emulate an Azure endpoint") private static class AzureHTTPStatsCollectorHandler extends HttpStatsCollectorHandler { + private final Logger testLogger = LogManager.getLogger("AzureStatsLogger"); private static final Pattern listPattern = Pattern.compile("GET /[a-zA-Z0-9]+\\??.+"); private static final Pattern getPattern = Pattern.compile("GET /[^?/]+/[^?/]+\\??.*"); @@ -197,6 +200,7 @@ private AzureHTTPStatsCollectorHandler(HttpHandler delegate) { @Override protected void maybeTrack(String request, Headers headers) { + testLogger.info(request, headers); if (getPattern.matcher(request).matches()) { trackRequest("GetBlob"); } else if (Regex.simpleMatch("HEAD /*/*", request)) { From 476df65b00e65d7a263c73b02597c4d82df23f2f Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 29 Jan 2024 13:53:53 -0800 Subject: [PATCH 2/5] Debugging Signed-off-by: Sarat Vemulapalli --- .../blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java b/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java index faa9d52b105b2..b1e42becb8cae 100644 --- a/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java @@ -236,6 +236,7 @@ public void testRequestStats() throws Exception { String assertionErrorMsg = String.format("SDK sent [%s] calls and handler measured [%s] calls", sdkRequestCounts, mockCalls); assertEquals(assertionErrorMsg, mockCalls, sdkRequestCounts); + fail(); } protected Map getMockRequestCounts() { From 76796017b62ada03480dc0d9be03238d0da3ac92 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Mon, 29 Jan 2024 14:26:11 -0800 Subject: [PATCH 3/5] Removing debugging lines Signed-off-by: Sarat Vemulapalli --- .../blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java b/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java index b1e42becb8cae..faa9d52b105b2 100644 --- a/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchMockAPIBasedRepositoryIntegTestCase.java @@ -236,7 +236,6 @@ public void testRequestStats() throws Exception { String assertionErrorMsg = String.format("SDK sent [%s] calls and handler measured [%s] calls", sdkRequestCounts, mockCalls); assertEquals(assertionErrorMsg, mockCalls, sdkRequestCounts); - fail(); } protected Map getMockRequestCounts() { From 1f132383583fdbff49893c7f10237249a3e2a9e0 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Tue, 30 Jan 2024 12:04:43 -0800 Subject: [PATCH 4/5] Addressing comments Signed-off-by: Sarat Vemulapalli --- .../repositories/azure/AzureBlobStoreRepositoryTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java b/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java index e79d75453b375..4a9bee15193bf 100644 --- a/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java +++ b/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java @@ -190,7 +190,7 @@ protected String requestUniqueId(final HttpExchange exchange) { @SuppressForbidden(reason = "this test uses a HttpServer to emulate an Azure endpoint") private static class AzureHTTPStatsCollectorHandler extends HttpStatsCollectorHandler { - private final Logger testLogger = LogManager.getLogger("AzureStatsLogger"); + private static final Logger testLogger = LogManager.getLogger("AzureHTTPStatsCollectorHandler"); private static final Pattern listPattern = Pattern.compile("GET /[a-zA-Z0-9]+\\??.+"); private static final Pattern getPattern = Pattern.compile("GET /[^?/]+/[^?/]+\\??.*"); From e71f7e822e2df007c02e0b0018e1f03c7daf5d41 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Wed, 31 Jan 2024 12:01:54 -0800 Subject: [PATCH 5/5] Addressing feedback 2 Signed-off-by: Sarat Vemulapalli --- .../repositories/azure/AzureBlobStoreRepositoryTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java b/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java index 4a9bee15193bf..1ba16422c9214 100644 --- a/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java +++ b/plugins/repository-azure/src/internalClusterTest/java/org/opensearch/repositories/azure/AzureBlobStoreRepositoryTests.java @@ -190,7 +190,7 @@ protected String requestUniqueId(final HttpExchange exchange) { @SuppressForbidden(reason = "this test uses a HttpServer to emulate an Azure endpoint") private static class AzureHTTPStatsCollectorHandler extends HttpStatsCollectorHandler { - private static final Logger testLogger = LogManager.getLogger("AzureHTTPStatsCollectorHandler"); + private static final Logger testLogger = LogManager.getLogger(AzureHTTPStatsCollectorHandler.class); private static final Pattern listPattern = Pattern.compile("GET /[a-zA-Z0-9]+\\??.+"); private static final Pattern getPattern = Pattern.compile("GET /[^?/]+/[^?/]+\\??.*");