lib/opentelemetry/exporters/jaeger/exporter/span_encoder.rb in opentelemetry-exporters-jaeger-0.4.0 vs lib/opentelemetry/exporters/jaeger/exporter/span_encoder.rb in opentelemetry-exporters-jaeger-0.5.0
- old
+ new
@@ -13,12 +13,12 @@
def encoded_span(span_data) # rubocop:disable Metrics/AbcSize
start_time = (span_data.start_timestamp.to_f * 1_000_000).to_i
duration = (span_data.end_timestamp.to_f * 1_000_000).to_i - start_time
Thrift::Span.new(
- 'traceIdLow' => int64(span_data.trace_id[16, 16]),
- 'traceIdHigh' => int64(span_data.trace_id[0, 16]),
+ 'traceIdLow' => int64(span_data.trace_id[8, 8]),
+ 'traceIdHigh' => int64(span_data.trace_id[0, 8]),
'spanId' => int64(span_data.span_id),
'parentSpanId' => int64(span_data.parent_span_id),
'operationName' => span_data.name,
'references' => encoded_references(span_data.links),
'flags' => span_data.trace_flags.sampled? ? 1 : 0,
@@ -104,11 +104,11 @@
TYPE => @type_map[value_key],
value_key => value
)
end
- def int64(hex_string)
- int = hex_string.to_i(16)
+ def int64(byte_string)
+ int = byte_string.unpack1('Q>')
int < (1 << 63) ? int : int - (1 << 64)
end
end
end
end