summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2015-12-14 16:51:38 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2015-12-17 17:25:48 +0100
commit9f95ff0d90802467a04816f1d38e30770a026820 (patch)
tree043ade2a781f74ec4105f7d2882e587b7c24c448 /spec
parentd0352e6604915a1a94fbe84252d1606f5adac57c (diff)
downloadgitlab-ce-9f95ff0d90802467a04816f1d38e30770a026820.tar.gz
Track location information as tags
This allows the information to be displayed when using certain functions (e.g. top()) as well as making it easier to aggregate on a per file basis.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/metrics/subscribers/action_view_spec.rb9
-rw-r--r--spec/lib/gitlab/metrics/subscribers/active_record_spec.rb5
2 files changed, 10 insertions, 4 deletions
diff --git a/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb b/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
index 77f3e69d523..c6cd584663f 100644
--- a/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
+++ b/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
@@ -21,10 +21,15 @@ describe Gitlab::Metrics::Subscribers::ActionView do
describe '#render_template' do
it 'tracks rendering of a template' do
- values = { duration: 2.1, file: 'app/views/x.html.haml', line: 4 }
+ values = { duration: 2.1 }
+ tags = {
+ view: 'app/views/x.html.haml',
+ file: 'app/views/x.html.haml',
+ line: 4
+ }
expect(transaction).to receive(:add_metric).
- with(described_class::SERIES, values, path: 'app/views/x.html.haml')
+ with(described_class::SERIES, values, tags)
subscriber.render_template(event)
end
diff --git a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
index 58e8e84df9b..05b6cc14716 100644
--- a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
+++ b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
@@ -19,11 +19,12 @@ describe Gitlab::Metrics::Subscribers::ActiveRecord do
describe '#sql' do
it 'tracks the execution of a SQL query' do
- values = { duration: 0.2, file: 'app/models/foo.rb', line: 4 }
sql = 'SELECT * FROM users WHERE id = ?'
+ values = { duration: 0.2 }
+ tags = { sql: sql, file: 'app/models/foo.rb', line: 4 }
expect(transaction).to receive(:add_metric).
- with(described_class::SERIES, values, sql: sql)
+ with(described_class::SERIES, values, tags)
subscriber.sql(event)
end