Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tracing.rb « initializers « config - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3f066953c235348cc2265a77417ccbd4cc797e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

if Labkit::Tracing.enabled?
  Rails.application.configure do |config|
    # Rack needs to parse multipart messages before ActionDispatch can filter parameters
    config.middleware.insert_after Rack::MethodOverride, ::Labkit::Tracing::RackMiddleware
  end

  # Instrument Redis
  Labkit::Tracing::Redis.instrument
  Labkit::Tracing::ExternalHttp.instrument

  # Instrument Rails
  Labkit::Tracing::Rails::ActiveRecordSubscriber.instrument
  Labkit::Tracing::Rails::ActionViewSubscriber.instrument
  Labkit::Tracing::Rails::ActiveSupportSubscriber.instrument

  # In multi-processed clustered architectures (puma, unicorn) don't
  # start tracing until the worker processes are spawned. This works
  # around issues when the opentracing implementation spawns threads
  Gitlab::Cluster::LifecycleEvents.on_worker_start do
    tracer = Labkit::Tracing::Factory.create_tracer(Gitlab.process_name, Labkit::Tracing.connection_string)
    OpenTracing.global_tracer = tracer if tracer
  end
end