Skip to content

Commit

Permalink
Use opentelemetry:time::now instead of systemtime in LogEmitter (open…
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Jan 24, 2025
1 parent b2d3d74 commit a1ac806
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/logs/log_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use opentelemetry::{otel_debug, otel_info, trace::TraceContextExt, Context, Inst
#[cfg(feature = "spec_unstable_logs_enabled")]
use opentelemetry::logs::Severity;

use std::time::SystemTime;
use opentelemetry::time::now;
use std::{
borrow::Cow,
sync::{
Expand Down Expand Up @@ -313,7 +313,7 @@ impl opentelemetry::logs::Logger for Logger {
}
}
if record.observed_timestamp.is_none() {
record.observed_timestamp = Some(SystemTime::now());
record.observed_timestamp = Some(now());
}

for p in processors {
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub mod trace;
pub mod logs;

#[doc(hidden)]
#[cfg(any(feature = "metrics", feature = "trace"))]
#[cfg(any(feature = "metrics", feature = "trace", feature = "logs"))]
pub mod time {
use std::time::SystemTime;

Expand Down

0 comments on commit a1ac806

Please sign in to comment.