jenkins-bot has submitted this change and it was merged.
Change subject: Send Thumbor errors to Sentry
......................................................................
Send Thumbor errors to Sentry
Bug: T110858
Change-Id: I28004da154f17d63b36ea9b0826da1cbf32252f9
---
M puppet/hieradata/common.yaml
M puppet/modules/role/manifests/thumbor.pp
M puppet/modules/sentry/manifests/init.pp
A puppet/modules/thumbor/lib/puppet/parser/functions/file_exists.rb
M puppet/modules/thumbor/manifests/init.pp
M puppet/modules/thumbor/templates/thumbor.conf.erb
6 files changed, 29 insertions(+), 11 deletions(-)
Approvals:
Dduvall: Looks good to me, approved
jenkins-bot: Verified
diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml
index c2f1faf..eec5e72 100644
--- a/puppet/hieradata/common.yaml
+++ b/puppet/hieradata/common.yaml
@@ -310,6 +310,7 @@
thumbor::deploy_dir: "%{hiera('mwv::vendor_dir')}/thumbor"
thumbor::cfg_file: /etc/thumbor.conf
thumbor::statsd_port: "%{hiera('statsd::port')}"
+thumbor::sentry_dsn_file: "%{hiera('sentry::dsn_file')}"
xhprofgui::dir: "%{hiera('mwv::vendor_dir')}/xhprof"
diff --git a/puppet/modules/role/manifests/thumbor.pp
b/puppet/modules/role/manifests/thumbor.pp
index 338e9ea..abccb71 100644
--- a/puppet/modules/role/manifests/thumbor.pp
+++ b/puppet/modules/role/manifests/thumbor.pp
@@ -3,12 +3,13 @@
#
class role::thumbor (
) {
- include ::role::varnish
- include ::thumbor
+ require ::role::varnish
+ require ::role::statsd
+ require ::role::sentry
include ::apache::mod::proxy
include ::apache::mod::proxy_http
include ::apache::mod::headers
- include ::role::statsd
+ include ::thumbor
mediawiki::settings { 'thumbor-repo':
values => template('role/thumbor/local_repo.php.erb'),
diff --git a/puppet/modules/sentry/manifests/init.pp
b/puppet/modules/sentry/manifests/init.pp
index 13a8f47..245df38 100644
--- a/puppet/modules/sentry/manifests/init.pp
+++ b/puppet/modules/sentry/manifests/init.pp
@@ -88,6 +88,7 @@
'raven',
],
require => Package['libmysqlclient-dev'],
+ timeout => 600, # This can take a while
}
mysql::db { $db_name:
diff --git a/puppet/modules/thumbor/lib/puppet/parser/functions/file_exists.rb
b/puppet/modules/thumbor/lib/puppet/parser/functions/file_exists.rb
new file mode 100644
index 0000000..6dd35bc
--- /dev/null
+++ b/puppet/modules/thumbor/lib/puppet/parser/functions/file_exists.rb
@@ -0,0 +1,7 @@
+require 'puppet'
+
+module Puppet::Parser::Functions
+ newfunction(:file_exists, type: :rvalue) do |args|
+ return File.exists?(args[0])
+ end
+end
diff --git a/puppet/modules/thumbor/manifests/init.pp
b/puppet/modules/thumbor/manifests/init.pp
index 611cd9f..2a7a29d 100644
--- a/puppet/modules/thumbor/manifests/init.pp
+++ b/puppet/modules/thumbor/manifests/init.pp
@@ -18,10 +18,14 @@
# [*statsd_port*]
# Port the statsd instance runs on.
#
+# [*sentry_dsn_file*]
+# Path to file containing the sentry dsn file.
+#
class thumbor (
$deploy_dir,
$cfg_file,
- $statsd_port
+ $statsd_port,
+ $sentry_dsn_file,
) {
require ::virtualenv
@@ -43,6 +47,7 @@
'cv2',
'numpy',
'opencv-engine',
+ 'raven',
],
require => [
Package['libjpeg-progs'],
@@ -60,10 +65,11 @@
}
file { $cfg_file:
- ensure => present,
- group => 'www-data',
- content => template('thumbor/thumbor.conf.erb'),
- mode => '0640',
+ ensure => present,
+ group => 'www-data',
+ content => template('thumbor/thumbor.conf.erb'),
+ mode => '0640',
+ subscribe => File[$sentry_dsn_file],
}
file { '/etc/init/thumbor.conf':
diff --git a/puppet/modules/thumbor/templates/thumbor.conf.erb
b/puppet/modules/thumbor/templates/thumbor.conf.erb
index 2ead6f8..51affb4 100644
--- a/puppet/modules/thumbor/templates/thumbor.conf.erb
+++ b/puppet/modules/thumbor/templates/thumbor.conf.erb
@@ -545,12 +545,12 @@
## This configuration indicates whether thumbor should use a custom error
## handler.
## Defaults to: False
-#USE_CUSTOM_ERROR_HANDLING = False
+USE_CUSTOM_ERROR_HANDLING = True
## Error reporting module. Needs to contain a class called ErrorHandler with a
## handle_error(context, handler, exception) method.
## Defaults to: thumbor.error_handlers.sentry
-#ERROR_HANDLER_MODULE = 'thumbor.error_handlers.sentry'
+ERROR_HANDLER_MODULE = 'thumbor.error_handlers.sentry'
## File of error log as json
## Defaults to: None
@@ -568,7 +568,9 @@
## Sentry thumbor project dsn. i.e.:
http://5a63d58ae7b94f1dab3dee740b301d6a:73ee
## a45d3e8649239a973087e8f21f98@localhost:9000/2
## Defaults to:
-#SENTRY_DSN_URL = ''
+<% if scope.function_file_exists([@sentry_dsn_file]) -%>
+SENTRY_DSN_URL = '<%= scope.function_file([@sentry_dsn_file]) %>'
+<% end -%>
################################################################################
--
To view, visit https://gerrit.wikimedia.org/r/235748
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I28004da154f17d63b36ea9b0826da1cbf32252f9
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Gilles <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits