Skip to content

Commit

Permalink
fix(OTLP/Trace): use Timestamp instead of Time for json (#2677)
Browse files Browse the repository at this point in the history
fix: use Timestamp instead of Time for trace time
  • Loading branch information
yuanbohan authored Nov 1, 2023
1 parent a9137b7 commit 4b48c71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/servers/src/otlp/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::collections::HashMap;
use api::v1::value::ValueData;
use api::v1::{ColumnDataType, RowInsertRequests};
use common_grpc::writer::Precision;
use common_time::time::Time;
use common_time::timestamp::Timestamp;
use itertools::Itertools;
use opentelemetry_proto::tonic::collector::trace::v1::ExportTraceServiceRequest;
use opentelemetry_proto::tonic::common::v1::any_value::Value as OtlpValue;
Expand Down Expand Up @@ -93,7 +93,7 @@ impl From<&Event> for SpanEvent {
fn from(event: &Event) -> Self {
Self {
name: event.name.clone(),
time: Time::new_nanosecond(event.time_unix_nano as i64).to_iso8601_string(),
time: Timestamp::new_nanosecond(event.time_unix_nano as i64).to_iso8601_string(),
attributes: vec_kv_to_string(&event.attributes),
}
}
Expand Down Expand Up @@ -315,7 +315,7 @@ pub fn status_to_string(status: &Option<Status>) -> (String, String) {

#[cfg(test)]
mod tests {
use common_time::time::Time;
use common_time::timestamp::Timestamp;
use opentelemetry_proto::tonic::common::v1::{
any_value, AnyValue, ArrayValue, KeyValue, KeyValueList,
};
Expand Down Expand Up @@ -431,7 +431,7 @@ mod tests {

let span_events = vec![SpanEvent {
name: event_name.clone(),
time: Time::new_nanosecond(time_unix_nano as i64).to_iso8601_string(),
time: Timestamp::new_nanosecond(time_unix_nano as i64).to_iso8601_string(),
attributes: vec_kv_to_string(&event_attributes),
}];
let expect_string = serde_json::to_string(&span_events).unwrap_or_default();
Expand Down

0 comments on commit 4b48c71

Please sign in to comment.