saxenapranav commented on code in PR #6314:
URL: https://github.com/apache/hadoop/pull/6314#discussion_r1526162116
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsRestOperation.java:
##########
@@ -487,26 +491,39 @@ private boolean executeHttpOperation(final int retryCount,
*/
@VisibleForTesting
public void signRequest(final AbfsHttpOperation httpOperation, int
bytesToSign) throws IOException {
- switch(client.getAuthType()) {
- case Custom:
- case OAuth:
- LOG.debug("Authenticating request with OAuth2 access token");
-
httpOperation.getConnection().setRequestProperty(HttpHeaderConfigurations.AUTHORIZATION,
- client.getAccessToken());
- break;
- case SAS:
- // do nothing; the SAS token should already be appended to the query
string
- httpOperation.setMaskForSAS(); //mask sig/oid from url for logs
- break;
- case SharedKey:
- default:
- // sign the HTTP request
- LOG.debug("Signing request with shared key");
- // sign the HTTP request
- client.getSharedKeyCredentials().signRequest(
- httpOperation.getConnection(),
- bytesToSign);
- break;
+ if (client.isSendMetricCall()) {
+ AbfsConfiguration abfsConfiguration = client.getAbfsConfiguration();
+ String metricAccountName = abfsConfiguration.getMetricAccount();
+ int dotIndex = metricAccountName.indexOf(AbfsHttpConstants.DOT);
+ if (dotIndex <= 0) {
+ throw new InvalidUriException(
+ metricAccountName + " - account name is not fully qualified.");
+ }
+ String metricAccountKey = abfsConfiguration.getMetricAccountKey();
+ SharedKeyCredentials sharedKeyCredentials = new
SharedKeyCredentials(metricAccountName.substring(0, dotIndex),
metricAccountKey);
Review Comment:
Can we move it to the constructor of abfsClient, and then expose a method:
getMetricSharedKeyCredentials().
Reason for this comment, SharedKeyCredentials constructor lead to hmac
calculation, which is something which does not need reInit and can be reused.
Configs looks good though!
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java:
##########
@@ -1693,6 +1734,106 @@ protected AccessTokenProvider getTokenProvider() {
return tokenProvider;
}
+ /**
+ * Retrieves a TracingContext object configured for metric tracking.
+ * This method creates a TracingContext object with the validated client
correlation ID,
+ * the host name of the local machine (or "UnknownHost" if unable to
determine),
+ * the file system operation type set to GET_ATTR, and additional
configuration parameters
+ * for metric tracking.
+ * The TracingContext is intended for use in tracking metrics related to
Azure Blob FileSystem (ABFS) operations.
+ *
+ * @return A TracingContext object configured for metric tracking.
+ */
+ private TracingContext getMetricTracingContext() {
+ String hostName;
+ try {
+ hostName = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ hostName = "UnknownHost";
+ }
+ return new TracingContext(TracingContext.validateClientCorrelationID(
+ abfsConfiguration.getClientCorrelationId()),
+ hostName, FSOperationType.GET_ATTR, true,
+ abfsConfiguration.getTracingHeaderFormat(),
+ null, abfsCounters.toString());
+ }
+
+ /**
+ * Synchronized method to suspend or resume timer.
+ * @param timerFunctionality resume or suspend.
+ * @param timerTask The timertask object.
+ * @return true or false.
+ */
+ synchronized boolean timerOrchestrator(TimerFunctionality timerFunctionality,
+ TimerTask timerTask) {
+ this.runningTimerTask = timerTask;
Review Comment:
taken.
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java:
##########
@@ -208,6 +240,8 @@ public AbfsClient(final URL baseUrl, final
SharedKeyCredentials sharedKeyCredent
@Override
public void close() throws IOException {
+ runningTimerTask.cancel();
Review Comment:
taken.
##########
hadoop-tools/hadoop-azure/src/site/markdown/abfs.md:
##########
@@ -12,14 +12,14 @@
limitations under the License. See accompanying LICENSE file.
-->
-# Hadoop Azure Support: ABFS — Azure Data Lake Storage Gen2
+# Hadoop Azure Support: ABFS — Azure Data Lake Storage Gen2
Review Comment:
Lets decrease the git diff. Looks like some formatting has happened.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]