Simplify Librato setup.
Moves monitoring related setup to its own method.
This commit is contained in:
parent
d0818c5f1c
commit
c8b2b15f56
|
@ -158,18 +158,7 @@ module Travis::Api
|
||||||
end
|
end
|
||||||
|
|
||||||
if Travis.env == 'production' and not console?
|
if Travis.env == 'production' and not console?
|
||||||
Raven.configure do |config|
|
setup_monitoring
|
||||||
config.dsn = Travis.config.sentry.dsn
|
|
||||||
end if Travis.config.sentry
|
|
||||||
|
|
||||||
Travis::LogSubscriber::ActiveRecordMetrics.attach
|
|
||||||
Travis::Notification.setup(instrumentation: false)
|
|
||||||
|
|
||||||
if Travis.config.librato
|
|
||||||
email, token, source, prefix = Travis.config.librato.email, Travis.config.librato.token, Travis.config.librato_source, Travis.config.librato_prefix
|
|
||||||
$metriks_reporter = Metriks::LibratoMetricsReporter.new(email, token, source: source, prefix: prefix)
|
|
||||||
$metriks_reporter.start
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -182,6 +171,23 @@ module Travis::Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.setup_monitoring
|
||||||
|
Raven.configure do |config|
|
||||||
|
config.dsn = Travis.config.sentry.dsn
|
||||||
|
end if Travis.config.sentry
|
||||||
|
|
||||||
|
Travis::LogSubscriber::ActiveRecordMetrics.attach
|
||||||
|
Travis::Notification.setup(instrumentation: false)
|
||||||
|
|
||||||
|
if Travis.config.librato
|
||||||
|
email, token, source, prefix = Travis.config.librato.email,
|
||||||
|
Travis.config.librato.token,
|
||||||
|
Travis.config.librato_source,
|
||||||
|
Travis.config.librato_prefix
|
||||||
|
Metriks::LibratoMetricsReporter.new(email, token, source: source, prefix: prefix).start
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.load_endpoints
|
def self.load_endpoints
|
||||||
Backports.require_relative_dir 'app/middleware'
|
Backports.require_relative_dir 'app/middleware'
|
||||||
Backports.require_relative_dir 'app/endpoint'
|
Backports.require_relative_dir 'app/endpoint'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user