Skip to content

Commit 3357c43

Browse files
committed
feat: Add environment credentials feature tracking to User-Agent
- Add CREDENTIALS_ENV_VARS enum to UserAgentFeature with metric ID 'g' - Track environment credentials usage in AWSClient::AttemptOneRequest - Check for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY presence - Implements env-credentials SEP specification for business metrics - Add unit test for environment credentials feature tracking Resolves environment credentials tracking for User-Agent 2.1 business metrics.
1 parent 7adebb6 commit 3357c43

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

tests/aws-cpp-sdk-monitoring-unit-tests/CloudWatchUnitTest.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,6 @@ class CloudWatchTest : public Aws::Testing::AwsCppSdkGTestSuite {
4646
}
4747
};
4848

49-
class ClientHolder {
50-
public:
51-
ClientHolder() : client(makeClient()) {
52-
// init client again
53-
client = makeClient();
54-
}
55-
56-
PutMetricDataOutcome Foo() {
57-
const auto response = client.PutMetricData(PutMetricDataRequest{});
58-
return response;
59-
}
60-
61-
const CloudWatchClient& getClient() { return client; }
62-
63-
CloudWatchClient&& moveClient() { return std::move(client); }
64-
65-
private:
66-
CloudWatchClient makeClient() {
67-
Aws::Client::ClientConfigurationInitValues cfgInit;
68-
cfgInit.shouldDisableIMDS = true;
69-
Aws::Client::ClientConfiguration clientConfig(cfgInit);
70-
clientConfig.region = Aws::Region::US_EAST_1;
71-
AWSCredentials credentials{"mock", "credentials"};
72-
return CloudWatchClient(credentials, clientConfig);
73-
}
74-
75-
CloudWatchClient client;
76-
};
77-
7849
TEST_F(CloudWatchTest, TestUserAgentCompressionTracking) {
7950
#if defined(ENABLED_ZLIB_REQUEST_COMPRESSION) && ENABLED_ZLIB_REQUEST_COMPRESSION == 1
8051
// Setup mock response with proper CloudWatch XML

tests/testing-resources/include/aws/testing/mocks/aws/client/MockAWSClient.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,6 @@ class AmazonWebServiceRequestMock : public Aws::AmazonWebServiceRequest
5454
auto bodyString = ss.str();
5555
return bodyString.find("TestErrorInBodyOfResponse") != std::string::npos;
5656
}
57-
58-
Aws::Client::CompressionAlgorithm GetSelectedCompressionAlgorithm(Aws::Client::RequestCompressionConfig config) const override {
59-
if (config.useRequestCompression == Aws::Client::UseRequestCompression::ENABLE && m_body) {
60-
m_body->seekg(0, m_body->end);
61-
std::streampos pos = m_body->tellg();
62-
m_body->seekg(0, m_body->beg);
63-
64-
if (pos != std::streampos(-1) && static_cast<size_t>(pos) >= config.requestMinCompressionSizeBytes) {
65-
// todo does hit in dry run?
66-
return Aws::Client::CompressionAlgorithm::GZIP;
67-
}
68-
}
69-
return Aws::Client::CompressionAlgorithm::NONE;
70-
}
7157

7258
private:
7359
std::shared_ptr<Aws::IOStream> m_body;

0 commit comments

Comments
 (0)