Class: Bigcommerce::Lightstep::Interceptors::Env
- Defined in:
- lib/bigcommerce/lightstep/interceptors/env.rb
Overview
Hydrates span tags with specified ENV vars
Constant Summary collapse
- PRESET_NOMAD =
{ 'container.cpu': 'NOMAD_CPU_LIMIT', 'container.mem': 'NOMAD_MEMORY_LIMIT', 'git.sha': 'NOMAD_META_SHA', 'nomad.node.id': 'NOMAD_NODE_ID', 'nomad.node.name': 'NOMAD_NODE_NAME', 'nomad.task_name': 'NOMAD_TASK_NAME', 'provider.region': 'NOMAD_REGION', 'provider.datacenter': 'NOMAD_DC' }.freeze
- PRESET_HOSTNAME =
{ hostname: 'HOSTNAME' }.freeze
Instance Method Summary collapse
- #call(span:) {|span| ... } ⇒ Object
-
#initialize(keys: nil, env: nil, presets: []) ⇒ Env
constructor
A new instance of Env.
Constructor Details
#initialize(keys: nil, env: nil, presets: []) ⇒ Env
Returns a new instance of Env.
45 46 47 48 49 50 51 52 |
# File 'lib/bigcommerce/lightstep/interceptors/env.rb', line 45 def initialize(keys: nil, env: nil, presets: []) super() @keys = keys || {} @presets = presets || [] @env = env || ENV augment_keys_with_presets! collect_values! end |
Instance Method Details
#call(span:) {|span| ... } ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/bigcommerce/lightstep/interceptors/env.rb', line 57 def call(span:) return yield span unless root_span?(span) value_mutex do @values.each do |span_key, value| span.set_tag(span_key, value) end end yield span end |