Skip to content

Commit ed51d99

Browse files
fix: change zipkin annotations timestamp from string to int (#1944)
Co-authored-by: Kayla Reopelle <[email protected]>
1 parent b1d95b4 commit ed51d99

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

exporter/zipkin/lib/opentelemetry/exporter/zipkin/transformer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ def add_annotations(zipkin_span, span_data)
117117
events = span_data.events.map do |event|
118118
if event.attributes.keys.length.zero?
119119
{
120-
timestamp: (event.timestamp / 1_000).to_s,
120+
timestamp: event.timestamp / 1_000,
121121
value: event.name
122122
}
123123
else
124124
{
125-
timestamp: (event.timestamp / 1_000).to_s,
125+
timestamp: event.timestamp / 1_000,
126126
value: { event.name => event.attributes.transform_values(&:to_s) }.to_json
127127
}
128128
end

exporter/zipkin/test/opentelemetry/exporters/zipkin/transformer_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
annotation_one = encoded_span[:annotations].first
5656
annotation_two = encoded_span[:annotations][1]
5757

58-
_(annotation_one[:timestamp]).must_equal((events[0].timestamp / 1_000).to_s)
58+
_(annotation_one[:timestamp]).must_equal(events[0].timestamp / 1_000)
5959
_(annotation_one[:value]).must_equal({ 'event_with_attribs' => { 'ekey' => 'evalue' } }.to_json)
6060

61-
_(annotation_two[:timestamp]).must_equal((events[1].timestamp / 1_000).to_s)
61+
_(annotation_two[:timestamp]).must_equal(events[1].timestamp / 1_000)
6262
_(annotation_two[:value]).must_equal('event_no_attrib')
6363

6464
tags = encoded_span['tags']
@@ -115,7 +115,7 @@
115115

116116
annotation_one = encoded_span[:annotations].first
117117

118-
_(annotation_one[:timestamp]).must_equal((events[0].timestamp / 1000).to_s)
118+
_(annotation_one[:timestamp]).must_equal(events[0].timestamp / 1000)
119119
_(annotation_one[:value]).must_equal({ 'event_with_attribs' => { 'ekey' => '["evalue"]' } }.to_json)
120120

121121
tags = encoded_span['tags']

0 commit comments

Comments
 (0)