Commit 85e0fce9 authored by Jeroen Nijhof's avatar Jeroen Nijhof

Add sentry integration

parent f603f3b3
...@@ -314,3 +314,6 @@ gem 'oauth2', '~> 1.0.0' ...@@ -314,3 +314,6 @@ gem 'oauth2', '~> 1.0.0'
# Soft deletion # Soft deletion
gem "paranoia", "~> 2.0" gem "paranoia", "~> 2.0"
# Sentry integration
gem 'sentry-raven'
...@@ -725,6 +725,8 @@ GEM ...@@ -725,6 +725,8 @@ GEM
activesupport (>= 3.1, < 4.3) activesupport (>= 3.1, < 4.3)
select2-rails (3.5.9.3) select2-rails (3.5.9.3)
thor (~> 0.14) thor (~> 0.14)
sentry-raven (0.15.3)
faraday (>= 0.7.6)
settingslogic (2.0.9) settingslogic (2.0.9)
sexp_processor (4.6.0) sexp_processor (4.6.0)
sham_rack (1.3.6) sham_rack (1.3.6)
...@@ -1008,6 +1010,7 @@ DEPENDENCIES ...@@ -1008,6 +1010,7 @@ DEPENDENCIES
sdoc (~> 0.3.20) sdoc (~> 0.3.20)
seed-fu (~> 2.3.5) seed-fu (~> 2.3.5)
select2-rails (~> 3.5.9) select2-rails (~> 3.5.9)
sentry-raven
settingslogic (~> 2.0.9) settingslogic (~> 2.0.9)
sham_rack sham_rack
shoulda-matchers (~> 2.8.0) shoulda-matchers (~> 2.8.0)
......
...@@ -77,6 +77,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -77,6 +77,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:recaptcha_enabled, :recaptcha_enabled,
:recaptcha_site_key, :recaptcha_site_key,
:recaptcha_private_key, :recaptcha_private_key,
:sentry_enabled,
:sentry_dsn,
restricted_visibility_levels: [], restricted_visibility_levels: [],
import_sources: [] import_sources: []
) )
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
# recaptcha_site_key :string # recaptcha_site_key :string
# recaptcha_private_key :string # recaptcha_private_key :string
# metrics_port :integer default(8089) # metrics_port :integer default(8089)
# sentry_enabled :boolean default(FALSE)
# sentry_dsn :string
# #
class ApplicationSetting < ActiveRecord::Base class ApplicationSetting < ActiveRecord::Base
...@@ -82,6 +84,10 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -82,6 +84,10 @@ class ApplicationSetting < ActiveRecord::Base
presence: true, presence: true,
if: :recaptcha_enabled if: :recaptcha_enabled
validates :sentry_dsn,
presence: true,
if: :sentry_enabled
validates_each :restricted_visibility_levels do |record, attr, value| validates_each :restricted_visibility_levels do |record, attr, value|
unless value.nil? unless value.nil?
value.each do |level| value.each do |level|
......
...@@ -232,5 +232,22 @@ ...@@ -232,5 +232,22 @@
.col-sm-10 .col-sm-10
= f.text_field :recaptcha_private_key, class: 'form-control' = f.text_field :recaptcha_private_key, class: 'form-control'
%fieldset
%legend Error Reporting and Logging
%p
These settings require a restart to take effect.
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :sentry_enabled do
= f.check_box :sentry_enabled
Enable Sentry
%span.help-block#sentry_help_block Sentry is an error reporting and logging tool
.form-group
= f.label :sentry_dsn, 'Sentry DSN', class: 'control-label col-sm-2'
.col-sm-10
= f.text_field :sentry_dsn, class: 'form-control'
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-primary' = f.submit 'Save', class: 'btn btn-primary'
# Be sure to restart your server when you modify this file.
require 'gitlab/current_settings'
include Gitlab::CurrentSettings
# allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done
begin
sentry_enabled = current_application_settings.sentry_enabled
rescue
sentry_enabled = false
end
if sentry_enabled
Raven.configure do |config|
config.dsn = current_application_settings.sentry_dsn
end
end
class AddSentryToApplicationSettings < ActiveRecord::Migration
def change
change_table :application_settings do |t|
t.boolean :sentry_enabled, default: false
t.string :sentry_dsn
end
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160113111034) do ActiveRecord::Schema.define(version: 20160118155830) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -62,6 +62,8 @@ ActiveRecord::Schema.define(version: 20160113111034) do ...@@ -62,6 +62,8 @@ ActiveRecord::Schema.define(version: 20160113111034) do
t.string "recaptcha_private_key" t.string "recaptcha_private_key"
t.integer "metrics_port", default: 8089 t.integer "metrics_port", default: 8089
t.integer "metrics_sample_interval", default: 15 t.integer "metrics_sample_interval", default: 15
t.boolean "sentry_enabled", default: false
t.string "sentry_dsn"
end end
create_table "audit_events", force: :cascade do |t| create_table "audit_events", force: :cascade do |t|
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
# recaptcha_site_key :string # recaptcha_site_key :string
# recaptcha_private_key :string # recaptcha_private_key :string
# metrics_port :integer default(8089) # metrics_port :integer default(8089)
# sentry_enabled :boolean default(FALSE)
# sentry_dsn :string
# #
require 'spec_helper' require 'spec_helper'
......
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