2021-02-03 16:09:17 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-26 09:03:00 -04:00
|
|
|
require 'peek/adapters/redis'
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2019-07-26 09:03:00 -04:00
|
|
|
Peek::Adapters::Redis.prepend ::Gitlab::PerformanceBar::RedisAdapterWhenPeekEnabled
|
2019-08-23 08:05:38 -04:00
|
|
|
Peek.singleton_class.prepend ::Gitlab::PerformanceBar::WithTopLevelWarnings
|
2019-05-03 07:31:01 -04:00
|
|
|
|
2022-07-01 17:08:27 -04:00
|
|
|
Rails.application.config.peek.adapter = :redis, {
|
|
|
|
client: ::Redis.new(Gitlab::Redis::Cache.params),
|
|
|
|
expires_in: 5.minutes
|
|
|
|
}
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2019-07-26 09:03:00 -04:00
|
|
|
Peek.into Peek::Views::Host
|
|
|
|
Peek.into Peek::Views::ActiveRecord
|
2018-03-08 04:58:24 -05:00
|
|
|
Peek.into Peek::Views::Gitaly
|
2019-07-17 15:33:49 -04:00
|
|
|
Peek.into Peek::Views::RedisDetailed
|
2020-05-28 02:08:26 -04:00
|
|
|
Peek.into Peek::Views::Elasticsearch
|
2019-07-21 01:34:46 -04:00
|
|
|
Peek.into Peek::Views::Rugged
|
2021-01-22 10:09:08 -05:00
|
|
|
Peek.into Peek::Views::ExternalHttp
|
2020-05-21 20:08:07 -04:00
|
|
|
Peek.into Peek::Views::BulletDetailed if defined?(Bullet)
|
2021-05-26 05:11:02 -04:00
|
|
|
Peek.into Peek::Views::Memory
|
2019-08-02 05:04:32 -04:00
|
|
|
|
2019-02-18 15:57:22 -05:00
|
|
|
Peek.into Peek::Views::Tracing if Labkit::Tracing.tracing_url_enabled?
|
2020-08-18 14:10:10 -04:00
|
|
|
|
2021-05-26 05:11:02 -04:00
|
|
|
# Trigger view creation here, since views might be subscribing to Rails notifications
|
|
|
|
# via setup_subscribers, which is called in the initializer.
|
|
|
|
# See https://github.com/peek/peek/blob/master/lib/peek/views/view.rb
|
|
|
|
Peek.views
|
|
|
|
|
2021-09-02 14:10:52 -04:00
|
|
|
ActiveSupport::Notifications.subscribe('format_response.grape') do |_name, _start, _finish, _id, payload|
|
2020-08-18 14:10:10 -04:00
|
|
|
if request_id = payload[:env]['action_dispatch.request_id']
|
|
|
|
Peek.adapter.save(request_id)
|
|
|
|
end
|
|
|
|
end
|