-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: message-id in postprocessor/gelf-chunking #2662
Conversation
7954549
to
ba74fab
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2662 +/- ##
==========================================
+ Coverage 91.27% 91.34% +0.07%
==========================================
Files 308 308
Lines 60116 60229 +113
==========================================
+ Hits 54868 55016 +148
+ Misses 5248 5213 -35
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks reasonable nothing to prevent using this I see, great documentation too :)
two things I notice.
-
it would be nice to mention how message id's are generated in the docs (the
//!
section) -
if you are up for a challenge: we try to keep all time and randomness out of tremor to allow for deterministic replays. We do this by using
ingest_ns
for as a random seed, and for times, that way a event that is logged with it's ingest ns can be replayed and generate the exact same out put. The random function is a good example. It'd be interesting to see this same concept re-used for this to allow repeatable yet still random message id's; one way would be to use ingest-ns instead of the current epoch (which would be nice anyway as looking uo time isn't fast), and then seed the RNG somehow (probably not with the ingest ns as that would make it useless) but perhaps with the fist n bytes of the message? or with some bytes of a hash of the message?
(How it will break server-side due to collision? So message-id is a way of determining if the UDP packet is associated with already existing log or it's for a new log, when we're sending same message-id for multiple logs then server behaviour will be to merge the data-together which will end-up breaking the log) TBH I am also trying to figure this out, please share any suggestions, am I thinking right? 😅 |
ba74fab
to
3e4f5a1
Compare
Ja just the message content would not work, I'm still considering if message content + ingest_ns (nanosecond when the message was registered at tremor) would be enough, if a server produces the same log twice in the same nanosecond that'd be very odd (but not impossible) OTOH having two random generated numbers be the same is also odd (but not impossible) it would also one a more deterministic failure case "When messages with the same content arrive at exactly the same time they will get duplicated message ids" instead of "if the RNG hates you, you'll get duplicated message ids" |
cb303e1
to
b45a96a
Compare
Sorry for all the forth and back, so I've been thinking about a good way to make this:
and wanted to throw out a suggestion using the ingest_ns + an incremental id as a message ID. This is:
|
Can I keep thread-id just to reduce the collision probability more? 😅 |
7870889
to
026f39c
Compare
Okay, I have made the changes as suggested in the latest comment.
(epoch_timestamp is ingest_ns when
Let me know your thoughts! |
I would remove the thread ID. It is breaking the distribution and making the date less unique also it prevents event id's to be replayable. Basiclly it will result in the lower 13 bit to ave 3 times as many 1's as 0's making them more likely to collide while also making the id not determinstic. The second problem I spot is that by removing the lower 13 bit from increment, that part will have no effect for the first 8192 messages and then only change every 8192 messages. My suggestion would be to shift it by 13 bits instead of truncating them. Lastly I'd probably pull in a few more bits form the timestap, 13 bit are only You'd end up with something like this: (epoch_timestamp & 0xFF_FF) | (auto_increment_id << 16 )
``
do you think that would solve the original problem? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wooh wooh
I will fix the clippy checks and DCO, please allow me sometime. Honestly I didn't anticipate this to happen but I also created otel gelf-exporter. :) |
d63e383
to
b42443d
Compare
Line 190:
Not sure how to handle this better, is this okay? |
We'd want to avoid the expect. Let me explain why.
To do that there are a few ways |
8f0422a
to
c340296
Compare
745d14e
to
6679484
Compare
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Co-authored-by: Heinz N. Gies <heinz@licenser.net> Signed-off-by: Bharat Kumar Jain <33486187+BharatKJain@users.noreply.github.com> Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
Signed-off-by: Bharat Jain <bharat.mayoor77@gmail.com>
a0f57f9
to
116a48f
Compare
@BharatKJain LGTM now. I think you just need to click on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Pull request
Description
Changed message-id from auto-increment ID to randomized ID in postprocessor/gelf_chunking.rs
HELP NEEDED: I have avoided adding hostname while producing message-id, I am not sure how can we handle adding hostname, please suggest.
Related
Checklist
Performance