Track total method call times per transaction
This makes it easier to see where time is spent without having to aggregate all the individual points in the method_calls series.
This commit is contained in:
parent
66a997a914
commit
825b46f8a3
2 changed files with 8 additions and 0 deletions
|
@ -123,6 +123,8 @@ module Gitlab
|
|||
duration = (Time.now - start) * 1000.0
|
||||
|
||||
if duration >= Gitlab::Metrics.method_call_threshold
|
||||
trans.increment(:method_duration, duration)
|
||||
|
||||
trans.add_metric(Gitlab::Metrics::Instrumentation::SERIES,
|
||||
{ duration: duration },
|
||||
method: #{label.inspect})
|
||||
|
|
|
@ -48,6 +48,9 @@ describe Gitlab::Metrics::Instrumentation do
|
|||
allow(described_class).to receive(:transaction).
|
||||
and_return(transaction)
|
||||
|
||||
expect(transaction).to receive(:increment).
|
||||
with(:method_duration, a_kind_of(Numeric))
|
||||
|
||||
expect(transaction).to receive(:add_metric).
|
||||
with(described_class::SERIES, an_instance_of(Hash),
|
||||
method: 'Dummy.foo')
|
||||
|
@ -102,6 +105,9 @@ describe Gitlab::Metrics::Instrumentation do
|
|||
allow(described_class).to receive(:transaction).
|
||||
and_return(transaction)
|
||||
|
||||
expect(transaction).to receive(:increment).
|
||||
with(:method_duration, a_kind_of(Numeric))
|
||||
|
||||
expect(transaction).to receive(:add_metric).
|
||||
with(described_class::SERIES, an_instance_of(Hash),
|
||||
method: 'Dummy#bar')
|
||||
|
|
Loading…
Reference in a new issue