Sha256: e43692f06cde29d725dde496ff2dd6937cc9329c80ad814cf3a3a865744aa268

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

# Rails deps
begin
  require "active_support"
  require "active_support/notifications"
  require "rails/railtie"
rescue LoadError
  nil
end

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

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

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

# Extra stats in ASN events
require_relative "plain_apm/extensions/active_support"

# 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"

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

  if defined?(Rails::Railtie)
    class Railtie < Rails::Railtie
      # allows reading settings from ENV vars set in config/initializers.
      initializer(:plain_apm_agent_start, after: :load_config_initializers) do
        PlainApm.agent.start
      end
    end
  else
    PlainApm.agent.start
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plain_apm-0.10.2 lib/plain_apm.rb
plain_apm-0.10.0 lib/plain_apm.rb
plain_apm-0.9.8 lib/plain_apm.rb