class Honeycomb::Configuration
Used to configure the Honeycomb
client
Attributes
api_host[RW]
client[W]
dataset[RW]
debug[RW]
error_backtrace_limit[R]
host_name[W]
service_name[W]
write_key[RW]
Public Class Methods
new()
click to toggle source
# File lib/honeycomb/configuration.rb, line 17 def initialize @write_key = ENV["HONEYCOMB_WRITEKEY"] @dataset = ENV["HONEYCOMB_DATASET"] @service_name = ENV["HONEYCOMB_SERVICE"] @debug = ENV.key?("HONEYCOMB_DEBUG") @error_backtrace_limit = 0 @client = nil end
Public Instance Methods
after_initialize(client)
click to toggle source
Calls superclass method
Honeycomb::ActiveSupport::Configuration#after_initialize
# File lib/honeycomb/configuration.rb, line 46 def after_initialize(client) super(client) if defined?(super) end
client()
click to toggle source
# File lib/honeycomb/configuration.rb, line 34 def client options = {}.tap do |o| o[:writekey] = write_key o[:dataset] = dataset api_host && o[:api_host] = api_host end @client || (debug && Libhoney::LogClient.new) || Libhoney::Client.new(**options) end
error_backtrace_limit=(val)
click to toggle source
# File lib/honeycomb/configuration.rb, line 30 def error_backtrace_limit=(val) @error_backtrace_limit = Integer(val) end
host_name()
click to toggle source
# File lib/honeycomb/configuration.rb, line 50 def host_name # Send the heroku dyno name instead of hostname if available @host_name || ENV["DYNO"] || Socket.gethostname end
http_trace_parser_hook(&hook)
click to toggle source
# File lib/honeycomb/configuration.rb, line 71 def http_trace_parser_hook(&hook) if block_given? @http_trace_parser_hook = hook elsif @http_trace_parser_hook @http_trace_parser_hook else # by default we try to parse incoming honeycomb traces HoneycombPropagation::UnmarshalTraceContext.method(:parse_rack_env) end end
http_trace_propagation_hook(&hook)
click to toggle source
# File lib/honeycomb/configuration.rb, line 82 def http_trace_propagation_hook(&hook) if block_given? @http_trace_propagation_hook = hook elsif @http_trace_propagation_hook @http_trace_propagation_hook else # by default we send outgoing honeycomb trace headers HoneycombPropagation::MarshalTraceContext.method(:parse_faraday_env) end end
presend_hook(&hook)
click to toggle source
# File lib/honeycomb/configuration.rb, line 55 def presend_hook(&hook) if block_given? @presend_hook = hook else @presend_hook end end
sample_hook(&hook)
click to toggle source
# File lib/honeycomb/configuration.rb, line 63 def sample_hook(&hook) if block_given? @sample_hook = hook else @sample_hook end end
service_name()
click to toggle source
# File lib/honeycomb/configuration.rb, line 26 def service_name @service_name || dataset end