This is an automated email from the ASF dual-hosted git repository. anujmodi pushed a commit to branch branch-3.4 in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.4 by this push: new ca4858e1802 HADOOP-19575. ABFS: [FNSOverBlob] Add Distinct String In User Agent to Get Telemetry for FNS-Blob (#7713) (#7788) ca4858e1802 is described below commit ca4858e1802a4ef86cf913fba0931d765553d9af Author: manika137 <80244229+manika...@users.noreply.github.com> AuthorDate: Wed Jul 9 23:12:21 2025 -0700 HADOOP-19575. ABFS: [FNSOverBlob] Add Distinct String In User Agent to Get Telemetry for FNS-Blob (#7713) (#7788) Contributed by Manika Joshi. --- .../hadoop/fs/azurebfs/services/AbfsClient.java | 10 ++++++ .../fs/azurebfs/services/ITestAbfsClient.java | 37 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java index 9215fd0d80a..ce7dd0e244d 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java @@ -127,6 +127,7 @@ import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.SEMICOLON; import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.SINGLE_WHITE_SPACE; import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.UTF_8; +import static org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType.BLOB; import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_IDENTITY_TRANSFORM_CLASS; import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.DEFAULT_DELETE_CONSIDERED_IDEMPOTENT; import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB; @@ -152,6 +153,7 @@ public abstract class AbfsClient implements Closeable { public static final Logger LOG = LoggerFactory.getLogger(AbfsClient.class); public static final String HUNDRED_CONTINUE_USER_AGENT = SINGLE_WHITE_SPACE + HUNDRED_CONTINUE + SEMICOLON; public static final String ABFS_CLIENT_TIMER_THREAD_NAME = "abfs-timer-client"; + public static final String FNS_BLOB_USER_AGENT_IDENTIFIER = "FNS"; private final URL baseUrl; private final SharedKeyCredentials sharedKeyCredentials; @@ -1323,6 +1325,14 @@ String initializeUserAgent(final AbfsConfiguration abfsConfiguration, sb.append(FORWARD_SLASH); sb.append(abfsConfiguration.getClusterType()); + // Add a unique identifier in FNS-Blob user agent string + if (!getIsNamespaceEnabled() + && abfsConfiguration.getFsConfiguredServiceType() == BLOB) { + sb.append(SEMICOLON) + .append(SINGLE_WHITE_SPACE) + .append(FNS_BLOB_USER_AGENT_IDENTIFIER); + } + sb.append(")"); appendIfNotEmpty(sb, abfsConfiguration.getCustomUserAgentPrefix(), false); diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java index cba1643478f..9433fad2066 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsClient.java @@ -106,6 +106,7 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest { private static final String ACCOUNT_NAME = "bogusAccountName.dfs.core.windows.net"; private static final String FS_AZURE_USER_AGENT_PREFIX = "Partner Service"; + private static final String FNS_BLOB_USER_AGENT_IDENTIFIER = "FNS"; private static final String HUNDRED_CONTINUE_USER_AGENT = SINGLE_WHITE_SPACE + HUNDRED_CONTINUE + SEMICOLON; private static final String TEST_PATH = "/testfile"; public static final int REDUCED_RETRY_COUNT = 2; @@ -355,6 +356,42 @@ public void verifyUserAgentClusterType() throws Exception { .contains(DEFAULT_VALUE_UNKNOWN); } + @Test + // Test to verify the unique identifier in user agent string for FNS-Blob accounts + public void verifyUserAgentForFNSBlob() throws Exception { + assumeHnsDisabled(); + assumeBlobServiceType(); + final AzureBlobFileSystem fs = getFileSystem(); + final AbfsConfiguration configuration = fs.getAbfsStore() + .getAbfsConfiguration(); + + String userAgentStr = getUserAgentString(configuration, false); + verifyBasicInfo(userAgentStr); + Assertions.assertThat(userAgentStr) + .describedAs( + "User-Agent string for FNS accounts on Blob endpoint should contain " + + FNS_BLOB_USER_AGENT_IDENTIFIER) + .contains(FNS_BLOB_USER_AGENT_IDENTIFIER); + } + + @Test + // Test to verify that the user agent string for non-FNS-Blob accounts + // does not contain the FNS identifier. + public void verifyUserAgentForDFS() throws Exception { + assumeDfsServiceType(); + final AzureBlobFileSystem fs = getFileSystem(); + final AbfsConfiguration configuration = fs.getAbfsStore() + .getAbfsConfiguration(); + + String userAgentStr = getUserAgentString(configuration, false); + verifyBasicInfo(userAgentStr); + Assertions.assertThat(userAgentStr) + .describedAs( + "User-Agent string for non-FNS-Blob accounts should not contain" + + FNS_BLOB_USER_AGENT_IDENTIFIER) + .doesNotContain(FNS_BLOB_USER_AGENT_IDENTIFIER); + } + public static AbfsClient createTestClientFromCurrentContext( AbfsClient baseAbfsClientInstance, AbfsConfiguration abfsConfig) throws IOException, URISyntaxException { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org