lib/semantic_logger/formatters/signalfx.rb in semantic_logger-4.2.0 vs lib/semantic_logger/formatters/signalfx.rb in semantic_logger-4.2.1

- old
+ new

@@ -28,17 +28,16 @@ # Create SignalFx friendly metric. # Strip leading '/' # Convert remaining '/' to '.' def metric + name = log.metric.to_s.sub(/\A\/+/, '') if log.dimensions - name = log.metric.to_s.sub(/\A\/+/, '') - name.gsub!('/', '.') + name.tr!('/', '.') hash[:metric] = name else # Extract class and action from metric name - name = log.metric.to_s.sub(/\A\/+/, '') names = name.split('/') h = (hash[:dimensions] ||= {}) if names.size > 1 h[:action] = names.pop h[:class] = names.join('::') @@ -73,11 +72,11 @@ else log.named_tags.each_pair do |name, value| name = name.to_sym value = value.to_s next if value.empty? - h[name] = value if dimensions && dimensions.include?(name) + h[name] = value if dimensions&.include?(name) end end h[:host] = logger.host if log_host && logger.host h[:application] = logger.application if log_application && logger.application h[:environment] = environment if environment @@ -161,9 +160,8 @@ (item[:timestamp] == metric[:timestamp]) && (item[:metric] == metric[:metric]) && (item[:dimensions] == metric[:dimensions]) end end - end end end