diff options
author | Igor Wiedler <iwiedler@gitlab.com> | 2021-09-27 18:29:10 +0300 |
---|---|---|
committer | Igor Wiedler <iwiedler@gitlab.com> | 2021-09-29 12:41:20 +0300 |
commit | 08766e0a8a1de02ecdcad8c33ad344c82b20322c (patch) | |
tree | f91ab53f9429cfb2b1051dfd73d19a27f5dbccd8 /internal | |
parent | 316a0b8bd61bbf5802fa1d0d277220e63ae681ee (diff) |
Introduce log field for command.cpu_time_ms
This provides a single field for user+system time, a useful metric
to have when attributing resource usage via logs, since kibana
cannot easily add the two fields on the fly.
By pre-computing the sum, we have a single field we can use.
Changelog: changed
Diffstat (limited to 'internal')
-rw-r--r-- | internal/command/command.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/command/command.go b/internal/command/command.go index eb2d494be..c4d04d667 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -316,6 +316,7 @@ func (c *Command) logProcessComplete() { "command.exitCode": exitCode, "command.system_time_ms": systemTime.Seconds() * 1000, "command.user_time_ms": userTime.Seconds() * 1000, + "command.cpu_time_ms": (systemTime.Seconds() + userTime.Seconds()) * 1000, "command.real_time_ms": realTime.Seconds() * 1000, }) @@ -337,6 +338,7 @@ func (c *Command) logProcessComplete() { stats.RecordSum("command.count", 1) stats.RecordSum("command.system_time_ms", int(systemTime.Seconds()*1000)) stats.RecordSum("command.user_time_ms", int(userTime.Seconds()*1000)) + stats.RecordSum("command.cpu_time_ms", int((systemTime.Seconds()+userTime.Seconds())*1000)) stats.RecordSum("command.real_time_ms", int(realTime.Seconds()*1000)) if ok { |