Module: Julewire::GCP::FormatterOptions
- Defined in:
- lib/julewire/gcp/formatter_options.rb
Constant Summary collapse
- ALLOWED_KEYS =
%i[ label_formatter label_options max_label_key_bytes max_label_value_bytes max_labels span_id_path trace_id_path trace_sampled_path ].freeze
Class Method Summary collapse
- .label_formatter(options) ⇒ Object
- .label_options(options) ⇒ Object
- .trace_headers_paths(paths) ⇒ Object
- .trace_value_path(path) ⇒ Object
- .validate!(options) ⇒ Object
Class Method Details
.label_formatter(options) ⇒ Object
30 31 32 |
# File 'lib/julewire/gcp/formatter_options.rb', line 30 def label_formatter() [:label_formatter] || LabelFormatter.new(**()) end |
.label_options(options) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/julewire/gcp/formatter_options.rb', line 34 def () = .fetch(:label_options, {}).dup %i[max_labels max_label_key_bytes max_label_value_bytes].each do |key| [key] = [key] if .key?(key) end end |
.trace_headers_paths(paths) ⇒ Object
22 23 24 |
# File 'lib/julewire/gcp/formatter_options.rb', line 22 def trace_headers_paths(paths) Array(paths).filter_map { normalize_path(it, min_length: 1) }.freeze end |
.trace_value_path(path) ⇒ Object
26 27 28 |
# File 'lib/julewire/gcp/formatter_options.rb', line 26 def trace_value_path(path) normalize_path(path, min_length: 2) end |
.validate!(options) ⇒ Object
18 19 20 |
# File 'lib/julewire/gcp/formatter_options.rb', line 18 def validate!() Core::Validation.(, ALLOWED_KEYS, name: :formatter) end |