Skip to content
Snippets Groups Projects
Verified Commit d9110a7e authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Track call counts in Gitlab::Metrics.measure_block

parent 185d78bc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,10 +14,11 @@ Gitlab::Metrics.measure(:foo) do
end
```
 
Two values are measured for a block:
3 values are measured for a block:
 
1. The real time elapsed, stored in NAME_real_time
2. The CPU time elapsed, stored in NAME_cpu_time
1. The real time elapsed, stored in NAME_real_time.
2. The CPU time elapsed, stored in NAME_cpu_time.
3. The call count, stored in NAME_call_count.
 
Both the real and CPU timings are measured in milliseconds.
 
Loading
Loading
Loading
Loading
@@ -97,6 +97,7 @@ module Gitlab
 
Transaction.current.increment("#{name}_real_time", real_time)
Transaction.current.increment("#{name}_cpu_time", cpu_time)
Transaction.current.increment("#{name}_call_count", 1)
 
retval
end
Loading
Loading
Loading
Loading
@@ -85,6 +85,9 @@ describe Gitlab::Metrics do
expect(transaction).to receive(:increment).
with('foo_cpu_time', a_kind_of(Numeric))
 
expect(transaction).to receive(:increment).
with('foo_call_count', 1)
Gitlab::Metrics.measure(:foo) { 10 }
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment