lib/opentelemetry/trace/tracestate.rb in opentelemetry-api-1.0.2 vs lib/opentelemetry/trace/tracestate.rb in opentelemetry-api-1.1.0

- old
+ new

@@ -9,11 +9,11 @@ # Tracestate is a part of SpanContext, represented by an immutable list of # string key/value pairs and formally defined by the W3C Trace Context # specification https://www.w3.org/TR/trace-context/ class Tracestate class << self - private :new # rubocop:disable Style/AccessModifierDeclarations + private :new # Returns a newly created Tracestate parsed from the header provided. # # @param [String] header Encoding of the tracestate header defined by # the W3C Trace Context specification https://www.w3.org/TR/trace-context/ @@ -98,10 +98,13 @@ # @param [String] key The key to add or update. # @param [String] value The value to add or update. # @return [Tracestate] self, if unchanged, or a new Tracestate containing # the new or updated key/value pair. def set_value(key, value) - return self unless VALID_KEY.match?(key) && VALID_VALUE.match?(value) + unless VALID_KEY.match?(key) && VALID_VALUE.match?(value) + OpenTelemetry.logger.debug("Invalid Tracestate member - #{key} : #{value}") + return self + end h = Hash[@hash] h[key] = value self.class.create(h) end