class Trailer::Configuration

Attributes

application_name[RW]
auto_tag_fields[RW]
aws_access_key_id[RW]
aws_region[RW]
aws_secret_access_key[RW]
current_user_method[RW]
enabled[RW]
environment[RW]
host_name[RW]
service_name[RW]
storage[RW]
tag_fields[R]

Public Class Methods

new() click to toggle source

Constructor.

# File lib/trailer/configuration.rb, line 22
def initialize
  # The global application or company name.
  @application_name      = ENV['TRAILER_APPLICATION_NAME']
  # When tracing ActiveRecord instances, we can tag our trace with fields matching this regex.
  @auto_tag_fields       = /(_id|_at)$/.freeze
  # AWS access key with CloudWatch write permission.
  @aws_access_key_id     = ENV['AWS_ACCESS_KEY_ID']
  # The AWS region to log to.
  @aws_region            = ENV.fetch('AWS_REGION', 'us-east-1')
  # The AWS secret.
  @aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
  # Allows tracing to be explicitly disabled.
  @enabled               = true
  # The environment that the application is running (eg. 'production', 'test').
  @environment           = ENV['TRAILER_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV']
  # Optional - the name of the individual host or server within the service.
  @host_name             = ENV['TRAILER_HOST_NAME']
  # The name of the service within the application.
  @service_name          = ENV['TRAILER_SERVICE_NAME']
  # The storage backend class to use.
  @storage               = Trailer::Storage::CloudWatch
  # Optional - When tracing ActiveRecord instances, we can tag our trace with these fields explicitly.
  @tag_fields            = %i[name]
end

Public Instance Methods

tag_fields=(fields) click to toggle source

Make sure we store tag_fields as symbols for consistency.

# File lib/trailer/configuration.rb, line 48
def tag_fields=(fields)
  @tag_fields = Array(fields).flatten.map(&:to_sym)
end