You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# An invalid trace identifier, a 16-byte array with all zero bytes, encoded
# as a hexadecimal string.
INVALID_TRACE_ID=('0' * 32).freeze
# An invalid span identifier, an 8-byte array with all zero bytes, encoded
# as a hexadecimal string.
INVALID_SPAN_ID=('0' * 16).freeze
# Generates a valid trace identifier, a 16-byte array with at least one
# non-zero byte, encoded as a hexadecimal string.
#
# @return [String] a hexadecimal string encoding of a valid trace ID.
defself.generate_trace_id
loopdo
id=Random::DEFAULT.bytes(16).unpack1('H*')
returnidunlessid == INVALID_TRACE_ID
end
end
# Generates a valid span identifier, an 8-byte array with at least one
# non-zero byte, encoded as a hexadecimal string.
#
# @return [String] a hexadecimal string encoding of a valid span ID.
defself.generate_span_id
loopdo
id=Random::DEFAULT.bytes(8).unpack1('H*')
returnidunlessid == INVALID_SPAN_ID
end
end
end
end
We should conform to the spec. This actually makes a few things better, including fewer allocations overall and making translation to things that don't use hex strings much easier to understand and prove correct.
The text was updated successfully, but these errors were encountered:
The specification for
SpanContext
requires that:Our representation is 16 and 32 character hex strings:
opentelemetry-ruby/api/lib/opentelemetry/trace.rb
Lines 11 to 42 in 79b047a
We should conform to the spec. This actually makes a few things better, including fewer allocations overall and making translation to things that don't use hex strings much easier to understand and prove correct.
The text was updated successfully, but these errors were encountered: