Skip to content

Commit

Permalink
Add additional logging for Azure repository stats (#12079)
Browse files Browse the repository at this point in the history
* Adding logging for AzureStats

Signed-off-by: Sarat Vemulapalli <[email protected]>

* Debugging

Signed-off-by: Sarat Vemulapalli <[email protected]>

* Removing debugging lines

Signed-off-by: Sarat Vemulapalli <[email protected]>

* Addressing comments

Signed-off-by: Sarat Vemulapalli <[email protected]>

* Addressing feedback 2

Signed-off-by: Sarat Vemulapalli <[email protected]>

---------

Signed-off-by: Sarat Vemulapalli <[email protected]>
Signed-off-by: Sarat Vemulapalli <[email protected]>
(cherry picked from commit 16c5257)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jan 31, 2024
1 parent b5820f5 commit be1384d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 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 /[^?/]+/[^?/]+\\??.*");

Expand All @@ -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)) {
Expand Down

0 comments on commit be1384d

Please sign in to comment.