This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new aa564a9b9e GH-49169: [C++] Add ApplicationId to AzureFileSystem for
SDK calls (#49301)
aa564a9b9e is described below
commit aa564a9b9eb544efa3b3132a5c70543bbfadf44e
Author: Nate Prewitt <[email protected]>
AuthorDate: Tue Feb 17 19:47:35 2026 -0700
GH-49169: [C++] Add ApplicationId to AzureFileSystem for SDK calls (#49301)
### Rationale for this change
After discussion in #49169, this PR will add a unique identifier to the
AzureFileSystem implementation to distinguish calls from the base Azure C++ SDK.
### What changes are included in this PR?
This PR adds `azpartner-arrow/{verion}` as the ApplicationId used by
AzureFileSystem.
### Are these changes tested?
The change has been manually validated. I'm happy to add a test for its
persistence, but I wasn't sure what level you'd like to see in Arrow. This is
effectively just plumbing a string to the SDK. The ApplicationId functionality
is validated in the SDK test suite.
### Are there any user-facing changes?
This shouldn't be user facing. Only a user-agent update for the underlying
SDK.
* GitHub Issue: #49169
Lead-authored-by: Nate Prewitt <[email protected]>
Co-authored-by: Nate Prewitt <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/src/arrow/filesystem/azurefs.cc | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/cpp/src/arrow/filesystem/azurefs.cc
b/cpp/src/arrow/filesystem/azurefs.cc
index e47be63a4c..7aa3e58c1d 100644
--- a/cpp/src/arrow/filesystem/azurefs.cc
+++ b/cpp/src/arrow/filesystem/azurefs.cc
@@ -38,6 +38,7 @@
#include <azure/storage/files/datalake.hpp>
#include "arrow/buffer.h"
+#include "arrow/config.h"
#include "arrow/filesystem/path_util.h"
#include "arrow/filesystem/util_internal.h"
#include "arrow/io/util_internal.h"
@@ -303,6 +304,10 @@ Status ExceptionToStatus(const
Azure::Core::RequestFailedException& exception,
return Status::IOError(std::forward<PrefixArgs>(prefix_args)..., " Azure
Error: [",
exception.ErrorCode, "] ", exception.what());
}
+
+std::string BuildApplicationId() {
+ return "azpartner-arrow/" + GetBuildInfo().version_string;
+}
} // namespace
std::string AzureOptions::AccountBlobUrl(const std::string& account_name)
const {
@@ -386,9 +391,12 @@ Result<std::unique_ptr<Blobs::BlobServiceClient>>
AzureOptions::MakeBlobServiceC
return Status::Invalid("AzureOptions::blob_storage_scheme must be http or
https: ",
blob_storage_scheme);
}
+ Blobs::BlobClientOptions client_options;
+ client_options.Telemetry.ApplicationId = BuildApplicationId();
switch (credential_kind_) {
case CredentialKind::kAnonymous:
- return
std::make_unique<Blobs::BlobServiceClient>(AccountBlobUrl(account_name));
+ return
std::make_unique<Blobs::BlobServiceClient>(AccountBlobUrl(account_name),
+ client_options);
case CredentialKind::kDefault:
if (!token_credential_) {
token_credential_ =
std::make_shared<Azure::Identity::DefaultAzureCredential>();
@@ -399,14 +407,14 @@ Result<std::unique_ptr<Blobs::BlobServiceClient>>
AzureOptions::MakeBlobServiceC
case CredentialKind::kCLI:
case CredentialKind::kWorkloadIdentity:
case CredentialKind::kEnvironment:
- return
std::make_unique<Blobs::BlobServiceClient>(AccountBlobUrl(account_name),
- token_credential_);
+ return std::make_unique<Blobs::BlobServiceClient>(
+ AccountBlobUrl(account_name), token_credential_, client_options);
case CredentialKind::kStorageSharedKey:
- return
std::make_unique<Blobs::BlobServiceClient>(AccountBlobUrl(account_name),
-
storage_shared_key_credential_);
+ return std::make_unique<Blobs::BlobServiceClient>(
+ AccountBlobUrl(account_name), storage_shared_key_credential_,
client_options);
case CredentialKind::kSASToken:
- return
std::make_unique<Blobs::BlobServiceClient>(AccountBlobUrl(account_name) +
- sas_token_);
+ return std::make_unique<Blobs::BlobServiceClient>(
+ AccountBlobUrl(account_name) + sas_token_, client_options);
}
return Status::Invalid("AzureOptions doesn't contain a valid auth
configuration");
}
@@ -420,10 +428,12 @@ AzureOptions::MakeDataLakeServiceClient() const {
return Status::Invalid("AzureOptions::dfs_storage_scheme must be http or
https: ",
dfs_storage_scheme);
}
+ DataLake::DataLakeClientOptions client_options;
+ client_options.Telemetry.ApplicationId = BuildApplicationId();
switch (credential_kind_) {
case CredentialKind::kAnonymous:
return std::make_unique<DataLake::DataLakeServiceClient>(
- AccountDfsUrl(account_name));
+ AccountDfsUrl(account_name), client_options);
case CredentialKind::kDefault:
if (!token_credential_) {
token_credential_ =
std::make_shared<Azure::Identity::DefaultAzureCredential>();
@@ -435,13 +445,13 @@ AzureOptions::MakeDataLakeServiceClient() const {
case CredentialKind::kWorkloadIdentity:
case CredentialKind::kEnvironment:
return std::make_unique<DataLake::DataLakeServiceClient>(
- AccountDfsUrl(account_name), token_credential_);
+ AccountDfsUrl(account_name), token_credential_, client_options);
case CredentialKind::kStorageSharedKey:
return std::make_unique<DataLake::DataLakeServiceClient>(
- AccountDfsUrl(account_name), storage_shared_key_credential_);
+ AccountDfsUrl(account_name), storage_shared_key_credential_,
client_options);
case CredentialKind::kSASToken:
return std::make_unique<DataLake::DataLakeServiceClient>(
- AccountBlobUrl(account_name) + sas_token_);
+ AccountBlobUrl(account_name) + sas_token_, client_options);
}
return Status::Invalid("AzureOptions doesn't contain a valid auth
configuration");
}