Commit 8f3fbbf0 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@13-12-stable-ee

parent de235133
......@@ -309,12 +309,12 @@ gem 'rack-attack', '~> 6.3.0'
gem 'sentry-raven', '~> 3.0'
# PostgreSQL query parsing
gem 'pg_query', '~> 2.0.3'
gem 'pg_query', '~> 1.3.0'
gem 'premailer-rails', '~> 1.10.3'
# LabKit: Tracing and Correlation
gem 'gitlab-labkit', '~> 0.17.1'
gem 'gitlab-labkit', '~> 0.16.2'
# Thrift is a dependency of gitlab-labkit, we want a version higher than 0.14.0
# because of https://gitlab.com/gitlab-org/gitlab/-/issues/321900
gem 'thrift', '>= 0.14.0'
......@@ -485,7 +485,7 @@ gem 'gitaly', '~> 13.12.0.pre.rc1'
gem 'grpc', '~> 1.30.2'
gem 'google-protobuf', '~> 3.15.8'
gem 'google-protobuf', '~> 3.14.0'
gem 'toml-rb', '~> 1.0.0'
......
......@@ -467,13 +467,13 @@ GEM
fog-xml (~> 0.1.0)
google-api-client (>= 0.44.2, < 0.51)
google-cloud-env (~> 1.2)
gitlab-labkit (0.17.1)
gitlab-labkit (0.16.2)
actionpack (>= 5.0.0, < 7.0.0)
activesupport (>= 5.0.0, < 7.0.0)
grpc (~> 1.19)
jaeger-client (~> 1.1)
opentracing (~> 0.4)
pg_query (~> 2.0)
pg_query (~> 1.3)
redis (> 3.0.0, < 5.0.0)
gitlab-license (1.5.0)
gitlab-mail_room (0.0.9)
......@@ -516,7 +516,7 @@ GEM
signet (~> 0.12)
google-cloud-env (1.4.0)
faraday (>= 0.17.3, < 2.0)
google-protobuf (3.15.8)
google-protobuf (3.14.0)
googleapis-common-protos-types (1.0.6)
google-protobuf (~> 3.14)
googleauth (0.14.0)
......@@ -903,8 +903,7 @@ GEM
peek (1.1.0)
railties (>= 4.0.0)
pg (1.2.3)
pg_query (2.0.3)
google-protobuf (~> 3.15.5)
pg_query (1.3.0)
plist (3.6.0)
png_quantizator (0.2.1)
po_to_json (1.0.1)
......@@ -1480,7 +1479,7 @@ DEPENDENCIES
gitlab-experiment (~> 0.5.4)
gitlab-fog-azure-rm (~> 1.0.1)
gitlab-fog-google (~> 1.13)
gitlab-labkit (~> 0.17.1)
gitlab-labkit (~> 0.16.2)
gitlab-license (~> 1.5)
gitlab-mail_room (~> 0.0.9)
gitlab-markup (~> 1.7.1)
......@@ -1492,7 +1491,7 @@ DEPENDENCIES
gitlab_omniauth-ldap (~> 2.1.1)
gon (~> 6.4.0)
google-api-client (~> 0.33)
google-protobuf (~> 3.15.8)
google-protobuf (~> 3.14.0)
gpgme (~> 2.0.19)
grape (~> 1.5.2)
grape-entity (~> 0.9.0)
......@@ -1573,7 +1572,7 @@ DEPENDENCIES
parslet (~> 1.8)
peek (~> 1.1)
pg (~> 1.1)
pg_query (~> 2.0.3)
pg_query (~> 1.3.0)
png_quantizator (~> 0.2.1)
premailer-rails (~> 1.10.3)
prometheus-client-mmap (~> 0.12.0)
......
......@@ -146,6 +146,9 @@ module Gitlab
else
inject_context_for_exception(event, ex.cause) if ex.cause.present?
end
# This should only happen on PostgreSQL v12 queries
rescue PgQuery::ParseError
event.extra[:sql] = ex.sql.to_s
end
end
end
......
......@@ -204,6 +204,23 @@ RSpec.describe Gitlab::ErrorTracking do
expect(sentry_event.dig('extra', 'sql')).to eq('SELECT "users".* FROM "users" WHERE "users"."id" = $2 AND "users"."foo" = $1')
end
context 'when SQL cannot be parsed' do
let(:pg12_query) do
<<-SQL
CREATE INDEX CONCURRENTLY my_index ON merge_requests
USING btree (target_project_id) INCLUDE (id, latest_merge_request_diff_id)
SQL
end
let(:exception) { ActiveRecord::StatementInvalid.new(sql: pg12_query) }
it 'injects the raw sql query into extra' do
track_exception
expect(sentry_event.dig('extra', 'sql')).to eq(pg12_query)
end
end
end
context 'when the `ActiveRecord::StatementInvalid` is wrapped in another exception' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment