debian-mirror-gitlab/config/initializers/peek.rb

32 lines
1.1 KiB
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
2019-10-12 21:52:04 +05:30
require 'peek/adapters/redis'
2018-03-17 18:26:18 +05:30
2019-10-12 21:52:04 +05:30
Peek::Adapters::Redis.prepend ::Gitlab::PerformanceBar::RedisAdapterWhenPeekEnabled
2019-12-04 20:38:33 +05:30
Peek.singleton_class.prepend ::Gitlab::PerformanceBar::WithTopLevelWarnings
2019-07-31 22:56:46 +05:30
2019-10-12 21:52:04 +05:30
Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis::Cache.params) }
2018-03-17 18:26:18 +05:30
2019-10-12 21:52:04 +05:30
Peek.into Peek::Views::Host
Peek.into Peek::Views::ActiveRecord
2018-05-09 12:01:36 +05:30
Peek.into Peek::Views::Gitaly
2019-10-12 21:52:04 +05:30
Peek.into Peek::Views::RedisDetailed
2020-06-23 00:09:42 +05:30
Peek.into Peek::Views::Elasticsearch
2019-10-12 21:52:04 +05:30
Peek.into Peek::Views::Rugged
2021-03-11 19:13:27 +05:30
Peek.into Peek::Views::ExternalHttp
2020-06-23 00:09:42 +05:30
Peek.into Peek::Views::BulletDetailed if defined?(Bullet)
2021-09-04 01:27:46 +05:30
Peek.into Peek::Views::Memory
2019-09-30 21:07:59 +05:30
2019-10-12 21:52:04 +05:30
Peek.into Peek::Views::Tracing if Labkit::Tracing.tracing_url_enabled?
2020-10-24 23:57:45 +05:30
2021-09-04 01:27:46 +05:30
# 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-11-11 11:23:49 +05:30
ActiveSupport::Notifications.subscribe('format_response.grape') do |_name, _start, _finish, _id, payload|
2020-10-24 23:57:45 +05:30
if request_id = payload[:env]['action_dispatch.request_id']
Peek.adapter.save(request_id)
end
end