Class: ZuoraObservability::Env
- Inherits:
-
Object
- Object
- ZuoraObservability::Env
- Defined in:
- lib/zuora_observability/env.rb
Overview
Methods to get information about the application environment
Class Method Summary collapse
- .app_name ⇒ Object
- .environment ⇒ Object
- .full_process_name(process_name: nil, function: nil) ⇒ Object
- .name ⇒ Object
- .pod_name ⇒ Object
-
.process_type(default: 'Unknown') ⇒ Object
Returns the process type if any.
- .version ⇒ Object
Class Method Details
.app_name ⇒ Object
19 20 21 |
# File 'lib/zuora_observability/env.rb', line 19 def app_name ENV['DEIS_APP'].presence || app_parent_name end |
.environment ⇒ Object
15 16 17 |
# File 'lib/zuora_observability/env.rb', line 15 def environment ENV['Z_APPLICATION_ENVIRONMENT'] end |
.full_process_name(process_name: nil, function: nil) ⇒ Object
27 28 29 30 |
# File 'lib/zuora_observability/env.rb', line 27 def full_process_name(process_name: nil, function: nil) keys = [pod_name, process_name.presence || process_type, Process.pid, function] keys.compact.join('][').prepend('[').concat(']') end |
.name ⇒ Object
7 8 9 |
# File 'lib/zuora_observability/env.rb', line 7 def name ENV['Z_APPLICATION_NAME'] end |
.pod_name ⇒ Object
23 24 25 |
# File 'lib/zuora_observability/env.rb', line 23 def pod_name ENV['HOSTNAME'].presence || Socket.gethostname end |
.process_type(default: 'Unknown') ⇒ Object
Returns the process type if any
33 34 35 36 37 38 39 40 41 |
# File 'lib/zuora_observability/env.rb', line 33 def process_type(default: 'Unknown') p_type = default if ENV['HOSTNAME'] && ENV['DEIS_APP'] temp = ENV['HOSTNAME'].split(ENV['DEIS_APP'])[1] temp = temp.split(/(-[0-9a-zA-Z]{5})$/)[0] # remove the 5 char hash p_type = temp[1, temp.rindex("-")-1] end return p_type end |
.version ⇒ Object
11 12 13 |
# File 'lib/zuora_observability/env.rb', line 11 def version ENV['Z_APPLICATION_VERSION'] end |