diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-12-31 17:14:02 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-12-31 17:14:02 +0100 |
commit | a6c60127e3e2966b2f29fa6e6e79503b130c2b02 (patch) | |
tree | 9f884fb27fd1f6e6c50071e7950b65c8492cfafd /spec/lib/gitlab/metrics/subscribers/active_record_spec.rb | |
parent | ab08321be8405eab07929bb3df8bd2dcc14dc063 (diff) | |
download | gitlab-ce-a6c60127e3e2966b2f29fa6e6e79503b130c2b02.tar.gz |
Removed tracking of raw SQL queries
This particular setup had 3 problems:
1. Storing SQL queries as tags is very inefficient as InfluxDB ends up
indexing every query (and they can get pretty large). Storing these
as values instead means we can't always display the SQL as easily.
2. We already instrument ActiveRecord query methods, thus we already
have timing information about database queries.
3. SQL obfuscation is difficult to get right and I'd rather not expose
sensitive data by accident.
Diffstat (limited to 'spec/lib/gitlab/metrics/subscribers/active_record_spec.rb')
-rw-r--r-- | spec/lib/gitlab/metrics/subscribers/active_record_spec.rb | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb deleted file mode 100644 index 05b6cc14716..00000000000 --- a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Metrics::Subscribers::ActiveRecord do - let(:transaction) { Gitlab::Metrics::Transaction.new } - - let(:subscriber) { described_class.new } - - let(:event) do - double(:event, duration: 0.2, - payload: { sql: 'SELECT * FROM users WHERE id = 10' }) - end - - before do - allow(subscriber).to receive(:current_transaction).and_return(transaction) - - allow(Gitlab::Metrics).to receive(:last_relative_application_frame). - and_return(['app/models/foo.rb', 4]) - end - - describe '#sql' do - it 'tracks the execution of a SQL query' do - 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, tags) - - subscriber.sql(event) - end - end -end |