Class: Apmlens::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/apmlens/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Configuration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/apmlens/configuration.rb', line 9

def initialize
  @ingestion_key = ENV["APMLENS_KEY"]
  @service = "ruby-app"
  @endpoint = ENV.fetch("APMLENS_ENDPOINT", "https://app.apmlens.com")
  @environment = ENV.fetch("RAILS_ENV", "development")
  @enabled = false
  @max_series_limit = 2_000
  @max_samples_limit = 100_000
  @max_queue_limit = 1_000
  @slow_query_threshold = 500 # ms
  @large_result_threshold = 2000 # records
end

Instance Attribute Details

#endpoint ⇒ Object

Returns the value of attribute endpoint.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def endpoint
  @endpoint
end

#environment ⇒ Object

Returns the value of attribute environment.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def environment
  @environment
end

#ingestion_key ⇒ Object

Returns the value of attribute ingestion_key.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def ingestion_key
  @ingestion_key
end

#large_result_threshold ⇒ Object

Returns the value of attribute large_result_threshold.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def large_result_threshold
  @large_result_threshold
end

#max_queue_limit ⇒ Object

Returns the value of attribute max_queue_limit.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def max_queue_limit
  @max_queue_limit
end

#max_samples_limit ⇒ Object

Returns the value of attribute max_samples_limit.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def max_samples_limit
  @max_samples_limit
end

#max_series_limit ⇒ Object

Returns the value of attribute max_series_limit.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def max_series_limit
  @max_series_limit
end

#service ⇒ Object

Returns the value of attribute service.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def service
  @service
end

#slow_query_threshold ⇒ Object

Returns the value of attribute slow_query_threshold.



5
6
7
# File 'lib/apmlens/configuration.rb', line 5

def slow_query_threshold
  @slow_query_threshold
end

Instance Method Details

#disable! ⇒ Object



30
31
32
# File 'lib/apmlens/configuration.rb', line 30

def disable!
  @enabled = false
end

#enable! ⇒ Object



26
27
28
# File 'lib/apmlens/configuration.rb', line 26

def enable!
  @enabled = true
end

#enabled? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/apmlens/configuration.rb', line 22

def enabled?
  @enabled && !@ingestion_key.nil?
end