Sha256: 36e82df6b856eb6f78b5267a1aad2894d1deda6eb625db421cef45c887b1c132

Contents?: true

Size: 2 KB

Versions: 3

Compression:

Stored size: 2 KB

Contents

# frozen_string_literal: true

require_relative "plain_apm/version"
require_relative "plain_apm/transport"
require_relative "plain_apm/config"
require_relative "plain_apm/agent"
require_relative "plain_apm/deploy_tracking"
require_relative "plain_apm/event_attributes"

require "object_tracing"

# Rails instrumentation. The hooks won't install unless
# ActiveSupport::Notifications is loaded.
require_relative "plain_apm/hooks/active_support_subscriber"
require_relative "plain_apm/hooks/action_mailer"
require_relative "plain_apm/hooks/action_pack"
require_relative "plain_apm/hooks/action_view"
require_relative "plain_apm/hooks/active_job"
require_relative "plain_apm/hooks/active_record"
require_relative "plain_apm/hooks/active_support"
require_relative "plain_apm/hooks/manual"
require_relative "plain_apm/hooks/error_reporter"

# Per thread context for request IDs / job IDs.
require_relative "plain_apm/extensions/context"
require_relative "plain_apm/extensions/context/rack"
require_relative "plain_apm/extensions/context/active_job"
require_relative "plain_apm/extensions/context/railtie"

# Per thread allocations in ASN events
require_relative "plain_apm/extensions/thread_allocations/active_support_event"
require_relative "plain_apm/extensions/thread_allocations/railtie"

# Helpers du jour.
require_relative "plain_apm/helpers"

# Rack exceptions. Activate the middleware if in Rails.
require_relative "plain_apm/extensions/exceptions/rack"
require_relative "plain_apm/extensions/exceptions/railtie"

module PlainApm
  # Allow swapping out the Agent for a synchronous, in-memory implementation in
  # the tests.
  def self.agent=(agent)
    @@agent = agent
  end

  def self.agent
    @@agent ||= Agent.instance
  end

  begin
    require "rails/railtie"
  rescue LoadError
    nil
  end

  # after_initialize allows reading settings from ENV on app start.
  if defined?(Rails::Railtie)
    class Railtie < Rails::Railtie
      config.after_initialize { PlainApm.agent.start }
    end
  else
    PlainApm.agent.start
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plain_apm-0.9.2 lib/plain_apm.rb
plain_apm-0.9.1 lib/plain_apm.rb
plain_apm-0.9.0 lib/plain_apm.rb