Module: Braintrust::Internal::Env
- Defined in:
- lib/braintrust/internal/env.rb
Overview
Environment variable utilities.
Constant Summary collapse
- ENV_AUTO_INSTRUMENT =
"BRAINTRUST_AUTO_INSTRUMENT"- ENV_INSTRUMENT_EXCEPT =
"BRAINTRUST_INSTRUMENT_EXCEPT"- ENV_INSTRUMENT_ONLY =
"BRAINTRUST_INSTRUMENT_ONLY"- ENV_FLUSH_ON_EXIT =
"BRAINTRUST_FLUSH_ON_EXIT"
Class Method Summary collapse
- .auto_instrument ⇒ Object
-
.flush_on_exit ⇒ Object
Whether to automatically flush spans on program exit.
- .instrument_except ⇒ Object
- .instrument_only ⇒ Object
-
.parse_list(key) ⇒ Array<Symbol>?
Parse a comma-separated environment variable into an array of symbols.
Class Method Details
.auto_instrument ⇒ Object
12 13 14 |
# File 'lib/braintrust/internal/env.rb', line 12 def self.auto_instrument ENV[ENV_AUTO_INSTRUMENT] != "false" end |
.flush_on_exit ⇒ Object
Whether to automatically flush spans on program exit. Default: true
17 18 19 |
# File 'lib/braintrust/internal/env.rb', line 17 def self.flush_on_exit ENV[ENV_FLUSH_ON_EXIT] != "false" end |
.instrument_except ⇒ Object
21 22 23 |
# File 'lib/braintrust/internal/env.rb', line 21 def self.instrument_except parse_list(ENV_INSTRUMENT_EXCEPT) end |
.instrument_only ⇒ Object
25 26 27 |
# File 'lib/braintrust/internal/env.rb', line 25 def self.instrument_only parse_list(ENV_INSTRUMENT_ONLY) end |
.parse_list(key) ⇒ Array<Symbol>?
Parse a comma-separated environment variable into an array of symbols.
32 33 34 35 36 |
# File 'lib/braintrust/internal/env.rb', line 32 def self.parse_list(key) value = ENV[key] return nil unless value value.split(",").map(&:strip).map(&:to_sym) end |