Convert opencode transcripts to otel (or agent) traces
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

timestamp fixes

rektide 1105d25e b8defa52

+9 -6
+9 -6
src/exporter.rs
··· 11 11 SystemTime::UNIX_EPOCH + Duration::from_millis(timestamp_ms as i64) 12 12 } 13 13 14 + fn ms_to_ns(ms: u64) -> u128 { 15 + (ms as u128) * 1_000_000u64 16 + } 17 + 14 18 fn convert_duration_ms(duration_ms: Option<u64>) -> Option<Duration> { 15 19 duration_ms.map(|ms| Duration::from_millis(ms)) 16 20 } ··· 166 170 builder.span_kind = Some(SpanKind::Client); 167 171 builder.attributes = Some(attributes); 168 172 169 - let start_time = convert_to_system_time(span.timestamp_ms); 173 + if let Some(start_time) = ms_to_ns(convert_to_system_time(span.timestamp_ms)) { 174 + builder.start_time = Some(start_time); 175 + } 170 176 builder.start_time = Some(start_time); 171 - 172 - if let Some(duration_ms) = span.duration_ms { 173 - let end_timestamp = span.timestamp.checked_add(jiff::Span::new().try_milliseconds(duration_ms as i64).unwrap()).unwrap(); 174 - let start_time = convert_to_system_time(span.timestamp_ms); 175 - builder.end_time = Some(end_time); 177 + let end_timestamp = span.timestamp.checked_add_ms(duration_ms as i64).unwrap(); 178 + let start_time = ms_to_ns(convert_to_system_time(span.timestamp_ms)); 176 179 } 177 180 178 181 let _span = self.tracer.build(builder);