Class: AllStak::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/allstak/config.rb

Overview

SDK configuration. Populated via configure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/allstak/config.rb', line 10

def initialize
  @api_key         = ENV["ALLSTAK_API_KEY"].to_s
  @host            = ENV["ALLSTAK_HOST"] || "https://api.allstak.sa"
  @environment     = ENV["ALLSTAK_ENVIRONMENT"]
  @release         = ENV["ALLSTAK_RELEASE"]
  @service_name    = ENV["ALLSTAK_SERVICE"] || "ruby-service"
  @flush_interval_ms = 2_000
  @buffer_size     = 500
  @debug           = !ENV["ALLSTAK_DEBUG"].to_s.empty?
  @connect_timeout = 3
  @read_timeout    = 3
  @max_retries     = 5
  @capture_unhandled_exceptions = true
  @capture_http_requests        = true
  @capture_user_context         = true
  @capture_sql                  = true
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



4
5
6
# File 'lib/allstak/config.rb', line 4

def api_key
  @api_key
end

#buffer_sizeObject

Returns the value of attribute buffer_size.



4
5
6
# File 'lib/allstak/config.rb', line 4

def buffer_size
  @buffer_size
end

#capture_http_requestsObject

Returns the value of attribute capture_http_requests.



4
5
6
# File 'lib/allstak/config.rb', line 4

def capture_http_requests
  @capture_http_requests
end

#capture_sqlObject

Returns the value of attribute capture_sql.



4
5
6
# File 'lib/allstak/config.rb', line 4

def capture_sql
  @capture_sql
end

#capture_unhandled_exceptionsObject

Returns the value of attribute capture_unhandled_exceptions.



4
5
6
# File 'lib/allstak/config.rb', line 4

def capture_unhandled_exceptions
  @capture_unhandled_exceptions
end

#capture_user_contextObject

Returns the value of attribute capture_user_context.



4
5
6
# File 'lib/allstak/config.rb', line 4

def capture_user_context
  @capture_user_context
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



4
5
6
# File 'lib/allstak/config.rb', line 4

def connect_timeout
  @connect_timeout
end

#debugObject

Returns the value of attribute debug.



4
5
6
# File 'lib/allstak/config.rb', line 4

def debug
  @debug
end

#environmentObject

Returns the value of attribute environment.



4
5
6
# File 'lib/allstak/config.rb', line 4

def environment
  @environment
end

#flush_interval_msObject

Returns the value of attribute flush_interval_ms.



4
5
6
# File 'lib/allstak/config.rb', line 4

def flush_interval_ms
  @flush_interval_ms
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'lib/allstak/config.rb', line 4

def host
  @host
end

#max_retriesObject

Returns the value of attribute max_retries.



4
5
6
# File 'lib/allstak/config.rb', line 4

def max_retries
  @max_retries
end

#read_timeoutObject

Returns the value of attribute read_timeout.



4
5
6
# File 'lib/allstak/config.rb', line 4

def read_timeout
  @read_timeout
end

#releaseObject

Returns the value of attribute release.



4
5
6
# File 'lib/allstak/config.rb', line 4

def release
  @release
end

#service_nameObject

Returns the value of attribute service_name.



4
5
6
# File 'lib/allstak/config.rb', line 4

def service_name
  @service_name
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/allstak/config.rb', line 28

def valid?
  !@api_key.to_s.empty?
end