diff options
author | Robert Speicher <robert@gitlab.com> | 2016-06-17 20:46:18 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-06-17 21:23:05 +0300 |
commit | c6b9925335f283977ca97c321f8d6bf8e962b32a (patch) | |
tree | 40e30defa2700f4a7615842995023614d02fab21 /doc | |
parent | 3fa0e15966433bffa8b55893a300a1952ff075e7 (diff) |
Merge branch 'track-total-method-call-time' into 'master'
Track method call times/counts as a single metric
This changes method call tracking so only a single metric is emitted regardless of the number of calls. This allows us to more accurately measure the total execution time of a method as well as the number of times a method is called. See 851e3ff7578973c2206628424eac3b951a3c656d for more details.
Method call tracking tracked calls individually meaning the end statistics may not always be accurate enough to get a good understanding of where time is spent.
See merge request !4754
Diffstat (limited to 'doc')
-rw-r--r-- | doc/development/instrumentation.md | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/doc/development/instrumentation.md b/doc/development/instrumentation.md index 6cd9b274d11..c2272ab0a2b 100644 --- a/doc/development/instrumentation.md +++ b/doc/development/instrumentation.md @@ -94,23 +94,8 @@ Visibility: public Number of lines: 21 def #{name}(#{args_signature}) - trans = Gitlab::Metrics::Instrumentation.transaction - - if trans - start = Time.now - cpu_start = Gitlab::Metrics::System.cpu_time - retval = super - duration = (Time.now - start) * 1000.0 - - if duration >= Gitlab::Metrics.method_call_threshold - cpu_duration = Gitlab::Metrics::System.cpu_time - cpu_start - - trans.add_metric(Gitlab::Metrics::Instrumentation::SERIES, - { duration: duration, cpu_duration: cpu_duration }, - method: #{label.inspect}) - end - - retval + if trans = Gitlab::Metrics::Instrumentation.transaction + trans.measure_method(#{label.inspect}) { super } else super end |