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

Strip newlines from obfuscated SQL

Newlines aren't really needed and they may mess with InfluxDB's line
protocol.
parent 58bc4b72
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -40,7 +40,7 @@ module Gitlab
sql = sql.delete('"')
end
 
sql
sql.gsub("\n", ' ')
end
end
end
Loading
Loading
Loading
Loading
@@ -2,6 +2,12 @@ require 'spec_helper'
 
describe Gitlab::Metrics::ObfuscatedSQL do
describe '#to_s' do
it 'replaces newlines with a space' do
sql = described_class.new("SELECT x\nFROM y")
expect(sql.to_s).to eq('SELECT x FROM y')
end
describe 'using single values' do
it 'replaces a single integer' do
sql = described_class.new('SELECT x FROM y WHERE a = 10')
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