Skip to content

Commit

Permalink
rgw: fix total_time to msec as per AWS S3
Browse files Browse the repository at this point in the history
As AWS log format[1] are using millisecond as unit, change rgw total_time
unit from usec to msec.

[1] http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html

Reported-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
  • Loading branch information
Jiaying Ren committed Sep 7, 2017
1 parent 53d34d4 commit d84cb65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rgw/rgw_admin.cc
Expand Up @@ -5049,7 +5049,7 @@ int main(int argc, const char **argv)
formatter->open_array_section("log_entries");

do {
uint64_t total_time = entry.total_time.sec() * 1000000LL + entry.total_time.usec();
uint64_t total_time = entry.total_time.to_msec();

agg_time += total_time;
agg_bytes_sent += entry.bytes_sent;
Expand Down
2 changes: 1 addition & 1 deletion src/rgw/rgw_log.cc
Expand Up @@ -251,7 +251,7 @@ void rgw_format_ops_log_entry(struct rgw_log_entry& entry, Formatter *formatter)
formatter->dump_int("bytes_sent", entry.bytes_sent);
formatter->dump_int("bytes_received", entry.bytes_received);
formatter->dump_int("object_size", entry.obj_size);
uint64_t total_time = entry.total_time.sec() * 1000000LL + entry.total_time.usec();
uint64_t total_time = entry.total_time.to_msec();

formatter->dump_int("total_time", total_time);
formatter->dump_string("user_agent", entry.user_agent);
Expand Down

0 comments on commit d84cb65

Please sign in to comment.