add sentry capture to v3 router
This commit is contained in:
parent
a45d53f73c
commit
cafe40a4c3
|
@ -3,6 +3,10 @@ module Travis::API::V3
|
||||||
include Travis::API::V3
|
include Travis::API::V3
|
||||||
attr_accessor :routes, :metrics_processor
|
attr_accessor :routes, :metrics_processor
|
||||||
|
|
||||||
|
Raven.configure do |config|
|
||||||
|
config.dsn = Travis.config.sentry.dsn
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(routes = Routes)
|
def initialize(routes = Routes)
|
||||||
@routes = routes
|
@routes = routes
|
||||||
@metrics_processor = Metrics::Processor.new
|
@metrics_processor = Metrics::Processor.new
|
||||||
|
@ -12,6 +16,10 @@ module Travis::API::V3
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
|
Raven.capture do
|
||||||
|
# capture any exceptions which happen during execution of this block
|
||||||
|
1 / 0
|
||||||
|
|
||||||
return service_index(env) if env['PATH_INFO'.freeze] == ?/.freeze
|
return service_index(env) if env['PATH_INFO'.freeze] == ?/.freeze
|
||||||
metrics = @metrics_processor.create
|
metrics = @metrics_processor.create
|
||||||
access_control = AccessControl.new(env)
|
access_control = AccessControl.new(env)
|
||||||
|
@ -46,6 +54,7 @@ module Travis::API::V3
|
||||||
|
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def render(result, env_params, env)
|
def render(result, env_params, env)
|
||||||
V3.response(result.render(env_params, env), status: result.status)
|
V3.response(result.render(env_params, env), status: result.status)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user