Skip to content

Commit 091680d

Browse files
add epoch value to json
1 parent f72d814 commit 091680d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/otel/traces.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ fn flatten_events(events: &[Event], span_start_time_unix_nano: u64) -> Vec<Map<S
185185
convert_epoch_nano_to_timestamp(event.time_unix_nano as i64).to_string(),
186186
),
187187
);
188+
// add epoch value of event time in json
189+
event_json.insert(
190+
"event_time_unix_nano_epoch".to_string(),
191+
Value::Number(serde_json::Number::from(event.time_unix_nano)),
192+
);
188193
event_json.insert("event_name".to_string(), Value::String(event.name.clone()));
189194

190195
// Calculate event duration in milliseconds from span start
@@ -341,12 +346,22 @@ fn flatten_span_record(span_record: &Span) -> Vec<Map<String, Value>> {
341346
span_record.start_time_unix_nano as i64,
342347
)),
343348
);
349+
// add epoch value of start time in json
350+
span_record_json.insert(
351+
"span_start_time_unix_nano_epoch".to_string(),
352+
Value::Number(serde_json::Number::from(span_record.start_time_unix_nano)),
353+
);
344354
span_record_json.insert(
345355
"span_end_time_unix_nano".to_string(),
346356
Value::String(convert_epoch_nano_to_timestamp(
347357
span_record.end_time_unix_nano as i64,
348358
)),
349359
);
360+
// add epoch value of end time in json
361+
span_record_json.insert(
362+
"span_end_time_unix_nano_epoch".to_string(),
363+
Value::Number(serde_json::Number::from(span_record.end_time_unix_nano)),
364+
);
350365

351366
// Calculate span duration in nanoseconds
352367
let duration_nanos = span_record

0 commit comments

Comments
 (0)