Skip to content

Commit 84f7a05

Browse files
authored
added tracking for profile providers (#3545)
1 parent 596bae3 commit 84f7a05

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/aws-cpp-sdk-core/include/aws/core/client/UserAgent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ enum class UserAgentFeature {
3838
CREDENTIALS_IMDS,
3939
CREDENTIALS_STS_ASSUME_ROLE,
4040
CREDENTIALS_HTTP,
41+
CREDENTIALS_PROFILE_SOURCE_PROFILE,
4142
};
4243

4344
class AWS_CORE_API UserAgent {

src/aws-cpp-sdk-core/source/client/UserAgent.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const std::pair<UserAgentFeature, const char*> BUSINESS_METRIC_MAPPING[] = {
4848
{UserAgentFeature::CREDENTIALS_IMDS, "0"},
4949
{UserAgentFeature::CREDENTIALS_STS_ASSUME_ROLE, "i"},
5050
{UserAgentFeature::CREDENTIALS_HTTP, "z"},
51+
{UserAgentFeature::CREDENTIALS_PROFILE_SOURCE_PROFILE, "p"},
5152
};
5253

5354
const std::pair<const char*, UserAgentFeature> RETRY_FEATURE_MAPPING[] = {

src/aws-cpp-sdk-identity-management/source/auth/STSProfileCredentialsProvider.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,12 @@ void STSProfileCredentialsProvider::Reload()
295295

296296
// get the role arn from the profile at the top of the stack (which hasn't been popped out yet)
297297
const auto arn = sourceProfiles.back()->second.GetRoleArn();
298-
const auto& assumedCreds = GetCredentialsFromSTS(stsCreds, arn);
298+
auto assumedCreds = GetCredentialsFromSTS(stsCreds, arn);
299+
300+
if (!assumedCreds.IsEmpty()) {
301+
assumedCreds.AddUserAgentFeature(Aws::Client::UserAgentFeature::CREDENTIALS_PROFILE_SOURCE_PROFILE);
302+
}
303+
299304
sourceProfiles.back()->second.SetCredentials(assumedCreds);
300305
}
301306

0 commit comments

Comments
 (0)