lib/opentelemetry/exporter/jaeger/encoder.rb in opentelemetry-exporter-jaeger-0.17.0 vs lib/opentelemetry/exporter/jaeger/encoder.rb in opentelemetry-exporter-jaeger-0.18.0
- old
+ new
@@ -63,12 +63,12 @@
value_key => value
)
end
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
+ start_time = span_data.start_timestamp / 1_000
+ duration = span_data.end_timestamp / 1_000 - start_time
Thrift::Span.new(
'traceIdLow' => int64(span_data.trace_id[8, 8]),
'traceIdHigh' => int64(span_data.trace_id[0, 8]),
'spanId' => int64(span_data.span_id),
@@ -100,21 +100,21 @@
end
def encoded_logs(events)
events&.map do |event|
Thrift::Log.new(
- 'timestamp' => (event.timestamp.to_f * 1_000_000).to_i,
+ 'timestamp' => event.timestamp / 1_000,
'fields' => encoded_tags(event.attributes) + encoded_tags('name' => event.name)
)
end
end
def encoded_references(links)
links&.map do |link|
Thrift::SpanRef.new(
'refType' => Thrift::SpanRefType::FOLLOWS_FROM,
- 'traceIdLow' => int64(link.span_context.trace_id[16, 16]),
- 'traceIdHigh' => int64(link.span_context.trace_id[0, 16]),
+ 'traceIdLow' => int64(link.span_context.trace_id[8, 8]),
+ 'traceIdHigh' => int64(link.span_context.trace_id[0, 8]),
'spanId' => int64(link.span_context.span_id)
)
end
end