From 9f95ff0d90802467a04816f1d38e30770a026820 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 14 Dec 2015 16:51:38 +0100 Subject: 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. --- spec/lib/gitlab/metrics/subscribers/action_view_spec.rb | 9 +++++++-- spec/lib/gitlab/metrics/subscribers/active_record_spec.rb | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'spec/lib') 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 -- cgit v1.2.1