Class: Brut::Instrumentation::OpenTelemetry::NormalizedAttributes
- Inherits:
-
Object
- Object
- Brut::Instrumentation::OpenTelemetry::NormalizedAttributes
- Defined in:
- lib/brut/instrumentation/open_telemetry.rb
Instance Method Summary collapse
-
#initialize(prefix, attributes) ⇒ NormalizedAttributes
constructor
A new instance of NormalizedAttributes.
-
#to_h ⇒ Object
Constructor Details
#initialize(prefix, attributes) ⇒ NormalizedAttributes
Returns a new instance of NormalizedAttributes.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/brut/instrumentation/open_telemetry.rb', line 94 def initialize(prefix,attributes) if prefix == :detect prefix = attributes.delete(:prefix) if prefix.nil? prefix = Brut.container.otel_attribute_prefix end end prefix_string = if prefix "#{prefix}." else "" end @attributes = (attributes || {}).map { |key,value| [ "#{prefix_string}#{key}", normalize_value(value) ] }.to_h end |
Instance Method Details
#to_h ⇒ Object
111 112 113 |
# File 'lib/brut/instrumentation/open_telemetry.rb', line 111 def to_h @attributes end |