Sha256: b15c3e71e95fd0cb8549e317c058601d5f78163eeebdcb89c055ef70364fb1bf

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require "forwardable"
require "libhoney"
require "honeycomb/beeline/version"
require "honeycomb/client"
require "honeycomb/trace"

# main module
module Honeycomb
  INTEGRATIONS = %i[
    active_support
    aws
    faraday
    rack
    rails
    railtie
    rake
    redis
    sequel
    sinatra
  ].freeze

  class << self
    extend Forwardable
    attr_reader :client

    def_delegators :@client, :libhoney, :start_span, :add_field,
                   :add_field_to_trace, :current_span, :current_trace,
                   :with_field, :with_trace_field

    def configure
      Configuration.new.tap do |config|
        yield config
        @client = Honeycomb::Client.new(configuration: config)
      end

      @client
    end

    def load_integrations
      integrations_to_load.each do |integration|
        begin
          require "honeycomb/integrations/#{integration}"
        rescue LoadError
        end
      end
    end

    def integrations_to_load
      if ENV["HONEYCOMB_INTEGRATIONS"]
        ENV["HONEYCOMB_INTEGRATIONS"].split(",")
      else
        INTEGRATIONS
      end
    end
  end
end

Honeycomb.load_integrations unless ENV["HONEYCOMB_DISABLE_AUTOCONFIGURE"]

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
honeycomb-beeline-2.10.0 lib/honeycomb-beeline.rb
honeycomb-beeline-2.9.0 lib/honeycomb-beeline.rb
honeycomb-beeline-2.8.2 lib/honeycomb-beeline.rb
honeycomb-beeline-2.8.1 lib/honeycomb-beeline.rb
honeycomb-beeline-2.8.0 lib/honeycomb-beeline.rb
honeycomb-beeline-2.7.1 lib/honeycomb-beeline.rb
honeycomb-beeline-2.7.0 lib/honeycomb-beeline.rb
honeycomb-beeline-2.6.0 lib/honeycomb-beeline.rb
honeycomb-beeline-2.5.0 lib/honeycomb-beeline.rb
honeycomb-beeline-2.4.2 lib/honeycomb-beeline.rb
honeycomb-beeline-2.4.1 lib/honeycomb-beeline.rb
honeycomb-beeline-2.4.0 lib/honeycomb-beeline.rb