Skip to content

Commit 708eeeb

Browse files
authored
Adding additional logging (#96)
1 parent 2cd5c53 commit 708eeeb

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

include/aws/s3/s3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum aws_s3_errors {
3131
enum aws_s3_subject {
3232
AWS_LS_S3_GENERAL = AWS_LOG_SUBJECT_BEGIN_RANGE(AWS_C_S3_PACKAGE_ID),
3333
AWS_LS_S3_CLIENT,
34+
AWS_LS_S3_CLIENT_STATS,
3435
AWS_LS_S3_REQUEST,
3536
AWS_LS_S3_META_REQUEST,
3637
AWS_LS_S3_VIP,

source/s3.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ static struct aws_error_info_list s_error_list = {
3636
static struct aws_log_subject_info s_s3_log_subject_infos[] = {
3737
DEFINE_LOG_SUBJECT_INFO(AWS_LS_S3_GENERAL, "S3General", "Subject for aws-c-s3 logging that defies categorization."),
3838
DEFINE_LOG_SUBJECT_INFO(AWS_LS_S3_CLIENT, "S3Client", "Subject for aws-c-s3 logging from an aws_s3_client."),
39+
DEFINE_LOG_SUBJECT_INFO(
40+
AWS_LS_S3_CLIENT_STATS,
41+
"S3ClientStats",
42+
"Subject for aws-c-s3 logging for stats tracked by an aws_s3_client."),
3943
DEFINE_LOG_SUBJECT_INFO(AWS_LS_S3_REQUEST, "S3Request", "Subject for aws-c-s3 logging from an aws_s3_request."),
4044
DEFINE_LOG_SUBJECT_INFO(
4145
AWS_LS_S3_META_REQUEST,

source/s3_client.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ struct aws_s3_meta_request_work {
3838
struct aws_s3_meta_request *meta_request;
3939
};
4040

41-
static const bool s_log_client_stats = false;
4241
static const enum aws_log_level s_log_level_client_stats = AWS_LL_INFO;
4342

4443
static const uint32_t s_s3_max_request_count_per_connection = 100;
@@ -1200,6 +1199,10 @@ static void s_s3_client_process_work_default(struct aws_s3_client *client) {
12001199
/*******************/
12011200
/* Step 1: Move everything into thread local memory. */
12021201
/*******************/
1202+
AWS_LOGF_DEBUG(
1203+
AWS_LS_S3_CLIENT,
1204+
"id=%p s_s3_client_process_work_default - Moving relevant synced_data into threaded_data.",
1205+
(void *)client);
12031206
aws_s3_client_lock_synced_data(client);
12041207

12051208
client_active = client->synced_data.active != 0;
@@ -1222,6 +1225,9 @@ static void s_s3_client_process_work_default(struct aws_s3_client *client) {
12221225
/*******************/
12231226
/* Step 2: Process any meta request work. */
12241227
/*******************/
1228+
AWS_LOGF_DEBUG(
1229+
AWS_LS_S3_CLIENT, "id=%p s_s3_client_process_work_default - Processing any new meta requests.", (void *)client);
1230+
12251231
while (!aws_linked_list_empty(&meta_request_work_list)) {
12261232
struct aws_linked_list_node *node = aws_linked_list_pop_back(&meta_request_work_list);
12271233
struct aws_s3_meta_request_work *meta_request_work =
@@ -1248,6 +1254,11 @@ static void s_s3_client_process_work_default(struct aws_s3_client *client) {
12481254
/* If we have an invalid endpoint, then finish up all of the meta requests. */
12491255
/* TODO once we have multiple bucket support, this will should only stop meta requests attached to bad endpoints. */
12501256
if (invalid_endpoint) {
1257+
AWS_LOGF_DEBUG(
1258+
AWS_LS_S3_CLIENT,
1259+
"id=%p s_s3_client_process_work_default - Updating meta requests with 'no-endpoint-connections' flag.",
1260+
(void *)client);
1261+
12511262
while (!aws_linked_list_empty(&client->threaded_data.meta_requests)) {
12521263
struct aws_linked_list_node *node = aws_linked_list_begin(&client->threaded_data.meta_requests);
12531264
struct aws_s3_meta_request *meta_request =
@@ -1273,14 +1284,22 @@ static void s_s3_client_process_work_default(struct aws_s3_client *client) {
12731284
/* We first assign requests to connections with the "conservative" flag. This will tell each meta request that
12741285
* connections can still potentially be shared between meta requests. (ie: an individual meta request shouldn't
12751286
* necessarily try to issue as many requests as it can, unless it's known that that won't impact performance.) */
1287+
AWS_LOGF_DEBUG(
1288+
AWS_LS_S3_CLIENT,
1289+
"id=%p s_s3_client_process_work_default - Updating meta requests and connections with 'conservative' flag.",
1290+
(void *)client);
12761291
s_s3_client_assign_requests_to_connections_threaded(
12771292
client, client_active, AWS_S3_META_REQUEST_UPDATE_FLAG_CONSERVATIVE);
12781293

12791294
/* If we still have connections left over, then don't pass any flags, indicating to meta requests that any logic for
12801295
* better sharing connections between meta requests can now be ignored. */
1296+
AWS_LOGF_DEBUG(
1297+
AWS_LS_S3_CLIENT,
1298+
"id=%p s_s3_client_process_work_default - Updating meta requests and connections without 'conservative' flag.",
1299+
(void *)client);
12811300
s_s3_client_assign_requests_to_connections_threaded(client, client_active, 0);
12821301

1283-
if (s_log_client_stats) {
1302+
{
12841303
uint32_t num_idle_connections = 0;
12851304

12861305
for (struct aws_linked_list_node *node = aws_linked_list_begin(&client->threaded_data.idle_vip_connections);
@@ -1300,9 +1319,9 @@ static void s_s3_client_process_work_default(struct aws_s3_client *client) {
13001319

13011320
AWS_LOGF(
13021321
s_log_level_client_stats,
1303-
AWS_LS_S3_CLIENT,
1304-
"CLIENT-STATS-LOGGING Requests-in-flight(approx/exact):%d/%d Requests-network:%d Requests-waiting:%d "
1305-
"Requests-streaming:%d Idle-connections:%d Allocated-connections:%d Active-connections:%d",
1322+
AWS_LS_S3_CLIENT_STATS,
1323+
"Requests-in-flight(approx/exact):%d/%d Requests-network:%d Requests-waiting:%d Requests-streaming:%d "
1324+
"Idle-connections:%d Allocated-connections:%d Active-connections:%d",
13061325
total_approx_requests,
13071326
client->threaded_data.num_requests_in_flight,
13081327
num_requests_network_io,

0 commit comments

Comments
 (0)