@@ -40,18 +40,20 @@ struct aws_s3_request *aws_s3_request_new(
4040 request -> should_allocate_buffer_from_pool = (flags & AWS_S3_REQUEST_FLAG_ALLOCATE_BUFFER_FROM_POOL ) != 0 ;
4141 request -> always_send = (flags & AWS_S3_REQUEST_FLAG_ALWAYS_SEND ) != 0 ;
4242
43- request -> send_data .metrics = aws_s3_request_metrics_new (request -> allocator , request );
43+ request -> send_data .metrics = aws_s3_request_metrics_new (request -> allocator );
4444
4545 return request ;
4646}
4747
48- void s_populate_metrics_from_message (struct aws_s3_request_metrics * metrics , struct aws_http_message * message ) {
48+ void s_populate_metrics_from_message (struct aws_s3_request * request ,
49+ struct aws_http_message * message ) {
4950 struct aws_byte_cursor out_path ;
5051 AWS_ZERO_STRUCT (out_path );
5152 int err = aws_http_message_get_request_path (message , & out_path );
5253 /* If there is no path of the message, it should be a program error. */
5354 AWS_ASSERT (!err );
54- metrics -> req_resp_info_metrics .request_path_query = aws_string_new_from_cursor (metrics -> allocator , & out_path );
55+ request -> send_data .metrics -> req_resp_info_metrics .request_path_query =
56+ aws_string_new_from_cursor (request -> send_data .metrics -> allocator , & out_path );
5557 AWS_ASSERT (metrics -> req_resp_info_metrics .request_path_query != NULL );
5658
5759 /* Get the host header value */
@@ -61,9 +63,14 @@ void s_populate_metrics_from_message(struct aws_s3_request_metrics *metrics, str
6163 AWS_ASSERT (message_headers );
6264 err = aws_http_headers_get (message_headers , g_host_header_name , & host_header_value );
6365 AWS_ASSERT (!err );
64- metrics -> req_resp_info_metrics .host_address = aws_string_new_from_cursor (metrics -> allocator , & host_header_value );
66+ request -> send_data .metrics -> req_resp_info_metrics .host_address =
67+ aws_string_new_from_cursor (request -> send_data .metrics -> allocator , & host_header_value );
6568 AWS_ASSERT (metrics -> req_resp_info_metrics .host_address != NULL );
6669
70+ request -> send_data .metrics -> req_resp_info_metrics .request_type = request -> request_type ;
71+ request -> send_data .metrics -> req_resp_info_metrics .operation_name =
72+ aws_string_new_from_string (request -> send_data .metrics -> allocator , request -> operation_name );
73+
6774 (void )err ;
6875}
6976
@@ -95,11 +102,11 @@ void aws_s3_request_setup_send_data(struct aws_s3_request *request, struct aws_h
95102 }
96103 aws_s3_request_clean_up_send_data (request );
97104
98- request -> send_data .metrics = aws_s3_request_metrics_new (request -> allocator , request );
105+ request -> send_data .metrics = aws_s3_request_metrics_new (request -> allocator );
99106 }
100107
101108 request -> send_data .message = message ;
102- s_populate_metrics_from_message (request -> send_data . metrics , message );
109+ s_populate_metrics_from_message (request , message );
103110 /* Start the timestamp */
104111 aws_high_res_clock_get_ticks ((uint64_t * )& request -> send_data .metrics -> time_metrics .start_timestamp_ns );
105112 aws_http_message_acquire (message );
@@ -182,16 +189,11 @@ static void s_s3_request_metrics_destroy(void *arg) {
182189 aws_mem_release (metrics -> allocator , metrics );
183190}
184191
185- struct aws_s3_request_metrics * aws_s3_request_metrics_new (
186- struct aws_allocator * allocator ,
187- const struct aws_s3_request * request ) {
192+ struct aws_s3_request_metrics * aws_s3_request_metrics_new (struct aws_allocator * allocator ) {
188193
189194 struct aws_s3_request_metrics * metrics = aws_mem_calloc (allocator , 1 , sizeof (struct aws_s3_request_metrics ));
190195 metrics -> allocator = allocator ;
191196
192- metrics -> req_resp_info_metrics .request_type = request -> request_type ;
193- metrics -> req_resp_info_metrics .operation_name = aws_string_new_from_string (allocator , request -> operation_name );
194-
195197 metrics -> time_metrics .start_timestamp_ns = -1 ;
196198 metrics -> time_metrics .end_timestamp_ns = -1 ;
197199 metrics -> time_metrics .total_duration_ns = -1 ;
@@ -213,10 +215,11 @@ struct aws_s3_request_metrics *aws_s3_request_metrics_new(
213215
214216 metrics -> req_resp_info_metrics .response_status = -1 ;
215217
216- aws_ref_count_init (& metrics -> ref_count , metrics , s_s3_request_metrics_destroy );
218+ aws_ref_count_init (& metrics -> ref_count , metrics , s_s3_request_metrics_destroy );/**/
217219
218220 return metrics ;
219221}
222+
220223struct aws_s3_request_metrics * aws_s3_request_metrics_acquire (struct aws_s3_request_metrics * metrics ) {
221224 if (!metrics ) {
222225 return NULL ;
0 commit comments