Skip to content

Commit

Permalink
Fix: clippy suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: Bharat Jain <[email protected]>
  • Loading branch information
BharatKJain committed Oct 16, 2024
1 parent 6f26c59 commit b42443d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tremor-interceptor/src/postprocessor/gelf_chunking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//!
//! ## What's the logic for creating messgae id?
//!
//! TL;DR: We are using ingest_ns + increment_id + thread_id combination as the message id.
//! TL;DR: We are using `ingest_ns + increment_id + thread_id` combination as the message id.
//!
//! *Long explaination:*
//!
Expand All @@ -34,11 +34,11 @@
//! It probably doesn't have to be that clever:
//!
//! Using the timestamp plus a random number will mean we only have to worry about collision of random numbers,
//! we can make it more deterministic by using the ingest_ns + an incremental id as a message ID.
//! we can make it more deterministic by using the `ingest_ns` + an incremental id as a message ID.
//!
//! To keep it simple we're using this logic: (epoch_timestamp & 0xFF_FF) | (auto_increment_id << 16 )
//! To keep it simple we're using this logic: `(epoch_timestamp & 0xFF_FF) | (auto_increment_id << 16 )`
//!
//! [Reference conversation]{https://github.com/tremor-rs/tremor-runtime/pull/2662}
//! [Reference conversation]<https://github.com/tremor-rs/tremor-runtime/pull/2662>
//!
use super::Postprocessor;
Expand Down Expand Up @@ -187,7 +187,7 @@ impl Postprocessor for Gelf {

fn finish(&mut self, data: Option<&[u8]>) -> anyhow::Result<Vec<Vec<u8>>> {
if let Some(data) = data {
let current_epoch_timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_nanos() as u64;
let current_epoch_timestamp = u64::try_from(SystemTime::now().duration_since(UNIX_EPOCH).expect("SystemTime before UNIX EPOCH!").as_nanos())?;
Ok(self.encode_gelf(data, current_epoch_timestamp)?)
} else {
Ok(vec![])
Expand Down

0 comments on commit b42443d

Please sign in to comment.